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
Using $1 as a filehandle via open $1, "file" doesn't raise an exception #7517
Comments
From chris@mail.piyeepress.comCreated by chris@mail.piyeepress.comOpen should return false when using $1 as a file handle considering $1 is a read-only variable: $ perl -we'open It does not. Here's the output after dumping $1: $ perl -we'open Here is when a variable named "$foo" is used as a file handle: $ perl -we'open Attempting to assign to $1 should raise the "Modification of a read-only value attempted" exception, right? I find the fact that open doesn't return false and set $! unexpected behavior and would classify the behavior as a bug. Thanks, Chris Angell Perl Info
|
From @iabynOn Wed, Sep 29, 2004 at 04:43:50PM -0000, Chris Kelly wrote:
Actually, it should die, in a similar fashion to the following: $ perl585 -we '$1->{foo}=1' since both involve autovivification of a readonly value. The change below to the development version of Perl fixes this. Dave. -- Change 23342 by davem@davem-percy on 2004/09/30 20:51:31 [perl #31767] open $1, "file" doesn't raise an exception Affected files ... ... //depot/perl/pp.c#426 edit Differences ... ==== //depot/perl/pp.c#426 (text) ==== @@ -159,6 +159,8 @@ ==== //depot/perl/t/io/open.t#41 (xtext) ==== @@ -12,7 +12,7 @@ -plan tests => 107; my $Perl = which_perl(); @@ -315,3 +315,9 @@ |
The RT System itself - Status changed from 'new' to 'open' |
@iabyn - Status changed from 'open' to 'resolved' |
From @cpansproutOn Thu Sep 30 14:14:22 2004, davem@iabyn.com wrote:
And causes this bug, which I’m about to fix shortly: $ perl -lwe 'close $x; Internals::SvREADONLY($x,1); I wasn’t trying to modify it. |
From [Unknown Contact. See original ticket]On Thu Sep 30 14:14:22 2004, davem@iabyn.com wrote:
And causes this bug, which I’m about to fix shortly: $ perl -lwe 'close $x; Internals::SvREADONLY($x,1); I wasn’t trying to modify it. |
From @davidnicolso symbolic reference is out, then? $ perl -le '":FH:"=~/(\w\w)/ and open $1, ">&STDOUT"; print FH 99' That's going to stop working? On Tue, Aug 23, 2011 at 4:23 PM, Father Chrysostomos via RT <
-- |
From @cpansproutOn Tue Aug 23 14:23:57 2011, sprout wrote:
Now fixed with commit ce74145. |
Migrated from rt.perl.org#31767 (status was 'resolved')
Searchable as RT31767$
The text was updated successfully, but these errors were encountered: