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
perldoc perlvar for %! should discuss values #14929
Comments
From @FGasperCreated by @FGasperThe docs for %! in perlvar don’t discuss the actual values of %!. { The docs seem to indicate that the values of this hash, though, Is this still the case? Or, may language users depend on values of Some clarification in the docs would be welcome. Thank you! Perl Info
|
From @jkeenanOn Thu Sep 24 23:11:32 2015, felipe@felipegasper.com wrote:
Here is what I believe is the most relevant documentation of %! as found in blead. ##### =item %OS_ERROR =item %ERRNO =item %! Each element of C<%!> has a true value only if C<$!> is set to that pod/perldiag.pod (line 1355) =item Can't use %! because Errno.pm is not available (F) The first time the C<%!> hash is used, perl automatically loads the Can you suggest specific improvements? Thank you very much. -- |
The RT System itself - Status changed from 'new' to 'open' |
From @FGasperOn 25 Sep 2015 6:51 PM, James E Keenan via RT wrote:
Maybe: The keys of %! are the names of constants from the Errno.pm module like * When $! is 0, every value of %! is 0. * When $! is not 0, the value of %! whose key corresponds to the Errno For example, if EIO is 5 and This is useful for handling specific I/O errors, like so: open my $fh, '<', $path or do { -FG |
From @ap* Felipe Gasper <felipe@felipegasper.com> [2015-09-26 09:35]:
Which only uses the value’s truthiness… Do you have an example where the correspondence of value to errno code |
From @FGasperOn 29 Sep 2015 8:54 AM, Aristotle Pagaltzis via RT wrote:
I’ve seen people do this: if ( … in response to which I, as reviewer, said, “but the documentation only Honestly, I was expecting the values to be just q<> or 1, consistent Basically, if the values are more informative/useful than just being q<> -FG |
From @ikegamiOn Tue, Sep 29, 2015 at 10:02 AM, Felipe Gasper <felipe@felipegasper.com>
I don't think that's something we'd want to encourage. They should have used if ( $!{ENOENT} ) or if ( $! == ENOENT ) |
From @FGasperOn 29 Sep 2015 9:59 AM, Eric Brine via RT wrote:
I agree, but right now the docs imply something that the reality doesn’t Maybe an example of correct use of %! could be added to the docs? my @nonfatal = qw( EACCES EDQUOT ); open( my $fh, '>', $cache_file_path ) or do { Still, just in general, for Perl to have nontrivial, -FG |
From @ikegamiOn Tue, Sep 29, 2015 at 1:02 PM, Felipe Gasper <felipe@felipegasper.com>
Hum? What do you think the docs imply that's not true? |
From @FGasperOn 29 Sep 2015 1:24 PM, Eric Brine wrote:
IMO the docs imply that the following should not work: if ( ...given the context of how the rest of Perl implements returns that are Given that we don’t want people to write the above, why *does* Perl -FG |
From @ikegamiOn Tue, Sep 29, 2015 at 2:41 PM, Felipe Gasper <felipe@felipegasper.com>
Right, so the **code** should be changed |
From @ikegamiOn Tue, Sep 29, 2015 at 2:41 PM, Felipe Gasper <felipe@felipegasper.com>
The docs only imply that the above is wrong. I'm with the docs on this one. |
From @FGasperOn 29 Sep 2015 3:08 PM, Eric Brine wrote:
I don’t have an example of *good* code where the correspondence is This has been this way at least since Perl 5.8, and possibly longer. It could be as simple as: “A nonzero value of %! will match the key’s If nothing else, is there general agreement that adding a (good) usage -FG |
From @ap* Felipe Gasper <felipe@felipegasper.com> [2015-09-29 22:20]:
Me neither, that’s why I asked. I can’t come up with a use for it.
Yes, and there doesn’t seem to be any positive value to be had from the
That’s what I don’t get, though. If it’s documented, more people will
Dunno, but personally I agree. I can easily imagine that the idea of %! Regards, |
From @AbigailOn Wed, Sep 30, 2015 at 01:18:36AM +0200, Aristotle Pagaltzis wrote:
You can document what it currently does, and then continue pointing It's then up to the programmer what to do with this information -- Abigail |
From @ysthOn Sep 29, 2015 1:08 PM, "Eric Brine" <ikegami@adaelis.com> wrote:
Playing Devil's advocate:
|
From @FGasperOn 30 Sep 2015 12:04 AM, Yitzchak Scott-Thoennes wrote:
Devil’s advocate again: if ( -FG |
From @ysthOn Sep 29, 2015 10:08 PM, "Felipe Gasper" <felipe@felipegasper.com> wrote:
Passing errorish globals is usually not a good idea; the caller may |
From @ysthOn Sep 29, 2015 10:15 PM, "Yitzchak Scott-Thoennes" <sthoenna@gmail.com>
I mean callee |
From @FGasperOn 30 Sep 2015 12:15 AM, Yitzchak Scott-Thoennes wrote:
if ( ;-) |
@rjbs - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#126174 (status was 'resolved')
Searchable as RT126174$
The text was updated successfully, but these errors were encountered: