#/usr/bin/perl use strict; use inherited; use Data::Dumper; my $inherited = inherited->new(); print Dumper $inherited->{'provides'}; #### package parent; sub new { my $class = shift; $class = ref($class) || $class; my $self = {}; $self->{'provides'} = mk_provides($class); bless($self, $class); return $self; } sub mk_provides { my $class = shift; # these are all the internal ones I've seen so far my %internal = map { $_ => 1 } qw (import isa ISA new BEGIN END); $class .= "::"; local *stash; # here's the part that makes strict scream *stash = *{$class}; my @methods; foreach (keys %{*stash} ) { # if it's not an internal one or one that starts with _ # add it to the list of public methods unless (defined $internal{$_} || $_ =~ /^_/) { push(@methods,$_); } } return \@methods; } 1; #### package inherited; use strict; use base ("parent"); sub foo { } sub bar { } sub baz { } sub _private_method() { } 1; #### $VAR1 = [ 'bar', 'foo', 'baz' ];