in reply to How do I reference methods?
All very kludgy, but you could do something like the following. Remember that the first parameter to an object method must be a reference to an object of the right type.
#!/usr/bin/perl -w use strict; package Thing; sub new { bless {}, shift; } sub say { print "@_[1 .. $#_]\n"; } package main; my $thing = Thing->new; $thing->say('Hello', 'World'); my $say = \&Thing::say; $say->($thing, 'Goodbye', 'All');
|
---|
In Section
Seekers of Perl Wisdom