[tpm] Filehandle $fh opened only for output at ....
Tom Legrady
legrady at gmail.com
Wed May 3 16:40:30 PDT 2017
Unfortunately at the moment I am unable to log onto the machine the file
is copied to, so I cannot show that it grows to hugeity. Later this
week, perhaps.
Tom
On 2017-05-03 05:21 PM, zoffix at zoffix.com wrote:
>
> Quoting Shlomi Fish <shlomif at shlomifish.org>:
>> Hi Zoffix and Tom!
>
> \o Didn't expect you to follow Toronto's list :)
>
>>>> As I recall the idiom is `while (defined(my $foo = <$fh>))`
>
> I think I sidetracked the discussion with that comment :)
>
> I highly doubt the `defined` is the cause of the issue or that perl
> would be lying about the handle not being opened for writing. Likely
> the handle is re-opened by some adjacent code or file handle's
> variable accidentally reused in another open, like passed via a sub,
> for example.
>
> $ perl -we 'open my $fh, "<", "foo"; open $fh, ">", "foo"; <$fh>'
> Filehandle $fh opened only for output at -e line 1.
>
> $ perl -we 'sub foo { open $_[0], ">", "foo"; }; open my $fh, "<",
> "foo"; foo $fh; <$fh>'
> Filehandle $fh opened only for output at -e line 1.
>
> Perhaps the OP can provide a larger piece of code; something that
> traces the life of $fh.
> _______________________________________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/listinfo/toronto-pm
More information about the toronto-pm
mailing list