Data-AnyXfer
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Data/AnyXfer.pm view on Meta::CPAN
package Data::AnyXfer;
use Modern::Perl;
use Moo;
use MooX::Types::MooseLike::Base qw(:all);
use File::Temp qw/ tempdir /;
use Clone qw/ clone /;
use Path::Class qw( dir );
use Data::AnyXfer::Log4perl qw/ get_logger /;
our $VERSION = '0.1';
=head1 NAME
Data::AnyXfer - data transfer base class
=head1 DESCRIPTION
This is a base class for data transfers. It does nothing on it's own
except log calls to methods for tracing.
=head1 ATTRIBUTES
=head2 C<callback>
This is an optional callback on the hashref returned by
L</transform>. It should be a subroutine that takes a
L<Data::AnyXfer> object and a hash reference as
arguments, e.g.
use Intranet::MGReports::Import::Lettings;
sub debug {
my ( $import, $data ) = @_;
$import->log->debug( Dumper($data) );
return 1;
}
my $import = Intranet::MGReports::Import:Lettings->new(
callback => \&debug, #
);
If the callback returns a false value, then the run will stop.
Note that the callback is passed a copy of the record, and any
modifications will not be saved.
Generally this will only be used for testing and debugging.
=cut
has 'callback' => (
is => 'ro',
isa => Maybe[CodeRef],
);
=head2 C<log>
This is an optional L<Log::Log4perl::Logger> object. It defaults to
the logger returned by L<Core::Log4perl>, and can be used
for logging events during a script, e.g.
view all matches for this distributionview release on metacpan - search on metacpan
( run in 2.873 seconds using v1.00-cache-2.02-grep-82fe00e-cpan-48ebf85a1963 )