Next Tricks of the Wizards 41

Stash Walking

          my @functions = @_ ? @_ : all_functions($caller);
        sub all_functions {
          my $p = shift;
          my $h = \%{$p . "::"};
          my @result;
          while (my ($name, $glob) = each %$h) {
            if (defined &$glob) { 
              push @result, $name;
            }
          }
          @result;
        }


Next Copyright © 2003 M. J. Dominus