From: | "Daniel Regan" <danielre [...] nortelnetworks.com> |
To: | "'bug-par [...] rt.cpan.org'" <bug-par [...] rt.cpan.org> |
Subject: | Possible bug? |
Date: | Mon, 25 Aug 2003 13:49:55 -0400 |
I'm using PAR-0.73 on W2K. I used the following command to create a stand
alone executable:
pp -o test.exe test.pl
(See below for perl code...)
The code checks passed parameters. If it doesn't like what it sees, it
calls a "usage" function to print usage and exit. My problem seems to be
related to the exit status. If I exit the script with "exit 0", I am able
to repeatedly run the executable and test against all conditions. However,
if I change the exit statement to "exit 1" (to indicate the script exited
with an error) I get unpredictable results. The executable may run OK for a
few invocations, but ultimately, the executable will cause the following
error:
"par.exe has generated errors and will be closed by Windows. You will need
to restart the program. An error log is being created."
This results in the following entry in the application log under event
viewer:
Event Type: Information
Event Source: DrWatson
Event Category: None
Event ID: 4097
Date: 8/25/2003
Time: 10:40:26 AM
User: N/A
Computer: DREGAN-1
Description:
The application, , generated an application error The error occurred on
08/25/2003 @ 10:40:26.572 The exception generated was c0000005 at address
00401973 (<nosymbols>)
Data:
<snip>
0070: 45 78 63 65 70 74 69 6f Exceptio
0078: 6e 20 6e 75 6d 62 65 72 n number
0080: 3a 20 63 30 30 30 30 30 : c00000
0088: 30 35 20 28 61 63 63 65 05 (acce
0090: 73 73 20 76 69 6f 6c 61 ss viola
0098: 74 69 6f 6e 29 0d 0a 0d tion)...
<snip>
(I can send all the data if you think it will help...)
The only other interesting point is that running the perl script (test.pl)
always does the right thing - regardless of the exit value.
I am new to PAR/PP. (Today is my first day using it.) So maybe I am doing
something wrong?
The exit status of my script is not critical. I have changed my script to
use "exit 0" in all instances.
This shouldn't be a problem, because I don't see anyone ever checking the
return code on this program.
However, it would be nice to know how I can bypass this problem for the time
when exit codes will be important to me. :-)
Thanks.
Dan
Here is the perl code for test.pl:
#use strict;
#use warnings;
use Getopt::Long;
use File::Basename <File::Basename> ;
my $Opt1;
my $Opt2;
my $help;
GetOptions ( "one" => \$Opt1,
"two" => \$Opt2,
"h" => \$help );
#
# Check for required params and print usage if necessary
#
my $script = basename $0;
sub usage {
print "\n\n\t$script -one | -two [-h]\n\n";
print "\nYou must specify either \"-one\" or \"-two\" - *not*
both!\n\n";
print "\t-one\twill do the first thing\n";
print "\t-two\twill do the second thing\n";
print "\n\t-h\tprints this message\n\n\n";
exit 1;
}
if (! $Opt1 && ! $Opt2 ) { usage (); }
if ($help) { usage (); }
if ($Opt1 && $Opt2) { usage (); }