On Mon, Aug 22, 2005 at 07:15:38AM -0700, Steve Peters via RT wrote: > > [EMAIL PROTECTED] - Fri Aug 12 18:18:40 2005]: > > plover% perl -wle '$x="pq"; print readdir $x' > > Bad symbol for filehandle at -e line 1. > > > > But it should be > > > > Bad symbol for dirhandle at -e line 1. > > > > A heuristic. What does Klortho say about that... > > #11953 Of course, this is a heuristic, which is a fancy way of saying > that it doesn't work.
I don't see this as a heuristic. > This error message above comes from the following code in gv.c > > GV * > Perl_gv_IOadd(pTHX_ register GV *gv) > { > if (!gv || SvTYPE((SV*)gv) != SVt_PVGV) > Perl_croak(aTHX_ "Bad symbol for filehandle"); This function could be modified to take an extra arg indicating whether the warning should say "filehandle" or "dirhandle". > if (!GvIOp(gv)) { > #ifdef GV_UNIQUE_CHECK > if (GvUNIQUE(gv)) { > Perl_croak(aTHX_ "Bad symbol for filehandle (GV is unique)"); > } > #endif > GvIOp(gv) = newIO(); > } > return gv; > } > > Unfortunately, it assumes all typeglobs are filehandles. That means the > following code works, well prints nothing at least, without warning. > > perl -Mstrict -wle 'my $x="pq"; *X = $x; print readdir X' If you want a warning here then it should be a different one because X is not a bad symbol. It should be more like readdir() on unopened dirhandle I'm not sure why readdir doesn't have this warning but I'm pretty sure this has come up before. -- Rick Delaney [EMAIL PROTECTED]