make Data::Dump optional
[MARC-Fast] / t / 001_marc.t
index 02d75af..3553dc3 100755 (executable)
@@ -5,11 +5,16 @@ use blib;
 
 use Test::More tests => 40;
 use Test::Exception;
-use Data::Dump qw/dump/;
 
-BEGIN { use_ok( 'MARC::Fast' ); }
+BEGIN {
+       use_ok( 'MARC::Fast' );
+}
 
 my $debug = shift @ARGV;
+if ( $debug ) {
+       eval { require Data::Dump; };
+       $debug = 0 if ($@);
+}
 
 my $marc;
 my %param;
@@ -42,7 +47,7 @@ SKIP: {
                ok($marc->fetch($_), "fetch $_");
 
                ok(my $hash = $marc->to_hash($_), "to_hash $_");
-               diag "to_hash($_) = ",dump($hash) if ($debug);
+               diag "to_hash($_) = ",Data::Dump::dump($hash) if ($debug);
                ok(my $ascii = $marc->to_ascii($_), "to_ascii $_");
                diag "to_ascii($_) ::\n$ascii" if ($debug);
        }