Subject:Re: Exception Handling in perl
From: David Shere
To: "Sarsamkar, Paryushan"
Copies to: beginners@perl.org
Date sent: Fri, 27 Feb 2009 09:00:41 -0500
> On Fri, 2009-02-27 at 08:49 -0500, Davi
Exception Handling in perl
On Fri, 2009-02-27 at 08:49 -0500, David Shere wrote:
> You can also have it do more than one thing:
> copy ("C:\\build.xml","D:\\build.xml") or ( print "Cannot copy : $!"
and
> somethingElse() );
Or you can have more fun:
unless (c
On Fri, 2009-02-27 at 08:49 -0500, David Shere wrote:
> You can also have it do more than one thing:
> copy ("C:\\build.xml","D:\\build.xml") or ( print "Cannot copy : $!" and
> somethingElse() );
Or you can have more fun:
unless (copy ("C:\\build.xml","D:\\build.xml")) {
print "Cannot copy : $
On Fri, 2009-02-27 at 08:41 -0500, Sarsamkar, Paryushan wrote:
> copy ("C:\\build.xml","D:\\build.xml") or die "Cannot copy : $!";
simplest (?) solution:
copy ("C:\\build.xml","D:\\build.xml") or print "Cannot copy : $!";
You can also have it do more than one thing:
copy ("C:\\build.xml","D:\\bui
Hi All,
Can we handle exceptions in PERL programs?
For example - Here if it fails to copy then can I handle the exception
and perform the next steps in my script? I tried removing "die" but then
it does not complain and I wont be able to come to know if that is
copied or not. (Is there anyt
- Original Message
From: Pushkar Pande <[EMAIL PROTECTED]>
> How do we handle exceptions in perl?
If you want *proper* exception handling (exception objects, try/catch, stack
traces, etc), the don't use:
die $message;
return 0;
eval {}; # except with exception objects
$SIG{__DI
Pushkar Pande wrote:
How do we handle exceptions in perl?
perldoc -f eval
Example:
eval { some code };
if( $@ ){
# an exception occurred
}
--
Just my 0.0002 million dollars worth,
Shawn
"For the things we have to learn before we can do them, we learn by
doing them."
Aristotle
On Thu, 12 Jul 2007 16:06:27 +0530
"Pushkar Pande" <[EMAIL PROTECTED]> wrote:
> How do we handle exceptions in perl?
there is a Error.pm in CPAN, which allows you to write code like that
try {
something();
} catch Error with {
code();
}otherwise{
foobar();
};
--
To
How do we handle exceptions in perl?