On Mon, 14 Mar 2005 11:57:42 -0500, Michael Peters
<mpeters@xxxxxxxxxxxxx> wrote:
> If you specified the values as code refs, then you would have to do something
> more than what I was telling you. If you didn't use code ref's, but just
> the names of the methods as the values, then the following should work
Actually, it works with both code refs and plain strings, perl will
'Do the right thing' in both cases. See the following quick test:
#!perl
package Foo;
use base qw(Class::Accessor);
Foo->mk_accessors(qw(test));
my $foo = Foo->new;
$foo->test(5);
my $test_string = 'test';
my $test_ref = \&Foo::test;
print ($foo->$test_string() eq 5 ? "OK string\n" : "NOT OK string\n");
print ($foo->$test_ref() eq 5 ? "OK ref\n" : "NOT OK ref\n");
1;
Cheers,
Cees
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/cgiapp@xxxxxxxxxxxxxxxxx/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: cgiapp-unsubscribe@xxxxxxxxxxxxxxxxx
For additional commands, e-mail: cgiapp-help@xxxxxxxxxxxxxxxxx
|