http://www.perlmonks.org?node_id=356420


in reply to Re: Re: OO Inheritence
in thread OO Inheritence

At least w/ undef, you can be more forgiving.

But it also requires that it be checked for. I think returning undef has its place, but so does throwing an exception (a.k.a. - croaking). I see the logic in allowing the user of your object/class/module to choose to die or not, after all, this...

my $o = Class->new(@arg) || die "cannot create new Class";
is a common enough idiom. But I can also see the logic in throwing an exception and just requiring the user to catch that exception. For me, it really comes down to how you plan to structure the error handling in the rest of your code.

-stvn