NAME
Data::Pipeline::Adapter - data format i/o adapter
SYNOPSIS
Creating an Adapter
package My::Adapter;
use Moose;
extends 'Data::Pipeline::Adapter';
has '+source' => (
default => sub {
my($self) = @_;
# build Data::Pipeline::Iterator::Source
}
);
Serializing to the default handling of targets:
augment serialize => sub {
my($self, $iterator, $target) = @_;
# return serialized form of one item from iterator
};
Overriding how targets are handled:
override serialize => sub {
my($self, $iterator, $target) = @_;
# serialize $iterator to $target
};
Using an Adapter
use My::Adapter;
my $out = My::Adapter -> new( ... ) -> transform( $iterator );
$out -> to( \$string ); # $string now contains serialization
my $iterator = $pipeline -> transform( My::Adapter -> new( ... ) );