I am calling a subroutine which checks if a log file is writeable and if not, prints something stdout and also log something into the same file, which doesn't work neither of course.
Anyway, there is enough exit() calls, that should stop it working, but the problem is, that I get the message about the file permissions (which I set on intent to produce the problem) in and infinite loop, though there is no loop calling the functions.
In all these thousands lines of messages I found inbetween this hint:
These two functions are here:
It should at least hit that exit(3); in log_me(), but it doesn't. Instead I get this spam of messages.
As you can see in the head of debug() I added caller() to get a clue which is calling it. It showed me it is this line:
... which is in the main part of the program and neither in a loop.
Thanks for any hint in forward!
Edit:
I removed the calls of log_me() in both functions because it made no sense of course. Though difference to the original problem.
Last edited by zaxxon; 02-19-2014 at 11:23 AM..
Reason: added info
Well, I am not a perl expert. But in your log_me function you detect that the logfile cannot be opened so you call log_me again.
This second invocation of log_me will also detect that the logfile cannot be opened so it will call log_me again.
This third invocation of log_me will also detect that the logfile cannot be opened so it will call log_me again.
And so on.
Shouldn't actually be infinite though. Each iteration consumes a bit more stack. Try letting it run for a few minutes. You gotta blow the stack sooner or later.
First time trying to work with signals in Perl.
Reviewing example I try it, but not able to get it work for 'exit'.
I hope, I am correct, assuming, that the ending any code by
exit $return_code;
the $SIG{EXIT} should be de-referenced and processed?!
So, I have such code, that, I assume,... (5 Replies)
Dear all,
We have a service that we start up remotely with rsh but unfortunately, the rsh never returns to the calling server. This seems to be because the processes of the service we've just started hold the port open.RBATTE1 @ /home/RBATTE1>netstat -na|grep 49.51
tcp4 0 0 ... (1 Reply)
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)
spath="/home/user/k/${1}"
dpath="/home/user/seq/Nov17/${1}"
cd $dpath
ls -1 $spath > list
c=1
while read list
newlist=`echo $list | sed 's/.gz//' `
newnewlist=`echo $newlist | sed 's/.fastq//' `
do
echo $c
echo $list
c=$(($c+1)) (6 Replies)
Hi all,
I made a simple script with a prompt menu in Perl. All working good, but I want to add an option while the program is running that on every time when the user press 'Q' the program will exit.
I know I can use $SIG{'INT'} or any other %SIG option. This option is a unix signal which I... (3 Replies)
HI all,
can anyone tell me what does exit status 9 from perl's system function meant.
I am using system fuction to execute a shell script as :
my $s=system ('script.sh' ,arg1 ,arg2);
print $s;
the output is 9.
Thanks in advance. !!:confused: (1 Reply)
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)
I am running a korn shell script which has a recursive function.
The script ran for 117 iterations and ended up with the following error
"recursion too deep".
what should be done to avert this?
Thanks in advance
Swamy
p.s. I am on UNIX MPRAS V4 (3 Replies)
Hey Everyone,
Just starting with PERL (5.8.2) after years of KSH. Is there a way to trap the exit as you can in KSH (i.e., "trap EXIT_SCRIPT EXIT")?
Thanks in advance for any help,
gsatch (4 Replies)