>>>>> "FH" == Feng He <short...@gmail.com> writes:
FH> You will always be able to check the return status of a method call, FH> something like: FH> my $obj = Some::Module->new FH> or die "can't create object from Some::Module"; please learn to bottom post. i now have to comment on your answer and also the OP's but it is ordered incorrectly. so your answer doesn't help the OP. his error is coming from perl after he thinks he has an object. maybe it is coming from somewhere else and he can't check the constructor or maybe the object was created but got lost in scope or something. FH> On Sat, Aug 13, 2011 at 7:58 AM, Jeffrey Joh <johjeff...@hotmail.com> wrote: >> >> I'd like to include code so that if I get the following error, the script will just ignore it and keep running: >> >> "Can't call method "attr" on an undefined value at abcde.pl line 2" first off, you shouldn't be calling a method unless you know you have an object. as i commented above you should see why this is happening and fix it there. this can be handled but that isn't solving the real problem. you don't have an object where you (and perl) think you should. if this is actually the important problem, then you can wrap the method call in an eval block (not eval string) and that will trap the error and you can continue. but you should really fix the problem of not having an object. uri -- Uri Guttman -- uri AT perlhunter DOT com --- http://www.perlhunter.com -- ------------ Perl Developer Recruiting and Placement Services ------------- ----- Perl Code Review, Architecture, Development, Training, Support ------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/