in reply to Conventions with Passing Objects to Objects
This note is about some bad syntax on your part. I see you're using the new Some::Object syntax. That's bad. Don't. This syntax is really fragile and can cause your program to be parsed very differently depending on compilation order and whether you're writing an OO module yourself. If you switch to the Some::Object->new( ... ) syntax, it will always be unambiguous and the right thing will happen in all cases.
The following snippet highlights the most common case that will go completely wrong.
package Foo; sub new { ... } sub bar { ... = new Some::Object( ... ); # You meant # ... = Some::Object->new( ... ); # but you got # ... = Foo::new( "Some::Object", ... ) }
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Conventions with Passing Objects to Objects
by zxViperxz (Acolyte) on Jan 13, 2006 at 20:59 UTC | |
by diotalevi (Canon) on Jan 16, 2006 at 15:24 UTC |