[Pdx-pm] Changing contructors w/o breaking compat.
Joshua Hoblitt
jhoblitt at ifa.hawaii.edu
Sat Oct 26 15:59:44 CDT 2002
> Err.. Randal's solution supports both forms of the syntax.
It supports two different syntaxs but the hash style form is different then what I would intuitively expect.
I see this alot - so much that I'm calling it the conventional OO constructor sytax for perl.
$sock = IO::Socket::INET->new(PeerAddr => 'www.perl.org',
PeerPort => 'http(80)',
Proto => 'tcp');
Turning the params into a hash ref will certainly work but IMHO if it wasn't my class it would be confusing. I did like the idea of havingto double check the docs for every class constructor it see if I need to add {}'s.
$sock = IO::Socket::INET->new({PeerAddr => 'www.perl.org',
PeerPort => 'http(80)',
Proto => 'tcp'});
> Btw, never seen the %{+shift} syntax before. Is that a new thing,
> a sneaky trick, or have I been living under a rock?
I most have missed a message because I never saw where this was mentioned. Maybe it's because I have the flu. :)
-J
More information about the Pdx-pm-list
mailing list