470,850 Members | 1,302 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,850 developers. It's quick & easy.

Trapping errors ...

I am a bit new to Perl and am having trouble trapping errors in script ...

However, I think that it is just simple syntax issues and hope that someone can point me towards a good HOWTO which might help me ...

I have a simple system call to a program (SQLPLUS) which works fine. And when I try to induce an error (for example by misspelling sqlplusw), perl recognises the problem and brings a message but doesn't seem to react to my attempts to trap the error.

Here I have tried both 'die' and 'warn' but it doesn't seem to make any difference. I have also tried to print STDERR but also can't seem to do this.

Here is a snippet of my code ...

system("sqlplusw\ \/nolog\ \@myscript.sql") || warn("SQLPlus not found");
print "error: ", <STDERR>, "\n";

As you can see, I am a real newbie but am sure if someone could give me a tip or two or could point me towards a good tutorial, then I would sort it out very quickly.

Many thanks,
Alan Searle.
Jan 17 '07 #1
1 1427
1,089 Expert 1GB
Your best source of information will always be perldoc. I would suggest that you read up on the documentation for the system command to see the ways that they trap errors. Currently your "sleep" command is not serving any purpose at all, so i would suggest that you remove it. It might be possible that you really want an "alarm", but you can look that function up:


When it comes to modules, I always look in perldoc first, and secondarily on cpan:

Jan 18 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Eitan | last post: by
13 posts views Thread by Thelma Lubkin | last post: by
2 posts views Thread by Fred Nelson | last post: by
2 posts views Thread by Captain Nemo | last post: by
9 posts views Thread by 47computers | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.