I took chromatic's Runops::Trace and hacked it up so I could do code coverage. I can now tell which code path is triggered by which inputs.
Check this badness out. The punchline is the lists of equivalent inputs. Roughly. Ops can return different things and I'm not paying attention to the inputs - it's only the path traversed. --- nextstate=8207260 pushmark=8205ea0 padsv=8205e60 entersub=8207240 nextstate=81326d0 aelemfast=8132600 const=81325d0 modulo=8143d28 const=8143d50 eq=8143a80 cond_expr=81b6d18 const=8174510 leavesub=81749b0 nextstate=8203f08 pushmark=8203ea0 gv=8201128 rv2cv=8201078 refgen=8203ec0 gv=82010e8 rv2gv=8201108 sassign=8203ee0: - 1 - 3 - 5 - 7 - 9 nextstate=8207260 pushmark=8205ea0 padsv=8205e60 entersub=8207240 nextstate=81326d0 aelemfast=8132600 const=81325d0 modulo=8143d28 const=8143d50 eq=8143a80 cond_expr=81b6d18 const=8174558 leavesub=81749b0 nextstate=8203f08 pushmark=8203ea0 gv=8201128 rv2cv=8201078 refgen=8203ec0 gv=82010e8 rv2gv=8201108 sassign=8203ee0: - 0 - 2 - 4 - 6 - 8 - 10 use YAML 'Dump'; use Runops::Trace 0.02; my %INPUTS; sub is_even { $_[0] % 2 == 0 ? 'a' : 'b' } for ( 0 .. 10 ) { push @{$INPUTS{join ' ', trace( \&is_even, $_ )}}, $_; } print Dump( \ %INPUTS ); sub trace { my $f = shift @_; local @OPS = (); *Op::display = \ &do_trace; &$f; *Op::display = \ &no_trace; return @OPS; } sub do_trace { push @OPS, sprintf '%s=%0x', $_[1], $_[2] } sub no_trace { } I needed a new version of Runops-Trace. Get the original at http://www.advogato.org/person/chromatic/diary.html?start=234. diff -ru Runops-Trace-0.01/lib/Runops/Trace.pm Runops-Trace-0.02/lib/Runops/Trace.pm --- Runops-Trace-0.01/lib/Runops/Trace.pm 2005-10-05 19:01:31.000000000 -0700 +++ Runops-Trace-0.02/lib/Runops/Trace.pm 2007-06-16 21:09:18.000000000 -0700 @@ -7,14 +7,11 @@ use base 'DynaLoader'; -Runops::Trace->bootstrap( $VERSION ); +Runops::Trace->bootstrap($VERSION); package Op; -sub display -{ - my ($class, $name) = @_; - print "# Found op named $name\n"; +sub display { } 1; diff -ru Runops-Trace-0.01/MANIFEST Runops-Trace-0.02/MANIFEST --- Runops-Trace-0.01/MANIFEST 2005-10-05 19:01:31.000000000 -0700 +++ Runops-Trace-0.02/MANIFEST 2007-06-16 20:46:07.000000000 -0700 @@ -1,6 +1,6 @@ Changes lib/Runops/Trace.pm -lib/Runops/Trace.xs +Trace.xs Makefile.PL MANIFEST t/01compile.t diff -ru Runops-Trace-0.01/Trace.xs Runops-Trace-0.02/Trace.xs --- Runops-Trace-0.01/Trace.xs 2005-10-05 19:01:31.000000000 -0700 +++ Runops-Trace-0.02/Trace.xs 2007-06-16 21:22:57.000000000 -0700 @@ -19,6 +19,7 @@ PUSHMARK(sp); XPUSHs( sv_2mortal( newSVpv( "Op", 2 ) ) ); XPUSHs( sv_2mortal( newSVpv( PL_op_name[ old_op->op_type ], 0 ) ) ); + XPUSHs( sv_2mortal( newSVuv( PTR2UV(old_op) ) ) ); PUTBACK; call_method( "display", G_VOID | G_DISCARD ); Josh