use Data::Dump for nicer (shorter/more readable) output instead of
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 19 Nov 2007 16:37:00 +0000 (16:37 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 19 Nov 2007 16:37:00 +0000 (16:37 +0000)
Data::Dumper

git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@26 49f9634a-d7ec-0310-8e6b-ec35c6cc8804

Fast.pm
Makefile.PL
scripts/dump_fastmarc.pl
t/001_marc.t

diff --git a/Fast.pm b/Fast.pm
index ace03b3..f944654 100644 (file)
--- a/Fast.pm
+++ b/Fast.pm
@@ -2,7 +2,7 @@ package MARC::Fast;
 
 use strict;
 use Carp;
 
 use strict;
 use Carp;
-use Data::Dumper;
+use Data::Dump qw/dump/;
 
 BEGIN {
        use Exporter ();
 
 BEGIN {
        use Exporter ();
@@ -124,6 +124,7 @@ sub new {
 
                # skip to next record
                my $o = substr($leader,0,5);
 
                # skip to next record
                my $o = substr($leader,0,5);
+               warn "# in record ", $self->{count}," record length isn't number but: ",dump($o),"\n" unless $o =~ m/^\d+$/;
                if ($o > 24) {
                        seek($self->{fh},$o-24,1) if ($o);
                } else {
                if ($o > 24) {
                        seek($self->{fh},$o-24,1) if ($o);
                } else {
index 55a62da..b9e62bc 100644 (file)
@@ -9,6 +9,7 @@ WriteMakefile(
     PREREQ_PM    => {
        'Test::Simple' => 0.44,
        'Test::Exception' => 0,
     PREREQ_PM    => {
        'Test::Simple' => 0.44,
        'Test::Exception' => 0,
+       'Data::Dump' => 0,
        'Carp' => 0,
     },
 );
        'Carp' => 0,
     },
 );
index efce954..fc6317c 100755 (executable)
@@ -5,7 +5,7 @@ use blib;
 
 use MARC::Fast;
 use Getopt::Std;
 
 use MARC::Fast;
 use Getopt::Std;
-use Data::Dumper;
+use Data::Dump qw/dump/;
 
 =head1 NAME
 
 
 =head1 NAME
 
@@ -65,9 +65,9 @@ if (my $mfn = $opt{n}) {
 
 for my $mfn ($min .. $max) {
        my $rec = $marc->fetch($mfn) || next;
 
 for my $mfn ($min .. $max) {
        my $rec = $marc->fetch($mfn) || next;
-       print "rec is ",Dumper($rec) if ($opt{d});
+       print "rec is ",dump($rec) if ($opt{d});
        print "REC $mfn\n";
        print $marc->last_leader,"\n";
        print $marc->to_ascii($mfn),"\n";
        print "REC $mfn\n";
        print $marc->last_leader,"\n";
        print $marc->to_ascii($mfn),"\n";
-       print "hash is ",Dumper($marc->to_hash($mfn, include_subfields => 1)) if ($opt{h});
+       print "hash is ",dump($marc->to_hash($mfn)) if ($opt{h});
 }
 }
index c05fcd6..ddbee94 100755 (executable)
@@ -5,6 +5,7 @@ use blib;
 
 use Test::More tests => 63;
 use Test::Exception;
 
 use Test::More tests => 63;
 use Test::Exception;
+use Data::Dump qw/dump/;
 
 BEGIN {
        use_ok( 'MARC::Fast' );
 
 BEGIN {
        use_ok( 'MARC::Fast' );
@@ -14,11 +15,6 @@ my $debug = shift @ARGV;
 
 my $marc_file = 't/camel.usmarc';
 
 
 my $marc_file = 't/camel.usmarc';
 
-if ( $debug ) {
-       eval { require Data::Dump; };
-       $debug = 0 if ($@);
-}
-
 my $marc;
 my %param;
 
 my $marc;
 my %param;