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;