LWP::Sink - Something that receive data
require LWP::Sink; @ISA=qw(LWP::Sink);
The LWP::Sink class is an abstraction similar to writeable files. You can send data to it. Different variations of sinks are available that all conform to this simple interface:
The object constructor. The LWP::Sink class is abstract, so you will create some subclass normally.
Data is given to a sink by calling the put() method with suitable sized chunkes of data. The return value from $s->put will be a reference to the object itself.
Buffered data should be processed/sent off.
Invoking the close() method signals that the last chunk of data has been put()ed. Resources associated with the sink can now be freed.
One important class of sinks are those that transform data in some way. These will be subclasses of LWP::Sink::_Pipe which means that they have a attribute called sink that reference the sink that will received data after processing. By convention call transformation sink classes have all lowercase names within the LWP::Sink::* namespace. They also have variations suffixed with ::encode and ::decode that performs the transformations forwards or backwards.
Perhaps LWP::Sink should provide an interface to load sink subclasses on demand and return references to them. Similar to how URI works.
Copyright 1998, Gisle Aas
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.