in reply to Question re $obj->$action(@args) syntax
I don't think I understand your question. I tried this:
use strict; use warnings; use Data::Dumper; my $obj = bless {}, 'Foo'; my $action = sub { print Dumper( \@_ ) }; $obj->$action( 'hello' ); __END__ $VAR1 = [ bless( {}, 'Foo' ), 'hello' ];
...and that works. Are you saying you want to do something like "$obj->sub { do_stuff(); etc(); }( @args );" so that you don't need an explicit $action? It seems that you're basically doing something like:
{ @_ = ( $obj, @args ); # rest of 'sub' goes here }
"Inline" code doesn't need to be made into a sub. Am I misunderstanding your question?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Question re $obj->$action(@args) syntax
by blazar (Canon) on Mar 21, 2007 at 14:47 UTC | |
by kyle (Abbot) on Mar 21, 2007 at 15:07 UTC | |
by blazar (Canon) on Mar 21, 2007 at 16:40 UTC |