Ok, so here is an example of grepping the output from B::Xref to find out if a particular file contains a sub.
use strict; use warnings; my @xref = qx/perl -MO=Xref my_test_file.pl/; my $subname = "my_sub_name"; my @subs = grep { /(?:\&|Subroutine\s)$subname/ } @xref; print "$_\n" foreach @subs;
Dave
In reply to Re^5: reaching into a perl script from a package
by davido
in thread reaching into a perl script from a package
by Brad.Walker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |