in reply to Re^2: Foo->new() vs. new Foo()
in thread Foo->new() vs. new Foo()

To allow the caller to use the Foo::new() syntax, the sub could be coded thus:
sub new { my $class = shift @_ || __PACKAGE__; ... }
This gives the same result as calling using the Foo->new syntax.

     "Man cannot live by bread alone...
         He'd better have some goat cheese and wine to go with it!"

Replies are listed 'Best First'.
Re^4: Foo->new() vs. new Foo()
by chromatic (Archbishop) on Oct 24, 2005 at 21:41 UTC

    Aside from breaking inheritance, why would you want to do that?

Re^4: Foo->new() vs. new Foo()
by BUU (Prior) on Oct 25, 2005 at 05:00 UTC
    Sub::new(1);