Re: Invoking method by name found in variable

2017-05-23 Thread Salve J Nilsen

Patrick R. Michaud said:

On Tue, May 23, 2017 at 09:01:54PM +0300, Gabor Szabo wrote:


given an object $o and the name of a method in $method = "run"
how can I invoke the $o.run() ?

Something like $o.call($method)


At one point it was done as  $o."$method"() .


my $method = 'say';  123."$method"();

123


Is there a reasons for $o.call("method") not existing?


- Salve

--
#!/usr/bin/env perl
sub AUTOLOAD{$AUTOLOAD=~/.*::(\d+)/;seek(DATA,$1,0);print# Salve Joshua Nilsen
getc DATA}$"="'};&{'";@_=unpack("C*",unpack("u*",':50,$'.#
'3!=0"59,6!`%%P\0!1)46%!F.Q`%01,`'."\n"));eval "&{'@_'}";  __END__ is near! :)


Re: Invoking method by name found in variable

2017-05-23 Thread Patrick R. Michaud
On Tue, May 23, 2017 at 09:01:54PM +0300, Gabor Szabo wrote:
> given an object $o and the name of a method in $method = "run"
> how can I invoke the $o.run() ?
> 
> Something like $o.call($method)

At one point it was done as  $o."$method"() .

> my $method = 'say';  123."$method"();
123

Pm


Re: Invoking method by name found in variable

2017-05-23 Thread Elizabeth Mattijsen

> On 23 May 2017, at 20:01, Gabor Szabo  wrote:
> given an object $o and the name of a method in $method = "run"
> how can I invoke the $o.run() ?
> 
> Something like $o.call($method)

$o.”$method"()

$ 6 'my $method = "Str"; dd 42."$method"()'
“42"

Liz

Invoking method by name found in variable

2017-05-23 Thread Gabor Szabo
Hi,

given an object $o and the name of a method in $method = "run"
how can I invoke the $o.run() ?

Something like $o.call($method)

Gabor