status of perl script in another ...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting status of perl script in another ...
# 1  
Old 08-04-2003
status of perl script in another ...

Hi,

Is there a way to get the status of a perl program in another perl script ?

Ex.:
1/ proc_sub.pl:
print "test programme perl\n" and exit 1;

2/ proc_main.pl:
print "status of proc_sub.pl : ";
proc_sub.pl # possibility to get the status=1 ???


Thanks a lot.
# 2  
Old 08-04-2003
Yes. require() proc_sub.pl in proc_main.pl and the return value is what you need. The return value can be anything, except 0. Of course, in proc_sub.pl you shouldn't use exit then, or the proc_main.pl will also be terminated. You can use return instead.
# 3  
Old 08-05-2003
Thanks but do you know if there is a syntax calling proc_sub with arguments:

require proc_sub "arg1" "arg2" ... "argn" # ?
# 4  
Old 08-05-2003
require() doesn't work that way. Basically it only loads the file, executes it and return the return value. Actually, from your description I think you mean to put it in another way. For example:

a.pl: ====================

require "b.pl";

$retval = &some_sub(arg1, arg2, ...);
# get 5

b.pl: =====================

sub some_sub {
#...
return 5;
}

1;

If in doubt, please read the perlfunc manpage for description on require().
# 5  
Old 08-05-2003
ok. I think i've no choice.

Thanks.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need output of script on screen and file with correct return status of the called script.

Hi, I am trying to capture logs of the script in the file as well as on the screen. I have used exec and tee command for this. While using exec command I am getting the correct output in the file but, script output is not getting displayed on the screen as it get executed. Below is my sample... (14 Replies)
Discussion started by: Prathmesh
14 Replies

2. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

3. Shell Programming and Scripting

Shell Script for continuously checking status of a another script running in background, and immedia

Hi, I want to write a script which continuously checking status of a script running in background by nohup command. And if same script is not running then immediately start the script...please help.. i am using below command to run script nohup system_traps.sh & but in some... (9 Replies)
Discussion started by: ketanraut
9 Replies

4. Shell Programming and Scripting

Perl Question Grep and exit status

Im being forced to write in perl. I prefer KSH or Expect, so I suppose its time to become more fluent with perl. I have the following problem. I want to loop through Filea and check that each line in Filea is resident in Fileb. Filea contents two four six eight houseboat Fileb... (4 Replies)
Discussion started by: sumguy
4 Replies

5. Shell Programming and Scripting

status bar in shell script or perl

How To Generate different different progress bar in shell script? like we install some software it show us progress, like we install RPM that also show us progress. Thanks, Bash (2 Replies)
Discussion started by: learnbash
2 Replies

6. Shell Programming and Scripting

how to find status of last executed cmd in perl?

In shell we can find the status of last executed command by $? In perl what is the command to find the status of last executed command... Can any one please say??????????????? Thanks, Prabhu (1 Reply)
Discussion started by: prsampath
1 Replies

7. Shell Programming and Scripting

capturing C++ binary return status in perl

Hello, I have a C++ binary that runs in my perl script. But, Currently, the binary is doing a core dump and i want to capture the retrun status of the binary to report as an issue. Can you please help me on this. Thanks, Sateesh (1 Reply)
Discussion started by: kotasateesh
1 Replies

8. Shell Programming and Scripting

capturing C++ binary return status in perl

Hello, I have a C++ binary that runs in my perl script. But, Currently, the binary is doing a core dump and i want to capture the retrun status of the binary to report as an issue. Can you please help me on this. Thanks, Sateesh (1 Reply)
Discussion started by: kotasateesh
1 Replies

9. Shell Programming and Scripting

perl - understand process status and continue the code execution

Hello, I need advice on how to check if started processes are finished in perl, here's explanation : OS is RHEL 4, perl -v = "This is perl, v5.8.0 built for i386-linux-thread-multi" The logic of the script : #!/usr/bin/perl use warnings; $param1 = $ARGV; $param2 = $ARGV; $param3 =... (2 Replies)
Discussion started by: sysgate
2 Replies

10. Shell Programming and Scripting

How to get exit status codes in bash from Perl?

I apologize if I have already posted this query. I scanned back quite a few pages but could not find such a query. If my perl code contains "exit(33)" how can I get that value in bash for use in a "if" statement. Thanks, Siegfried (5 Replies)
Discussion started by: siegfried
5 Replies
Login or Register to Ask a Question