Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Answer: How do I reference methods?

by davorg (Chancellor)
on Mar 07, 2001 at 17:07 UTC ( #62739=categorized answer: print w/replies, xml ) Need Help??

Q&A > object-oriented programming > How do I reference methods? - Answer contributed by davorg

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');

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
thezip switches the jolokia powder with Folgers Crystals...
[Michael W]: So i can read ok from this how do i put data back inmy @Variables = ( $Map_Request_Date, $Map_Due_Date,$Map _Cutover_Date,$Map _Complete_Date,$Ma p_Approved_Date);

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2017-04-27 15:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (509 votes). Check out past polls.