develooper Front page | perl.perl5.porters | Postings from March 2008

Re: [PATCH][NUDGE] Documentation fix for perlfunc/shutdown

Thread Previous | Thread Next
Paul Fenwick
March 31, 2008 14:41
Re: [PATCH][NUDGE] Documentation fix for perlfunc/shutdown
Message ID:
G'day Nicholas/p5p,

This is just a polite nudge regarding the documentation patch regarding 
perlfunc/shutdown (attached again for convenience), since I believe that 
we've now sorted out the inner workings.

Apologies in advance for slow responses from me this week, or if this has 
already been fixed and I've missed it.  I'm in Sydney teaching, which is 
awesome for catching up with, and horrible for both my e-mail 
response times and my liver (due to



Paul Fenwick wrote:
> G'day Nicholas/p5p,
> Nicholas Clark wrote:
>> I don't know. The code looks like this:
> [snip]
>>     PUSHi( PerlSock_shutdown(PerlIO_fileno(IoIFP(io)), how) >= 0 );
> Forgive my poor knowledge of Perl's guts, but if I'm reading that 
> correctly, we're pushing an integer return value based upon the return 
> value of PerlSock_shutdown().  This means we can return '0' if we call 
> PerlSock_shutdown but it fails (eg, filehandle isn't a socket).
> This is backed up by:
>     perl -wle'print shutdown(STDIN,1);'
> which returns 0.  It looks like we only return undef if we reach the 
> nuts label, the only path into which is:
>     if (!io || !IoIFP(io))
>     goto nuts;
> This implies we return undef only when we don't have a valid filehandle 
> (assuming that's what IoIFP is testing).
> You've suggested:
>>     Returns C<1> for success, C<undef> if the first argument is not a 
>>     valid filehandle, or if the C<shutdown> call failed for any reason, such 
>>     as the filehandle is not a socket.
> So how about we combine everything into:
>     Returns C<1> for success. In the case of error, returns
>     C<undef> if the first argument is not a valid filehandle,
>     or returns C<0> and sets C<$!> for any other failure.
> A patch for the new wording is attached.
> Cheerio,
>     Paul

Paul Fenwick <> |
Director of Training                   | Ph:  +61 3 9354 6001
Perl Training Australia                | Fax: +61 3 9354 2681

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About