in reply to Overriding constructor

my $class = ref($invocant) || $invocant;
In addition to the other comments in this thread, also see my "ref($proto) - just say no!", expanded in the last few paragraphs of my column on constructors which eventually caused the ugly parts of perltoot to be corrected in recent perl distributions.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re^2: Overriding constructor
by xdg (Monsignor) on Aug 12, 2005 at 15:59 UTC

    It's cleaned up in parts, but still scattered about in perlobj, and the way bottom part of perlmodlib, though at least those present it as an option, not as dogma. perltooc gets into it, too, but at least there's broader context about calling things as class methods versus object methods.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.