in reply to Re^2: Indirect Object Syntax
in thread Indirect Object Syntax
Is new not a keyword that Perl understands without any context other than a module name will follow?
Technically, one can use any valid sub name instead of new for the role of "create object" (i.e. blessing a hash with the module name), when writing an OOP module -- and can use sub new for some other function, confusing yes but it shows that name new is nothing special:
{ package MyObj; sub retro { bless { name => $_[1] }, $_[0] } sub string { join ', ', values %{ $_[0] } } } my $obj = MyObj->retro("aghag"); my $obj2 = retro MyObj("aaa"); # with the usual caveats
In Section
Seekers of Perl Wisdom