Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Display error message if an error occurs on "open" command

Reply
Thread Tools

Display error message if an error occurs on "open" command

 
 
Geek
Guest
Posts: n/a
 
      12-02-2003
How can I get the following code to display a meaningful error message if
the "open" command doesn't succeeed?

$blatString = "\|C:\WINNT\SYSTEM32\blat.exe
\"d:\temp\message_body.txt\" -t \"(E-Mail Removed)\" -s \"This is a
test\" -f \"(E-Mail Removed)\" -i \"Web Server\" -server mail.nowhere.com
> d:\temp\~blatoutput.txt";


open (MAIL2, $blatString));

I'd like something that displays the actual error encountered, not just
something like this:

$blatString = "\|C:\WINNT\SYSTEM32\blat.exe
\"d:\temp\message_body.txt\" -t \"(E-Mail Removed)\" -s \"This is a
test\" -f \"(E-Mail Removed)\" -i \"Web Server\" -server mail.nowhere.com
> d:\temp\~blatoutput.txt";


unless (open (MAIL2, $blatString)) {
print "<p>Can't execute Blat</p>";
$BlatError = 1;
}


 
Reply With Quote
 
 
 
 
Tore Aursand
Guest
Posts: n/a
 
      12-02-2003
On Mon, 01 Dec 2003 18:41:51 -0800, Geek wrote:
> open (MAIL2, $blatString));
>
> I'd like something that displays the actual error encountered, [...]


Use the $! operator.


--
Tore Aursand <(E-Mail Removed)>
"To cease smoking is the easiset thing I ever did. I ought to know,
I've done it a thousand times." -- Mark Twain
 
Reply With Quote
 
 
 
 
David H. Adler
Guest
Posts: n/a
 
      12-02-2003
In article <(E-Mail Removed)>, Tore Aursand wrote:
> On Mon, 01 Dec 2003 18:41:51 -0800, Geek wrote:
>> open (MAIL2, $blatString));
>>
>> I'd like something that displays the actual error encountered, [...]

>
> Use the $! operator.


s/operator/variable/;

dha

--
David H. Adler - <(E-Mail Removed)> - http://www.panix.com/~dha/
DHA is the "Smorax", he is friends with the Twinkies and speaks for
the Choc-O-Diles. - Mark Rogaski
 
Reply With Quote
 
Geek
Guest
Posts: n/a
 
      12-02-2003
Thanks to you and David.

"Tore Aursand" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> On Mon, 01 Dec 2003 18:41:51 -0800, Geek wrote:
> > open (MAIL2, $blatString));
> >
> > I'd like something that displays the actual error encountered, [...]

>
> Use the $! operator.
>
>
> --
> Tore Aursand <(E-Mail Removed)>
> "To cease smoking is the easiset thing I ever did. I ought to know,
> I've done it a thousand times." -- Mark Twain



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can display the sql before the error occurs? Big Moxy ASP General 14 11-30-2007 01:18 PM
Validators - error message not showing when JS disabled & only server side validation occurs TS ASP .Net Web Controls 2 06-20-2006 10:00 AM
what is the meaning of the Warning message,why it occurs? nick C Programming 3 10-12-2005 06:11 PM
Can you intercept the url request before a 404 error occurs? =?Utf-8?B?UlVTU0VMTCBNQ0dJTk5JUw==?= ASP .Net 1 07-14-2004 02:45 PM
Get debugging to stop on line executing when error occurs Lloyd Sheen ASP .Net 3 03-07-2004 05:30 PM



Advertisments