in reply to Re: How called was &I?
in thread How called was &I?

method $obj $arg; is not an error.
"Classname"->method( $arg); method "Classname" $arg; method( "Classname", $arg);
The first two act just like the last one.

Not so. Consider:

#!/usr/bin/perl -w use strict; package Base; sub base { print "Base::base called\n"; } package Derived; use vars qw( @ISA); @ISA = ( "Base"); package main; Derived::base Derived "hello"; Derived::base( Derived,"hello"); # undefined Derived::base "Derived" "hello"; # syntax error

Replies are listed 'Best First'.
Re: Re: Re: How called was &I?
by sauoq (Abbot) on Sep 16, 2002 at 02:22 UTC
    method $obj $arg;is not an error.

    You are right. It isn't. I don't know what I was thinking.

    Before going on, I should clarify my point. Once a method is called, there is no way to determine the syntax used to invoke it. Your addition of a Derived class does nothing to show otherwise.

    That said, I made a couple of poor assumptions. One was that "Classname" in the original wasn't really meant to be a quoted string but a bareword. I also assumed that method would be the appropriate name for the method regardless of context. There really was no good reason to assume either and I should have requested clarification.

    # Actual original post # What I assumed the OP meant "Classname"->method( $arg); # Class->method($arg); method "Classname" $arg; # method Class $arg; method( "Classname", $arg); # Class::method(Class, $arg);

    Mistakes, assumptions, and mistaken assumptions aside, if I understand the original post, the answer is still "No."

    -sauoq
    "My two cents aren't worth a dime.";