develooper Front page | perl.perl5.porters | Postings from May 2015

[perl #123264] sysopen() has no documented return value.

From:
Tony Cook via RT
Date:
May 26, 2015 06:30
Subject:
[perl #123264] sysopen() has no documented return value.
Message ID:
rt-4.0.18-27807-1432621843-760.123264-15-0@perl.org
On Sun May 17 09:05:34 2015, ribasushi@cpan.org wrote:
> Neither
> https://metacpan.org/pod/distribution/perl/pod/perlfunc.pod#sysopen-
> FILEHANDLE-FILENAME-MODE
> 
> nor the upcoming
> https://metacpan.org/pod/release/SHAY/perl-
> 5.21.11/pod/perlfunc.pod#sysopen-FILEHANDLE-FILENAME-MODE
> 
> mention anything about the return value of sysopen(). Not providing a
> patch since I am not certain about any of the fine details (which is
> why
> I wet to look for the doc in the first place).

I think the return value of sysopen() is meant to be covered by this 
text in perlfunc:

In general, functions in Perl that serve as wrappers for system calls ("syscalls")
of the same name (like chown(2), fork(2), closedir(2), etc.) return
true when they succeed and C<undef> otherwise, as is usually mentioned
in the descriptions below.

but I've attached a patch that documents the return value in the sysopen()
description.

If you're wondering "is it really that simple?" - here's the code from
Perl_pp_sysopen():

    if (do_open_raw(gv, tmps, len, mode, perm)) {
	IoLINES(GvIOp(gv)) = 0;
	PUSHs(&PL_sv_yes);
    }
    else {
	PUSHs(&PL_sv_undef);
    }

Tony



---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=123264



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About