-
Notifications
You must be signed in to change notification settings - Fork 8
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
Jkeenan/warnings t base #287
Conversation
In most cases warnings were quieted, but in one case we capture it to demonstrate the warning.
|
print "foo\n"; | ||
} | ||
/^/ && (print "ok 5\n"); | ||
'; # ' | ||
|
||
my %foo; | ||
eval '$foo{1} / 1;'; | ||
eval 'no warnings q|uninitialized|; $foo{1} / 1;'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unclear if doing this outside of blocks has a global effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alternatively we can use something like this BEGIN { ${^WARNING_BITS} = '' }
@xsawyerx, Can you clarify what you mean by this? Perhaps by giving an example? For instance, how would you address the warnings generated by running Thank you very much. |
Per review by Todd R.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks ok, but I would consider getting rid of the bare file handle and use something like this instead
my $fh;
open($fh, "/dev/null") or open($fh, "nla0:") or (die "Can't open /dev/null.");`
....
Here we again face the question: What changes in older test files should be done in our Perl 7 research, and which should be done in Perl 5 blead? I don't think the answer is clear-cut. For example, I myself saw merit in both sides of the argument in #188. One could argue that getting rid of all bareword filehandles in the Perl core distribution test suite is a Good Thing because the test suite should display best practices. However, I don't see any discussion of discouraging, deprecating, or fatalizing them in any of our Objectives on our roadmap. In other words, we've never put any of that "in scope" for "Perl 7." So, so far my approach has been to address the warning that comes up when we turn on warnings-by-default in the simplest possible manner. It seems to me that quoting a bareword filehandle (e.g., I reluctantly conclude that this should be raised on p5p list. Thank you very much. |
@xsawyerx Still hoping for clarification on this. Thanks. |
No recent comments. Proceeding to merge into Thank you very much. |
Reviewers: There's one aspect of this pull request which warrants some discussion.
perldoc perlhack
advises:For these 3 subdirectories -- and for
t/base
in particular -- we have tended to write tests on the premise thatrequire
anduse
have not yet been demonstrated to work. But ifuse MODULE
has not yet been proven to work, then presumablyno MODULE
has also not yet been proven to work.However, once we run test files in these directories under strict-by-default and/or warnings-by-default, we have to have a way of temporarily relaxing strictures or suppressing warnings. That suggests judicious, precise use of, say,
no strict 'uninitialized
;' andno strict 'refs;'
. But that presumes that we can load modules.We don't face this problem in Perl 5 because most files in these subdirectories never cared about strictures or warnings. Indeed, some of them date to Perl 1 in 1987 -- long before strictures and warnings even existed.
See, for example,
t/base/lex.t
(commit d4f1572, already inalpha
) andt/base/num.t
(commit 3a4795b, in this pull request).How shall we square this circle?
Thank you very much.
Jim Keenan