in reply to Bareword Package Names
I'm not sure how documented the behaviour you describe is, but the trailing double colons have another use. Consider the following:
use 5.010; { package Foo; sub new { bless [] } sub Bar { 'Quux' } } { package Foo::Bar; sub new { bless [] } } { package Quux; sub new { bless [] } } my $object1 = Foo::Bar::->new; say ref $object1; # says "Foo::Bar" my $object2 = Foo::Bar->new; say ref $object2; # says "Quux"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Bareword Package Names
by martin (Friar) on Aug 08, 2012 at 16:16 UTC | |
by jmlynesjr (Deacon) on Aug 10, 2012 at 03:03 UTC |