You can do things like pass the name of the func instead of a code ref
package Foo;
sub whee {
my $self = shift;
print "$self says Wheee!\n";
}
sub make_whee {
my ($instance, $func) = @_;
$instance->$func();
}
make_whee(Foo->new(), "whee");
You can also do things like pass in a ref to the class
method, and just pass in self.
$class_method_ref = \&Foo::whee;
&$class_method_ref($foo_ob);
But this will bite you badly later. The ISA tree for Foo
will NOT be walked if you call methods in this fashion.
Know the diference between these and you are all set.
$foo_ob->bar("himom");
Foo::bar($foo_ob, "himom");
Foo->bar("himom");