When writing objects I usually set an global variable $ERROR upon failure and return undef. $ERROR is then made available via an a method. This way I can have the script decide if it can live with that. An example code in the script could be the following, which is what I normally do.
my $mod = Module->new () or die Module->error (); my $foo = $mod->method () or warn $mod->error ();
Remains the question: Is more arguments than expected an error? Well, I usually ignore unneccessary arguments, but this too depends on the context. Another way I'm using (especially in constructor methods) is passing hashes and then check for existing keys. So in general I'd say it depends on the context, but I wouldn't let an object kill the entire program.
Regards,
-octo
In reply to Re: What Are The Rules For Subs And Modules When Fed Wrong Input
by flocto
in thread What Are The Rules For Subs And Modules When Fed Wrong Input
by Cody Pendant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |