Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Re: Re: CPAN Module Proposal: Business::Ship

by diotalevi (Canon)
on Jun 02, 2003 at 01:01 UTC ( #262276=note: print w/replies, xml ) Need Help??


in reply to Re: Re: CPAN Module Proposal: Business::Ship
in thread CPAN Module Proposal: Business::Ship

I'm following up from sauoq's note on the indirect object syntax because zie didn't provide the fixed syntax (and that's all this is - syntax).

$obj = Class->new;

versus

$obj = new Class;

You can get yourself into hot water by using the second form as its ambiguous - the first is unambiguous and works all the time.

Replies are listed 'Best First'.
Re(4): CPAN Module Proposal: Business::Ship
by Dog and Pony (Priest) on Jun 02, 2003 at 09:52 UTC
    the first is unambiguous and works all the time.

    Just to be the mega-pain, I do seem to recall that it isn't 100% unambiguous - it could mean $obj = Class()->new().

    The way to be certain I think was to use either new Class:: or Class::->new (ugly, ain't it?).

    Nope, I don't ever see it written like that either, and maybe that is how it used to be - I didn't whip up a test script since I'm too lazy. Just felt like being a bit obstinate before my coffee. ;-)


    You have moved into a dark place.
    It is pitch black. You are likely to be eaten by a grue.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2022-09-28 06:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (124 votes). Check out past polls.

    Notices?