Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"die" return 0 ??? #124

Closed
p5pRT opened this issue Jun 28, 1999 · 1 comment
Closed

"die" return 0 ??? #124

p5pRT opened this issue Jun 28, 1999 · 1 comment

Comments

@p5pRT
Copy link

p5pRT commented Jun 28, 1999

Migrated from rt.perl.org#928 (status was 'resolved')

Searchable as RT928$

@p5pRT
Copy link
Author

p5pRT commented Jun 28, 1999

From Daniel.W.Yang@fritolay.com

I had a Perl script runing on AIX platform which opens a pipe to ftp some files.
If ftp is successful, the
program returns 0 , otherwise die, which returns non-zero. But, It seems "die"
return unpredicted
values. Sometimes, it even eturn 0. I read the manpage for die function, It
should never return 0. I wonder
what might be the problem. The Perl version I am runing is : This is perl,
version 5.004_03.

Here is my script.
1. rtn.ksh

  ftprtn.pl
  print $?

2. ftprtn.pl

#this is a program opening clftp and get files
open( INFTP, "| clftp CLRED1") or die "Could not fork,ftp failed​: $!\n";
print INFTP "ENDONERR \n";
print INFTP "lcd /home/dyang \n";
print INFTP "get noexist.txt \n";
print INFTP "QUI \n";
close INFTP or die "FTP failed​: $! : $?";

when I run the rtn.ksh, here is the result. Because nonexist.txt file doesn't
exist, so ftp fails.

CLRED1 has been mapped to snax11h0​:iclred1.
Connecting to : snax11h0
/usr/bin/FCFSHELL​: on host "snax2e11" execute command fcffserv c 0
Connecting to : iclred1
Remote system snax11h0​:iclred1 job connected with protocol TCP/IP​:ESCON.
clftp > End on error flag : On
clftp > 200 "/home/dyang" is current local directory prefix.
clftp > 452 Unable to send NOEXIST.TXT.
671 Ending because 'end on error' flag is set.
221 GoodBye.
FTP failed​: :2048 at ftprtn.pl line 8.
0

The Perl close function in ftprtn.pl fails and die is called with $?=2048. But
ftprtn.pl still returns 0 to
rtn.ksh. The Perl manpage says when the execution of pipeline fails, the Perl
should retrn $? >> 8 or
255 to the calling program. I don't understand why the above program doesn't do
in this way. I also
did some testing by manipulating $! and $? and got the same result. I appreciate
your feedback

Thanks in advance !
Daniel Yang

@p5pRT p5pRT closed this as completed Nov 28, 2003
toddr pushed a commit that referenced this issue Oct 19, 2019
This should speed up parsing,
and changes the "Identifier too long" limitation from max 256 to 1024.
See [cperl #124]

TonyC:
 - this was largely a core change, with an incidental change to Storable,
   only the Storable change has been included for compatibility with cperl
toddr pushed a commit that referenced this issue Oct 19, 2019
This should speed up parsing,
and changes the "Identifier too long" limitation from max 256 to 1024.
See [cperl #124]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant