in reply to Re^2: $obj->method v.s. $obj->method()
in thread $obj->method v.s. $obj->method()

$obj->method will work on 5.004 at least, and I think on all 5.xxx versions.

As I recall, this feature was broken in a specific version of perl, caused by a wrong commit I think. But I couldn't locate something related to that now with a little Googling.

$foobj->method qw(b a) ;
Ah, that's interesting :) Recent perl (5.10 & 5.8.8) parses that as:
C:\Users\burak>perl -MO=Deparse -e "$foobj->method qw(b a) ;" $foobj->method('b', 'a'); -e syntax OK [schultz]$ perl -MO=Deparse -e '$foobj->method qw(b a) ;' $foobj->method('b', 'a'); -e syntax OK [schultz]$
it looks like qw() has some magic in it in recent versions

Replies are listed 'Best First'.
Re^4: $obj->method v.s. $obj->method()
by Your Mother (Archbishop) on May 09, 2009 at 16:41 UTC

    IIRC it's $obj->$method that wouldn't work in 5.4 (and 5.6?) while $obj->$method() would.

      You're possibly right :)
        FWIW: In both versions 5.004_02 and 5.004_04 (from different builds) that I have:
        • $obj->method; (no arguments) and  $obj->method(@args); (with arguments) both work;
        • no non-parenthesized invocation with arguments (of those I have tried) works.
Re^4: $obj->method v.s. $obj->method()
by JavaFan (Canon) on May 09, 2009 at 18:38 UTC
    it looks like qw() has some magic in it in recent versions
    If you mean with "recent" any formal releases in years starting with '2', then yes.

    This has worked ever since 5.6.0 - which was the version that started doing qw at compile time, turning qw[foo bar] into ('foo', 'bar'). With parens. Probably most often seen in:

    foreach my $qw qw (qw qw) {print $qw}
      I meant 5.8+ actually. Haven't used 5.6 much. I usually test 5.5.4 compatibility from time to time for some of my code. But having this in 5.6 is interesting as it kind of enables some perl6 features very early like the foreach loop you wrote :)