Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: Perl Syntax - What's the difference?

by LanX (Saint)
on Apr 09, 2018 at 12:47 UTC ( [id://1212583]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Perl Syntax - What's the difference?
in thread Perl Syntax - What's the difference?

The OP said the only thing he changed where "underscore introduced in column names" , so consequently I expected some side effects in code he is executing behind the scene.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery

  • Comment on Re^3: Perl Syntax - What's the difference?

Replies are listed 'Best First'.
Re^4: Perl Syntax - What's the difference?
by Corion (Patriarch) on Apr 09, 2018 at 12:56 UTC

    At least given the above context of calling ->ymd as a method, I wonder what code would have worked before but now not work due to not having parentheses. To me this interpretation looks as if there is a case where:

    $myobject->ymd;

    stops working but

    $myobject->ymd();

    continues to work, or maybe:

    $myobject->ymd $foo;

    stops working but

    $myobject->ymd($foo);

    continues to work.

    At least in my trials, I can't get the version without parentheses to even compile:

    > perl -wle "$myobject = bless {}; $myobject->ymd $foo" Scalar found where operator expected at -e line 1, near "->ymd $foo"

    Of course, it could be use of indirect object syntax such that the method ymd was changed to parse differently, but that's also something that would be hard to elicit the stated error message from.

    I think most (if not all) cases when you get

    Can't locate object method "ymd" via package "123456"

    ... the cause is that you tried to treat an unblessed value like an object and the value was not a class name.

      Well

      1. The OP gave insufficient informations, that's why I guessed.

      2. It's obvious that I guessed because I said "probably"

      3. It's obvious that I was referring to indirect object syntax, since I gave an example.

      4. It's obvious that I didn't mean the code shown since I said "somewhere"*

      So in the end you were right and my theory was wrong.

      But what's the consequence of your reaction now?

      Shall I stop speculating when the OPs are not giving the full picture?

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Wikisyntax for the Monastery

      update

      * well I din't said somewhere , but it's obvious that i didn't mean the code shown.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1212583]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-24 12:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found