in reply to RE: RE: RE: Re: Factory Pattern for Class Heirarchy
in thread Factory Pattern for Class Heirarchy
This is both overkill and inaccurate. A constructor does not have to be named new, so the die message is inaccurate. And it's going to die anyway if you can't find the method, so just use:if ($objectName->can('new')) { return $objectName->new(@_); # Pass in any remaining a +rgs } else { die "'$objectName' does not contain a constructor."; };
return $objectName->new(@_); # I hope they know how!
-- Randal L. Schwartz, Perl hacker
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: RE: RE: RE: Re: Factory Pattern for Class Heirarchy
by johannz (Hermit) on Oct 10, 2000 at 02:43 UTC |