From: Vincent Pit <vince@profvince.com>
Date: Fri, 1 Jan 2010 22:14:42 +0000 (+0100)
Subject: Make two subs available in the sample script
X-Git-Tag: v0.01~16
X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=da3f79dfb936676099e3da9c69cf619a7df005e9;p=perl%2Fmodules%2FSub-Op.git

Make two subs available in the sample script

And output more debugging info.
---

diff --git a/samples/try.pl b/samples/try.pl
index 399dbb9..a3e25b5 100755
--- a/samples/try.pl
+++ b/samples/try.pl
@@ -9,10 +9,26 @@ use blib;
 use blib 't/Sub-Op-Test';
 
 my $code = $ARGV[0];
-die "Usage: $0 'code involving f()'" unless defined $code;
+die "Usage: $0 'code involving f() and g()'" unless defined $code;
 
-eval <<"CODE";
+my $cb = eval <<"CODE";
  use Sub::Op::Test f => sub { say 'f(' . join(', ', \@_) . ')'; \@_ };
- $code
+ use Sub::Op::Test g => sub { say 'g(' . join(', ', \@_) . ')'; \@_ };
+ sub { $code }
 CODE
 die $@ if $@;
+
+print "--- run ---\n";
+eval { $cb->() };
+warn "exception: $@" if $@;
+
+print "--- deparse ---\n";
+use B::Deparse;
+print B::Deparse->new->coderef2text($cb), "\n";
+
+print "--- concise ---\n";
+use B::Concise;
+B::Concise::compile($cb)->();
+
+print "--- concise(exec) ---\n";
+B::Concise::compile('-exec', $cb)->();