in reply to running unknown methods

Try as I might, but I can't figure out why you want to do this. Rather than guess, I'll just provide you with a working example that should point you on the right path.

#!/usr/bin/perl -w use strict; package Foo; sub new { bless { _this => "this\n", _that => "that\n" }, shift } sub _this { print $_[0]->{_this} } sub _that { print $_[0]->{_that} } package main; my $thing = Foo->new; runTests( $thing ); sub runTests { my $object = shift; my $pkg = ref $object; no strict 'refs'; foreach my $symname (keys %{"${pkg}::"}) { my $sub = "${pkg}::$symname"; if ( defined &$sub and '_' eq substr $symname, 0, 1 ) { $sub->( $object ); # explicitly pass $object to mimic meth +od call } } }

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.