[EMAIL PROTECTED] (Rick Myers) wrote:
>I would lean towards the second one since upload_test() is called
>similarly from three different places within request.t.
>
>The reasoning behind suggesting `while defined <FH>' was that the
>interaction with $_ appears to be unintentional, at least within the
>scope of upload_test(). We're basically throwing away the content of the
>file read anyway, so why not just eliminate the undesired setting of $_
>altogether. Also, there's no need to localize $_ since we aren't
>referencing it to do anything.
>
> for ( qw(perlfunc.pod perlpod.pod perlxs.pod), @binary) {
> upload_test($_);
> }
>
> sub upload_test {
> my $podfile = shift || "func";
> ...
> ++$lines while defined <FH>;
> }
>
>FWIW, adding defined() was the perldiag-suggested fix for the problem
>Ken was seeing. It also happens to fix the read-only error quite nicely
>in this particular situation.
Sounds good to me. But I still can't reproduce the original read-only error.
The following code runs just fine for me under 5.004 and 5.005:
@binary = "blah";
for ( qw(perlfunc.pod perlpod.pod perlxs.pod), @binary) {
upload_test($_);
}
sub upload_test {
++$lines while <STDIN>;
}
The only funny business is that <STDIN> clobbers $_, so that the various
values iterated through in the for() loop all eventually get set to
undef.
------------------- -------------------
Ken Williams Last Bastion of Euclidity
[EMAIL PROTECTED] The Math Forum