in reply to Re^2: Question re $obj->$action(@args) syntax
in thread Question re $obj->$action(@args) syntax

Are you saying that you would expect the following to work as (I) intended?

No, not at all. What I'm saying is that the code I wrote achieves the goal of removing the extra variable (i.e., there's no explicit $action code ref) while not achieving the goal of a "$obj->blah(@args)" style syntax. To be longer and more explicit:

use strict; use warnings; use Data::Dumper; my $obj = bless {}, 'Foo'; my @args = ( 'hello' ); { @_ = ( $obj, @args ); print Dumper( \@_ ) } __END__ $VAR1 = [ bless( {}, 'Foo' ), 'hello' ];

The functional difference between this and what you're shooting for is (in addition to the gross syntax difference) that this one is taking copies in @_ instead of aliases.

So, perhaps a better short version of what I'm saying is, "if all you want to do is eliminate a variable, do this..." Sorry for the confusion.

Replies are listed 'Best First'.
Re^4: Question re $obj->$action(@args) syntax
by blazar (Canon) on Mar 21, 2007 at 16:40 UTC
    No, not at all. What I'm saying is that the code I wrote achieves the goal of removing the extra variable (i.e., there's no explicit $action code ref) while not achieving the goal of a "$obj->blah(@args)" style syntax.

    Oh, but that I knew. My question was clearly focusing on syntax, not semantics. It was a question "out of curiosity" after all...

    So, perhaps a better short version of what I'm saying is, "if all you want to do is eliminate a variable, do this..." Sorry for the confusion.

    Not at all, it's an instructive discussion anyway, for someone who could stumble upon it, I guess...