develooper Front page | perl.perl5.porters | Postings from September 2018

[perl #133505] open() dies for invalid modes, instead of returningundef, as documented

Thread Previous | Thread Next
From:
slaven@rezic.de via RT
Date:
September 11, 2018 05:38
Subject:
[perl #133505] open() dies for invalid modes, instead of returningundef, as documented
Message ID:
rt-4.0.24-27631-1536644328-1711.133505-15-0@perl.org
Dana Sat, 08 Sep 2018 04:18:12 -0700, rdiezmail-perl@yahoo.de reče:
> 
[...]
> The error message seems like a run-time error, and not a compilation
> error. However, the documentation states: "Open returns nonzero on
> success, the undefined value otherwise." Therefore, open() should not
> die itself, but return undef, and hopefully also set $! accordingly.

The exception in this case is intentional, a fact you can easily prove by running the code under "use diagnostics" (there is a diagnostical message for this case). So if something needs to be changed then it's the open() documentation.

(Also there's no way to set $! in this case, because no system call is executed, so errno is not set at all)

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

Thread Previous | Thread Next


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