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
Inappropriate warning for 'my' in 'open' #4186
Comments
From @mjdominusCreated by @mjdominusperl -we '$file="X"; open my $fh, $file;' Parentheses missing around "my" list at -e line 1. The warning is inappropriate in this context. A workaround is to write: perl -we '$file="X"; open my $fh, "$file";' Perl Info
|
From @smpeters
The problem is that Perl sees the "my $fh, $file;" and assumes its a This can be prevented by simply putting a "()" around the $fh so that |
@smpeters - Status changed from 'open' to 'resolved' |
From @mjdominusSteve Peters:
I don't think it is appropriate for you to be marking bugs as I am grateful for all the hard work you have done to clean up the open |
From @ysthOn Wed, Jun 08, 2005 at 03:37:45AM -0400, Mark Jason Dominus wrote:
I have to say that if any one bug admin thinks a bug is resolved, they Hmm. mjd's response doesn't seem to have reopened the ticket, though. |
From @smpeters
The system is set to not automatically re-open tickets. There were This ticket has been reopened, but I not really sure why? Can you explain? |
@smpeters - Status changed from 'resolved' to 'open' |
From @smpeters
Oops! I forgot to copy p5p on the reply. Can you give an explanation of why this warning is Thanks! |
From @rgsSteve Peters via RT wrote:
because the code is appropriately parsed by perl. This is one of the heuristic warnings given by analysis of the textual input. |
From @TuxOn Wed, 8 Jun 2005 14:19:39 +0200, Rafael Garcia-Suarez
another rather annoying one is pc09:/home/merijn 101 > perl -we'$x="foo\nbar";-f $x and die "file"' -- |
From @smpetersOn Wed, Jun 08, 2005 at 02:19:39PM +0200, Rafael Garcia-Suarez wrote:
Right. After a quick glance at the code shows that creates the warning ( Since the heuristics of this warning seem to be too simplistic for the Steve Peters |
From @rgsSteve Peters wrote:
No, I think it's still very useful for code like : my $foo, bar; |
From @smpeters
In that case, though, a couple different warnings catch it.
with strict, it is caught ...
while letting through cases where Perl and strict see it is appropriate.
when assigned with a list without strict, it does seem to DWIM
So, here's my suggestion. The warning should only be generated when |
From gtwilliams@gmail.comOn Tue, 2005-06-07 at 23:04 +0000, Steve Peters via RT wrote:
There's another "work-around": $ perl -we '$file="X"; open my $fh, $file;' This looks "inappropriate" to me. -- |
From @AbigailOn Wed, Jun 08, 2005 at 07:06:07AM -0400, Garry Williams wrote:
$ perl -we '$file="X"; open my $fh => $file;' Yet another reason to use '=>' instead of a comma. ;-) Abigail |
From @AbigailOn Wed, Jun 08, 2005 at 01:41:12PM -0000, Steve Peters via RT wrote:
It makes sense, but I disagree. One-liners aren't the programs you In larger programs, you might write: use strict; my $bar = ...; sub quux { 'strict' isn't going to complain here, because every variable is Abigail |
From yuki-o@is.naist.jpThis is a bug report for perl from yuki-o@is.naist.jp, Greetings, I found a bug on warnings.pm (v1.05). This related to the "parenthesis" Parentheses missing around "my" list at test.pl line 10. If at least one variable is literal, warning does not occur. Predeclared #!/usr/bin/perl use 5.006; my $mode = '<'; open my $fh, $mode, $file; # not ok my $fh; no warnings qw( parenthesis ); Regards, Flags: Site configuration information for perl v5.8.8: Configured by SYSTEM at Tue Jan 23 15:57:26 2007. Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Locally applied patches: @INC for perl v5.8.8: Environment for perl v5.8.8: -- |
From @rgarciaOn 15/03/07, via RT OHMAE Yuki <perlbug-followup@perl.org> wrote:
Yes, this bug is known. It's due to the heuristics implemented in the |
The RT System itself - Status changed from 'new' to 'open' |
From @davidnicolOn 3/15/07, Rafael Garcia-Suarez <rgarciasuarez@gmail.com> wrote:
As usual I don't know how realistic my suggestion is, Sometimes my is greedy, sometimes not; sometimes my wrongly |
Migrated from rt.perl.org#7250 (status was 'open')
Searchable as RT7250$
The text was updated successfully, but these errors were encountered: