in reply to Re^2: Error handling
in thread Error handling

That's completely useless to me, sorry. I cannot figure out from that why posts_for throws an error.

Replies are listed 'Best First'.
Re^4: Error handling
by smandape1 (Acolyte) on Jul 18, 2011 at 19:57 UTC

    Basically, I think its not something to deal with what posts_for retrieves. Its about how to skip this error. I don't know but if there is something that I can do to skip this error which stops my program. Something like eval{}! If anyone knows about this error kindly help me. That would be really great. Thank you.

      Assuming the text comes from an exception being thrown, eval { } will catch it.

        Well, thank you for your help. Another expert really helped me to solve this query without really knowing what is posts_for and all stuff. No offense, but I think stackoverflow is far better than and easy to handle. I posted the same question twice. I understand initially it was my mistake to put up the question as I am new to programing but the response I got here is not appreciable. Well, as perlmonks is to learn from others mistake as what I understood from the monks here. I would like to write that not only it matters if someone puts up the question in right way but it also matters how the person understands the easy question. Sometimes it may happen that the question is rather easy but the person makes it complicated and hard to understand for himself. For people who want to know the answer for my question, I have posted it down. I am all new to programing, I don't know how much this helps to rest of all, and so think each bit is important.

        while (<IN0>) { my $currentURI = $_; chomp($currentURI); my @tags = eval { # Use eval to make this safe, $@ will con +tain any error $c->posts_for(uri =>"$currentURI"); } my $error = $@; if (defined($error)) { warn($error); # If eval failed, warn and skip to next l +ine next; } if (! @tags) { next; # Assuming no tags means go to next line +in input } ... do something ... }