http://qs321.pair.com?node_id=62737

Faidros has asked for the wisdom of the Perl Monks concerning the following question: (object-oriented programming)

With a normal sub I can do this:
$ref = \&MyFunc;
..which will make $ref a reference to the sub MyFunc. But how do I do it if MyFunc is a method in the $self object? I want to make a reference to $self->MyFunc so $self is passed when I call it, but neither
$ref = \&$self->MyFunc;
nor
$ref = \$self->MyFunc;
seems to work. Perl says "Undefined subroutine" for the first, and "not a CODE reference" for the second. So, question is, how do I reference a method so the object is sent when I call the reference, or is there a workaround for the problem?

Originally posted as a Categorized Question.