472,993 Members | 2,566 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,993 software developers and data experts.

Trapping errors ...

39
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");
sleep(2);
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 1488
miller
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:

http://perldoc.perl.org/functions/system.html

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

http://cpan.perl.org/
Jan 18 '07 #2

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

Similar topics

6
by: Eitan | last post by:
Hello, I need an example of "Trapping Errors" in ASP (not .net) Thanks :)
3
by: JP | last post by:
I need to be able to trap errors at the application level. I added this code to the Global.asax file. The code I wrote is supposed to get the last error that was generated and write to the event...
3
by: Nathan Bloomfield | last post by:
Hi there, I am having difficulty with a piece of code which would work wonders for my application if only the error trapping worked properly. Basically, it works as follows: - adds records...
21
by: Neil | last post by:
Is there a way to trap an error generated in another app that is controlled via automation? I have an Access 2000 app that opens Word 2000 and proceeds to open a series of documents and, in each...
3
by: windandwaves | last post by:
Hi Gurus Does anyone know how I set the error trapping to option 2 in visual basic. I know that you can go to tools, options and then choose on unhandled errors only, but is there a VB command...
13
by: Thelma Lubkin | last post by:
I use code extensively; I probably overuse it. But I've been using error trapping very sparingly, and now I've been trapped by that. A form that works for me on the system I'm using, apparently...
2
by: Fred Nelson | last post by:
I'm devloping a VB.NET web application and I'm having a problem with trapping errors and logging the cause of them. When an unexpected error occurs I want to write it to a file - or e-mail it to...
2
by: Captain Nemo | last post by:
I'm still using Office 2000 myself, but some of my clients have Office 2003. I've recently added a piece of code to create an instance of Word, open a document, fill in the blanks and become...
9
by: 47computers | last post by:
Pretty new to PHP, I recently started learning about error trapping. As of right now, I include the following into a page in my website: -------BEGIN PASTE-------- error_reporting(E_ERROR |...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.