use WebPAC::Common;
use base qw/WebPAC::Common/;
-use Data::Dumper;
+use Data::Dump qw/dump/;
use Encode qw/from_to/;
=head1 NAME
=head1 VERSION
-Version 0.14
+Version 0.15
=cut
-our $VERSION = '0.14';
+our $VERSION = '0.15';
=head1 SYNOPSIS
require $module_path;
- # check if required subclasses are implemented
- foreach my $subclass (qw/open_db fetch_rec init dump_rec/) {
- # FIXME
- }
-
$self->{'encoding'} ||= 'ISO-8859-2';
$self ? return $self : return undef;
$log->debug("using modify_file $p");
$rec_regex = $self->modify_file_regexps( $p );
} elsif (my $h = $arg->{modify_records}) {
- $log->debug("using modify_records ", Dumper( $h ));
+ $log->debug("using modify_records ", sub { dump( $h ) });
$rec_regex = $self->modify_record_regexps(%{ $h });
}
- $log->debug("rec_regex: ", Dumper($rec_regex)) if ($rec_regex);
+ $log->debug("rec_regex: ", sub { dump($rec_regex) }) if ($rec_regex);
my $class = $self->{module} || $log->logconfess("can't get low-level module name!");
return $l;
});
- $log->debug(sub { Dumper($rec) });
+ $log->debug(sub { dump($rec) });
if (! $rec) {
$log->warn("record $pos empty? skipping...");
} sort { $a cmp $b } keys %{ $s->{fld} }
);
- $log->debug( sub { Dumper($s) } );
+ $log->debug( sub { dump($s) } );
return $out;
}
sub dump {
my $self = shift;
- return $self->{ll_db}->dump_rec( $self->{pos} );
+ return unless $self->{ll_db};
+ if ($self->{ll_db}->can('dump_rec')) {
+ return $self->{ll_db}->dump_rec( $self->{pos} );
+ } else {
+ return dump( $self->{ll_db}->fetch_rec( $self->{pos} ) );
+ }
}
=head2 modify_record_regexps
#!/usr/bin/perl -w
-use Test::More tests => 89;
+use Test::More tests => 104;
use Test::Exception;
use Cwd qw/abs_path/;
use blib;
ok(my $rec = $input->fetch, "fetch $mfn");
cmp_ok($input->pos, '==', $mfn, "pos $mfn");
push @db, $rec;
+ ok(my $dump = $input->dump, "dump $mfn");
+ diag $dump if ($debug);
}
return @db;