I recently ran up against the same problem. Unfortunately, I couldn't find any easy way to to solve the problem, so I've been using Sub::Mutate. It's basically for examination and modification of subroutines. Try this script to get started. I left out the mutation methods. You can add them when you think that you're ready.

#!/usr/bin/perl use strict; use warnings; use Sub::Mutate qw( sub_body_type sub_closure_role sub_is_lvalue sub_is_constant sub_is_method sub_is_debuggable sub_prototype ); my $sub = \&finddeps; my $type_body = sub_body_type($sub); my $type_closure = sub_closure_role($sub); my $type_is_lvalue = sub_is_lvalue($sub); my $type_is_constant = sub_is_constant($sub); my $type_is_method = sub_is_method($sub); my $type_is_debuggable = sub_is_debuggable($sub); my $type_prototype = sub_prototype($sub); print "$type_body, $type_closure, $type_is_lvalue, $type_is_constant, $type_is_debuggable, $type_prototype\n"; sub finddeps { use CPAN::FindDependencies; my @dependencies = CPAN::FindDependencies::finddeps(); foreach my $dep (@dependencies) { print ' ' x $dep->depth(); print $dep->name().' ('.$dep->distribution().")\n"; } }

In reply to Re: Checking more than just the current namespace for sub and var definitions by Khen1950fx
in thread Checking more than just the current namespace for sub and var definitions by willjones

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.