]> git.vpit.fr Git - perl/modules/Sub-Nary.git/commitdiff
Make the sample script use B::RecDeparse when available
authorVincent Pit <vince@profvince.com>
Wed, 20 Aug 2008 19:01:20 +0000 (21:01 +0200)
committerVincent Pit <vince@profvince.com>
Wed, 20 Aug 2008 19:01:20 +0000 (21:01 +0200)
samples/cx.pl

index fec95776d182467e8d12892d6db5414f58ad0747..14cb2375552ee82069f314fbb33c37a19a0ceb64 100755 (executable)
@@ -4,7 +4,16 @@ use strict;
 use warnings;
 
 use lib qw{blib/lib blib/arch};
-use B::Deparse;
+
+my $bd;
+BEGIN {
+ if (eval "use B::RecDeparse; 1") {
+  $bd = B::RecDeparse->new;
+ } else {
+  use B::Deparse;
+  $bd = B::Deparse->new;
+ }
+}
 use B::Concise;
 use Sub::Nary;
 
@@ -63,7 +72,6 @@ sub ifr {
 
 my $code = \&wut;
 
-my $bd = B::Deparse->new();
 print STDERR $bd->coderef2text($code), "\n";
 
 B::Concise::walk_output(\*STDERR);