From 5fc18887422d2dd62c716b73d81a226f3a295e5b Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Mon, 19 Nov 2007 16:37:00 +0000 Subject: [PATCH] use Data::Dump for nicer (shorter/more readable) output instead of Data::Dumper git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@26 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 --- Fast.pm | 3 ++- Makefile.PL | 1 + scripts/dump_fastmarc.pl | 6 +++--- t/001_marc.t | 6 +----- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Fast.pm b/Fast.pm index ace03b3..f944654 100644 --- a/Fast.pm +++ b/Fast.pm @@ -2,7 +2,7 @@ package MARC::Fast; use strict; use Carp; -use Data::Dumper; +use Data::Dump qw/dump/; BEGIN { use Exporter (); @@ -124,6 +124,7 @@ sub new { # 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 { diff --git a/Makefile.PL b/Makefile.PL index 55a62da..b9e62bc 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -9,6 +9,7 @@ WriteMakefile( PREREQ_PM => { 'Test::Simple' => 0.44, 'Test::Exception' => 0, + 'Data::Dump' => 0, 'Carp' => 0, }, ); diff --git a/scripts/dump_fastmarc.pl b/scripts/dump_fastmarc.pl index efce954..fc6317c 100755 --- a/scripts/dump_fastmarc.pl +++ b/scripts/dump_fastmarc.pl @@ -5,7 +5,7 @@ use blib; use MARC::Fast; use Getopt::Std; -use Data::Dumper; +use Data::Dump qw/dump/; =head1 NAME @@ -65,9 +65,9 @@ if (my $mfn = $opt{n}) { 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 "hash is ",Dumper($marc->to_hash($mfn, include_subfields => 1)) if ($opt{h}); + print "hash is ",dump($marc->to_hash($mfn)) if ($opt{h}); } diff --git a/t/001_marc.t b/t/001_marc.t index c05fcd6..ddbee94 100755 --- a/t/001_marc.t +++ b/t/001_marc.t @@ -5,6 +5,7 @@ use blib; use Test::More tests => 63; use Test::Exception; +use Data::Dump qw/dump/; BEGIN { use_ok( 'MARC::Fast' ); @@ -14,11 +15,6 @@ my $debug = shift @ARGV; my $marc_file = 't/camel.usmarc'; -if ( $debug ) { - eval { require Data::Dump; }; - $debug = 0 if ($@); -} - my $marc; my %param; -- 2.20.1