opensourcer has asked for the wisdom of the Perl Monks concerning the following question:
package Test; use strict; sub new { my ($caller, @args) = @_; return bless {}, $caller || ref($caller); } sub test1 { print "Worked from 1\n"; } sub test2 { print "Worked from 2\n"; } package main; use Test; my $tes = new Test; my $rf = { test1 => 'test1', test2 => 'test2', }; no strict 'refs'; no strict 'subs'; $tes->$rf->{test1}();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: calling subs using references.
by johngg (Canon) on May 22, 2007 at 10:27 UTC | |
|
Re: calling subs using references.
by jettero (Monsignor) on May 22, 2007 at 10:37 UTC | |
|
Re: calling subs using references.
by shmem (Chancellor) on May 22, 2007 at 10:39 UTC | |
by blazar (Canon) on May 22, 2007 at 12:05 UTC | |
|
Re: calling subs using references.
by rhesa (Vicar) on May 22, 2007 at 10:34 UTC | |
|
Re: calling subs using references.
by rinceWind (Monsignor) on May 22, 2007 at 14:46 UTC | |
|
Re: calling subs using references.
by naikonta (Curate) on May 22, 2007 at 13:43 UTC |