to the Perl/CGI script
> that runs all of this. Is there some way I should be wrapping calls
> to the shared lib in something like an eval BLOCK, so I can croak a
> message back to the web page?
>
perldoc -q exception turned up a result from perlfaq8 just so you know the
tools for exc
I have a Perl module that calls a function from in a Swig generated
module, which in turn calls a function in a shared library. It's been a
while since I put it all together and made it work, so I'm kind of hazy
on the technical details - and since it mostly works I never need to
look at it.
o God.
---
From: Andy Bach
To: Shaji Kalidasan
Sent: Friday, 4 October 2013 10:23 PM
Subject: Re: Help on exception handling (Try::Tiny)
On Fri, Oct 4, 2013 at 5:36 AM, Shaji Kali
d then executes the 'next' statement.
> After executing the next statement the control flow has to skip the following
> statement
>
> say "The sum of (@total) is $sum\n";
>
> In otherwords, I want to ignore the say statement in case if an exception is
> rai
the control flow has to skip the following
statement
say "The sum of (@total) is $sum\n";
In otherwords, I want to ignore the say statement in case if an exception is
raised. (In the output of the given program, it is printing the total)
There was an error
The sum of (1024 2048 512 0)
;execute();
> > while ( @row = $sth->fetchrow_array ) {
> > push(@dspu, "@row\.dat");
> > }
>
> This code is really bad:
>
> 1. It lacks "use strict;" and "use warnings;".
>
> 2. It doesn't throw an exception when "$dbh&q
ld hash from key-value pairs so $hash{$id} =>
> name
> $sth = $dbh->prepare("SELECT DISTINCT spuid FROM inven WHERE
> dispatchdate<>\"-00-00\" and dupli is NULL LIMIT 0, 1000");
> $sth->execute();
> while ( @row = $sth->fetchrow_array ) {
>
E
dispatchdate<>\"-00-00\" and dupli is NULL LIMIT 0, 1000");
$sth->execute();
while ( @row = $sth->fetchrow_array ) {
push(@dspu, "@row\.dat");
}
The above code which uses mysqlPP module is giving our of memory exception
and not getting executed.
Where a
t;
> if ($day < 15)
>
> {
>
> $failtag = "TestcaseDiff";
>
> }
>
> BEGIN {
>
> my %month_num = do {
>
> my $n = 0;
>
> map(($_, $n++), qw/jan feb mar apr may jun jul aug sep oct nov dec/);
>
> };
>
> sub epoch_days {
>
it /-/, shift;
$dmy[1] = $month_num{lc $dmy[1]} || 0;
return timelocal(0, 0, 0, @dmy) / (24 * 60 * 60);
}
}
}
When I execute the program I am getting below exception error.
Line 405 in the program points to
"return timelocal(0, 0, 0, @dmy) / (24 * 60 * 60);"
Am I missing anything in
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
Thanks...
My bad... I did not realize to use print instead of just "die"ing :)
Thanks,
Paryushan
-Original Message-
From: David Shere [mailto:dsh...@steelerubber.com]
Sent: Friday, February 27, 2009 7:31 PM
To: Sarsamkar, Paryushan
Cc: beginners@perl.org
Subject: Re:
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.
- 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
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."
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?
On 1/23/06, Jimmy <[EMAIL PROTECTED]> wrote:
> is there anyway I'll run normal_header() without specific argument,
> but don't run it if I pass whatever argument on the 'use' statement ?
I believe you're asking how a module can determine how it was 'use'd,
so as to provide default behavior when n
, January 23, 2006 8:17 PM
Subject: Want to add exception for a auto run sub in module
Hi all,
I have a module somewhat looks like this :
package minicgi;
require Exporter; our @ISA = qw/Exporter/;
our @EXPORT = qw/NormalHeader OtherHeader/;
sub NornalHeader { print "Content-Type
Hi all,
I have a module somewhat looks like this :
package minicgi;
require Exporter; our @ISA = qw/Exporter/;
our @EXPORT = qw/NormalHeader OtherHeader/;
sub NornalHeader { print "Content-Type:text/html\n\n" } # normal html
sub OtherHeader { print "Content-Type:$_[0]\r\n\r\n" } # per
> Either way I can't figure out how to raise an exception in the insert_row
> subroutine so that the parsefile() will die as well. Since I am working with
> records totalling several gigabytes, I am checking every SQL operation by
> evaling them with RaiseError turned on. This doe
.
Either way I can't figure out how to raise an exception in the insert_row
subroutine so that the parsefile() will die as well. Since I am working with
records totalling several gigabytes, I am checking every SQL operation by
evaling them with RaiseError turned on. This doesn't help me muc
On 08 Jun 2004, you wrote in perl.beginners:
> Greetings,
>
> For you professional Perl programmers: how do you approach
> exception-handling in the your world? I know there are a lot of ways
> Perl gives us to do this: basic 'die', eval'ing blocks of code and th
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Randal L. Schwartz) writes:
>> "Drieux" == Drieux <[EMAIL PROTECTED]> writes:
>
>Drieux>if ( ref($got_back) eq "Foo::Bar")
>
>No no no. Stop using ref(). It means you can't replace it
>with a subclass of it.
>
>You want (and I show
still-hidden article);
if (UNIVERSAL::isa($got_back, "Foo::Bar")) { ... }
On Jun 9, 2004, at 10:14 AM, Wiggins d Anconia wrote:
[..]
Example 2: Subroutine that returns a value or an exception on failure,
must check type of return value
my $value = $obj->function_that_retur
>
> On Jun 8, 2004, at 11:34 AM, Scott Stearns wrote:
> [..]
> > For you professional Perl programmers: how do you approach
> > exception-handling in the your world? I know there are a lot of ways
> > Perl
> > gives us to do this: basic 'die', eval&
> "Drieux" == Drieux <[EMAIL PROTECTED]> writes:
Drieux> if ( ref($got_back) eq "Foo::Bar")
No no no. Stop using ref(). It means you can't replace it
with a subclass of it.
You want (and I show in my still-hidden article);
if (UNIVERSAL::isa($got_back, "Foo::Bar")) { ...
On Jun 8, 2004, at 11:34 AM, Scott Stearns wrote:
[..]
For you professional Perl programmers: how do you approach
exception-handling in the your world? I know there are a lot of ways
Perl
gives us to do this: basic 'die', eval'ing blocks of code and the
Exception.pm module but is t
>>>>> "Scott" == Scott Stearns <[EMAIL PROTECTED]> writes:
Scott> For you professional Perl programmers: how do you approach
Scott> exception-handling in the your world? I know there are a lot of
Scott> ways Perl gives us to do this: basic '
> Greetings,
>
> For you professional Perl programmers: how do you approach
> exception-handling in the your world? I know there are a lot of ways Perl
> gives us to do this: basic 'die', eval'ing blocks of code and the
> Exception.pm module but is there a standa
Greetings,
For you professional Perl programmers: how do you approach
exception-handling in the your world? I know there are a lot of ways Perl
gives us to do this: basic 'die', eval'ing blocks of code and the
Exception.pm module but is there a standard in the real world for hand
Randy W. Sims wrote:
On 4/26/2004 1:02 PM, David Garamond wrote:
I've [re]discovered the wonderful world of Carp. I've now peppered
most of my scripts with 'use Carp qw(verbose);'.
However, whenever things go wrong (like my program calls an undefined
subroutine, or I tried to modify a constant)
On 4/26/2004 1:02 PM, David Garamond wrote:
I've [re]discovered the wonderful world of Carp. I've now peppered most
of my scripts with 'use Carp qw(verbose);'.
However, whenever things go wrong (like my program calls an undefined
subroutine, or I tried to modify a constant), my program dies wit
I've [re]discovered the wonderful world of Carp. I've now peppered most
of my scripts with 'use Carp qw(verbose);'.
However, whenever things go wrong (like my program calls an undefined
subroutine, or I tried to modify a constant), my program dies without
the stack backtrace. Any idea how I can
From: "Randy W. Sims" <[EMAIL PROTECTED]>
> On 2/12/2004 9:56 PM, Hari Fajri wrote:
>
> > Do perl have handling error (exception) mechanism?
> >
> > for example: java use : try{...} catch{...}
>
> perl has pretty poor build-in exception handling
On 2/12/2004 9:56 PM, Hari Fajri wrote:
Do perl have handling error (exception) mechanism?
for example: java use : try{...} catch{...}
perl has pretty poor build-in exception handling which consists of
executing some code in an eval{...} block and then check $@ to see if an
error occured
Do perl have handling error (exception) mechanism?
for example: java use : try{...} catch{...}
Thanks
If java style exceptions are what is needed, then try:
http://search.cpan.org/author/PJORDAN/Exception-1.4/Exception.pm
http://search.cpan.org/author/IX/libservlet-0.9.2/lib/Servlet/ServletException.pm
simran.
On Fri, 2003-02-14 at 14:56, R. Joseph Newton wrote:
> "Shaw, Steve
"Shaw, Steven" wrote:
> Hi, I'm looking for tutorials/sample-code/book-recommendations for learning about
>exceptions, exception objects and their effective use.
>
> Cheers,
> Steve.
Hi Steve,
You may be in the wrong neck of the woods for that purpose. Although
Steven Shaw wrote:
> Hi, I'm looking for tutorials/sample-code/book-recommendations for
> learning about exceptions, exception objects and their effective use.
>
> Cheers,
> Steve.
you can do simply error handling with evel,$@ and the sort. if you build
your error classe
On Tue, 11 Feb 2003 18:32:43 -0600, "Shaw, Steven" <[EMAIL PROTECTED]> wrote:
> Hi, I'm looking for tutorials/sample-code/book-recommendations for learning about
>exceptions, exception objects and their effective use.
Hi, I'm looking for tutorials/sample-code/book-recommendations for learning about
exceptions, exception objects and their effective use.
Cheers,
Steve.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
From: "Paul Johnson" <[EMAIL PROTECTED]>
> walter valenti said:
>
> > How is possible launch an exception in perl ???
>
> die !!!
Are you gonna slay him Paul? ;-)
perldoc -f die
perldoc -f eval
> > --
> > God hates us all
>
walter valenti said:
> How is possible launch an exception in perl ???
die !!!
> Thanks
You're welcome.
> --
> God hates us all
Unlikely, I think.
--
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional
How is possible launch an exception in perl ???
Thanks
--
God hates us all
Per favore non mandatemi allegati in Word o PowerPoint.
Si veda http://www.fsf.org/philosophy/no-word-attachments.html
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
AIL PROTECTED]]
Sent: Tuesday, July 09, 2002 10:20 AM
To: Jaime Hourihane
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: Regex exception
On Jul 9, Jaime Hourihane said:
>opendir(DIR, $dir) || die ..
>while() {
You can't use <> on dirhandles.
>unless ~= $
On Jul 9, Jaime Hourihane said:
>opendir(DIR, $dir) || die ..
>while() {
You can't use <> on dirhandles.
>unless ~= $pattern {
> unlink or remove here
>}
And at least try to post well-formed pseudocode.
>}
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
or what about unless...
opendir(DIR, $dir) || die ..
while() {
unless ~= $pattern {
unlink or remove here
}
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
day, July 09, 2002 9:58 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: Regex exception
>
>
> or what about unless...
>
> opendir(DIR, $dir) || die ..
&g
why not use foreach() glob() and unlink() instead so it's all done in perl?
foreach $file (glob("e:/dir/*.ldb")){
next if $file =~ /exception pattern here/;
unlink($file) or die "Cannot unlink $file: $!\n";
}
> -Original Message-
> From
HI all.
A simple question.
I need to use a system command to delete all files in a directory except
one.
Foobar.ldb
Barfoo.ldb
Raboof.ldb
Keep.ldb
I want to delete all except the keep.ldb and there could be various other
files.
I am trying to use this command
Any help???
System("erase /f e:
utputs to /dev/null
is that what you wanted?
/Jon
Alex Harris wrote:
>
> The program I'm writing is going to run under a cron job. Therefore its
> important that I catch all exceptions in a file and not have them return to
> the command line.
>
> For instance the following:
The program I'm writing is going to run under a cron job. Therefore its
important that I catch all exceptions in a file and not have them return to
the command line.
For instance the following:
(system("ls *.r > $plantfile")
raises this exception at times:
ls: 0653-341
On Sat, Apr 28, 2001 at 11:27:58AM +0530, Joel Divekar wrote:
> Hi
>
> At 12:16 PM 4/27/2001 -0400, David H. Adler wrote:
> >
> >Given that there *is* no perl6 (yet), I'm guessing you don't really mean
> >that, right?
>
> Yes I was also surprised about Perl 6, is it out yet ?
Nope, and won't be
Hi
At 12:16 PM 4/27/2001 -0400, David H. Adler wrote:
>On Thu, Apr 26, 2001 at 06:43:37PM -0500, Arante, Susan wrote:
> > This used to be working but after my very adventurous fiasco (deleting
> > perl5, installing perl6, deleting perl6, installing perl5 - yes i deleted
> > not uninstalled), it's
On Fri, Apr 27, 2001 at 09:25:33AM -0700, Paul wrote:
>
> --- "David H. Adler" <[EMAIL PROTECTED]> wrote:
> > On Thu, Apr 26, 2001 at 06:43:37PM -0500, Arante, Susan wrote:
> > > This used to be working but after my very adventurous fiasco
> > > (deleting perl5, installing perl6, deleting perl6,
--- "David H. Adler" <[EMAIL PROTECTED]> wrote:
> On Thu, Apr 26, 2001 at 06:43:37PM -0500, Arante, Susan wrote:
> > This used to be working but after my very adventurous fiasco
> > (deleting perl5, installing perl6, deleting perl6, installing perl5
> > - yes i deleted not uninstalled), it's not
On Thu, Apr 26, 2001 at 06:43:37PM -0500, Arante, Susan wrote:
> This used to be working but after my very adventurous fiasco (deleting
> perl5, installing perl6, deleting perl6, installing perl5 - yes i deleted
> not uninstalled), it's not working anymore. I'm running perl5 on NT.
Given that th
--- "Arante, Susan" <[EMAIL PROTECTED]> wrote:
> This used to be working but after my very adventurous fiasco
> (deleting perl5, installing perl6, deleting perl6, installing perl5 -
> yes i deleted not uninstalled), it's not working anymore. I'm
running
> perl5 on NT.
I'd try installing Perl5,
Susan Arante writes ..
>I'm getting the above error when my perl script runs a batch
>(master.bat) that in turn runs a batch (slave.bat) that runs another
>perl script. The process kicks me out
sounds peculiar .. but I don't think it has anything to do with your
Perl5/Perl6 dance .. see comments
This used to be working but after my very adventurous fiasco (deleting
perl5, installing perl6, deleting perl6, installing perl5 - yes i deleted
not uninstalled), it's not working anymore. I'm running perl5 on NT.
I'm getting the above error when my perl script runs a batch (master.bat)
that in
63 matches
Mail list logo