Re: exception handling

2014-02-14 Thread 'lesleyb'
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

exception handling

2014-02-13 Thread Bill McCormick
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.

Re: Help on exception handling (Try::Tiny)

2013-10-04 Thread Shaji Kalidasan
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

Re: Help on exception handling (Try::Tiny)

2013-10-04 Thread Jim Gibson
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

Help on exception handling (Try::Tiny)

2013-10-04 Thread Shaji Kalidasan
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)

Re: DBD::mysqlPP is giving out of memory exception and ODBC is working fine.

2013-05-19 Thread Ganesh Babu N
;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

Re: DBD::mysqlPP is giving out of memory exception and ODBC is working fine.

2013-05-19 Thread Shlomi Fish
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 ) { >

DBD::mysqlPP is giving out of memory exception and ODBC is working fine.

2013-05-18 Thread Ganesh Babu N
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

Re: Exception error in perl code

2009-06-17 Thread Jim Gibson
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 { >

Exception error in perl code

2009-06-16 Thread Rajini Naidu
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

Re: Exception Handling in perl

2009-02-27 Thread Jenda Krynicky
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

RE: Exception Handling in perl

2009-02-27 Thread Sarsamkar, Paryushan
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:

Re: Exception Handling in perl

2009-02-27 Thread David Shere
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 : $

Re: Exception Handling in perl

2009-02-27 Thread David Shere
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

Exception Handling in perl

2009-02-27 Thread Sarsamkar, Paryushan
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.

Re: Exception handling in perl

2007-07-12 Thread Ovid
- 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

Re: Exception handling in perl

2007-07-12 Thread Mr. Shawn H. Corey
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."

Re: Exception handling in perl

2007-07-12 Thread Martin Barth
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

Exception handling in perl

2007-07-12 Thread Pushkar Pande
How do we handle exceptions in perl?

Re: Want to add exception for a auto run sub in module

2006-01-23 Thread Tom Phoenix
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

Re: Want to add exception for a auto run sub in module

2006-01-23 Thread Jimmy
, 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

Want to add exception for a auto run sub in module

2006-01-23 Thread Jimmy
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

Re: XML::Twig exception handling

2005-06-03 Thread Peter Rabbitson
> 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

XML::Twig exception handling

2005-06-03 Thread Peter Rabbitson
. 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

Re: Exception Handling - Professionally

2004-06-10 Thread Scott Stearns
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

Re: Exception Handling - Professionally

2004-06-10 Thread Peter Scott
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

Re: Exception Handling - Professionally

2004-06-09 Thread drieux
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

Re: Exception Handling - Professionally

2004-06-09 Thread Wiggins d Anconia
> > 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&

Re: Exception Handling - Professionally

2004-06-09 Thread Randal L. Schwartz
> "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")) { ...

Re: Exception Handling - Professionally

2004-06-09 Thread drieux
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

Re: Exception Handling - Professionally

2004-06-08 Thread Randal L. Schwartz
>>>>> "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 '

Re: Exception Handling - Professionally

2004-06-08 Thread Wiggins d Anconia
> 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

Exception Handling - Professionally

2004-06-08 Thread Scott Stearns
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

Re: forcing stack backtrace in the case of unhandled exception/Perl error

2004-04-26 Thread David Garamond
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)

Re: forcing stack backtrace in the case of unhandled exception/Perl error

2004-04-26 Thread Randy W. Sims
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

forcing stack backtrace in the case of unhandled exception/Perl error

2004-04-26 Thread David Garamond
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

Re: Handling error with exception

2004-02-13 Thread Jenda Krynicky
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

Re: Handling error with exception

2004-02-12 Thread Randy W. Sims
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

Handling error with exception

2004-02-12 Thread Hari Fajri
Do perl have handling error (exception) mechanism? for example: java use : try{...} catch{...} Thanks

Re: exceptions && exception objects

2003-02-13 Thread simran
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

Re: exceptions && exception objects

2003-02-13 Thread R. Joseph Newton
"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

Re: exceptions && exception objects

2003-02-12 Thread david
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

RE: exceptions && exception objects

2003-02-12 Thread wiggins
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.

exceptions && exception objects

2003-02-12 Thread Shaw, Steven
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]

Re: exception

2002-11-26 Thread Jenda Krynicky
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 >

Re: exception

2002-11-26 Thread Paul Johnson
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

exception

2002-11-26 Thread walter valenti
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]

RE: Regex exception

2002-07-09 Thread Jason Frisvold
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 ~= $

Re: Regex exception

2002-07-09 Thread Jeff 'japhy' Pinyan
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/

Re: Regex exception

2002-07-09 Thread Jaime Hourihane
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]

RE: Regex exception

2002-07-09 Thread Nikola Janceski
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

RE: Regex exception

2002-07-09 Thread Nikola Janceski
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

Regex exception

2002-07-09 Thread Ned Cunningham
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:

Re: catching an exception before it reaches command line

2002-01-17 Thread Jon Molin
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:

catching an exception before it reaches command line

2002-01-17 Thread Alex Harris
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

Re: Error: Runtime Exception

2001-04-29 Thread David H. Adler
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

Re: Error: Runtime Exception

2001-04-27 Thread Joel Divekar
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

Re: Error: Runtime Exception

2001-04-27 Thread David H. Adler
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,

Re: Error: Runtime Exception

2001-04-27 Thread Paul
--- "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

Re: Error: Runtime Exception

2001-04-27 Thread David H. Adler
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

Re: Error: Runtime Exception

2001-04-27 Thread Paul
--- "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,

RE: Error: Runtime Exception

2001-04-26 Thread King, Jason
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

Error: Runtime Exception

2001-04-26 Thread Arante, Susan
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