Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Perl-Critic CPAN distribution.

Report information
The Basics
Id: 20465
Status: open
Priority: 0/
Queue: Perl-Critic

People
Owner: Nobody in particular
Requestors: jjore [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Magic <> should be a warning
All uses of <>, readline(ARGV), <ARGV> should be a warning. This uses a two-arg open internally which means that if it was ever given a file named something heinous, perl would do bad things. chomp( my $out = <> ); while (<>) { chomp; $out .= ", $_"; } print $out, "\n";
On Fri Jul 14 17:25:58 2006, JJORE wrote: Show quoted text
> All uses of <>, readline(ARGV), <ARGV> should be a warning. This uses > a two-arg open internally which means that if it was ever given a file > named something heinous, perl would do bad things. > > chomp( my $out = <> ); > while (<>) { > chomp; > $out .= ", $_"; > } > print $out, "\n";
Hmm, this is a good idea. Additionally, this should be filed against Perl itself. Does Perl 5.9.x still use two-arg open for this? I'm trying to read the Perl_nextargv function in doio.c in 5.9.4 and I can't figure it out.
CC: JJORE [...] cpan.org
Subject: Re: [rt.cpan.org #20465] Magic <> should be a warning
Date: Thu, 5 Oct 2006 14:45:55 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: "Joshua ben Jore" <twists [...] gmail.com>
On 10/5/06, via RT <bug-Perl-Critic@rt.cpan.org> wrote: Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=20465 > > > On Fri Jul 14 17:25:58 2006, JJORE wrote:
> > All uses of <>, readline(ARGV), <ARGV> should be a warning. This uses > > a two-arg open internally which means that if it was ever given a file > > named something heinous, perl would do bad things. > > > > chomp( my $out = <> ); > > while (<>) { > > chomp; > > $out .= ", $_"; > > } > > print $out, "\n";
> > Hmm, this is a good idea. Additionally, this should be filed against > Perl itself. Does Perl 5.9.x still use two-arg open for this? I'm > trying to read the Perl_nextargv function in doio.c in 5.9.4 and I can't > figure it out.
Sure does. I keep meaning to file a bug report that files named friendly thingsl ike "<< EXTRA! EXTRA! >>" can't be opened by perl because of this feature but wanted to send a patch with it at the same time and I didn't get around to understanding the code to do it. I wanted to say "... understand the code _well enough_ ..." but it was hairy and I never really got it. Josh