Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > System Return Value?

Reply
Thread Tools

System Return Value?

 
 
g4173c@motorola.com
Guest
Posts: n/a
 
      01-11-2007
Hi:

I've been reading perldoc -f system and have been trying:

system ("verix -i ${design}.ctl") == 0 or die "ERROR: verix -i
${design}.ctl Failed!, Please check verix.log\n";

To get the return value.

I see the program doing:

**> exit 1

However it doesn't execute the die command. I've also tried this in and
If statement and other things, but without any luck. Any ideas what
else I could try?

Thanks is advanced for any help here!

Tom

 
Reply With Quote
 
 
 
 
Paul Lalli
Guest
Posts: n/a
 
      01-11-2007
(E-Mail Removed) wrote:
> I've been reading perldoc -f system and have been trying:
>
> system ("verix -i ${design}.ctl") == 0 or die "ERROR: verix -i
> ${design}.ctl Failed!, Please check verix.log\n";
>
> To get the return value.
>
> I see the program doing:
>
> **> exit 1


What does it mean that the program is "doing" that? Is that output
that the verix program generates? Or is that a line of code in verix
that you think it should be executing?

> However it doesn't execute the die command.


Then system() is pretty clearly returning 0.

> I've also tried this in and
> If statement and other things, but without any luck. Any ideas what
> else I could try?


I don't really understand what your question is, or what problem you're
trying to solve. My *guess* is that you are under the belief that the
verix program is exiting with a status of 1, and that the Perl program
is therefore wrong because it's not executing the die() statement. Is
that correct? If so, I respectfully disagree.

If the die() statement is not executing, then system() returned 0.
Period. No other way around it. Your assumption about what verix
exited with, therefore, is wrong. Why not simply run the verix command
in a shell, and echo out the value of $? to see what it actually is?

You can also try capturing the value of system, and/or print the value
of $? from within the Perl script:

my $retval = system ("verix -i ${design}.ctl");
if ($retval != 0) {
die "ERROR: verix -i ${design}.ctl Failed: $retval ($?)\n";
} else {
warn "I think something's wrong - system() returned 0 ($?)\n";
}

Paul Lalli

 
Reply With Quote
 
 
 
 
g4173c@motorola.com
Guest
Posts: n/a
 
      01-11-2007

> You can also try capturing the value of system, and/or print the value
> of $? from within the Perl script:


Good idea, tried that and got:

**> exit 1
0

This is what Verix program does after it finds an error, however
doesn't
seem to set the return value correctly.

Thanks for the help!
Tom

 
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
Return-Code of "system" on a 64-bit system Sergeant_Pepper Perl Misc 2 12-19-2005 08:08 AM
System.Security.SecurityException: Error de solicitud de permiso de tipo System.Net.WebPermission, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. Luis Esteban Valencia ASP .Net 0 07-14-2005 01:43 PM
what value does lack of return or empty "return;" return Greenhorn C Programming 15 03-06-2005 08:19 PM
How do I return a return-code from main? wl Java 2 03-05-2004 05:15 PM
Return a return value from Perl to Javascript PvdK Perl 0 07-24-2003 09:20 AM



Advertisments