in reply to Checking more than just the current namespace for sub and var definitions

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"; } }
  • Comment on Re: Checking more than just the current namespace for sub and var definitions
  • Download Code