diff options
author | Steve Peters <steve@fisharerojo.org> | 2006-01-03 14:58:21 +0000 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2006-01-03 14:58:21 +0000 |
commit | 8b5be85c6c6a87e2cf6fc80a9ccc8056a4d1bbf9 (patch) | |
tree | 6777f1c5f04dd177de845dfe15845afca8dacb98 | |
parent | 58103a2e295c15d87c7ce0bd8dd83d7e110adac4 (diff) | |
download | perl-8b5be85c6c6a87e2cf6fc80a9ccc8056a4d1bbf9.tar.gz |
Bad symbols that are pretending to be dirhandles, should say they
are dirhandles in their error messages.
p4raw-id: //depot/perl@26602
-rw-r--r-- | gv.c | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -73,8 +73,21 @@ Perl_gv_HVadd(pTHX_ register GV *gv) GV * Perl_gv_IOadd(pTHX_ register GV *gv) { - if (!gv || SvTYPE((SV*)gv) != SVt_PVGV) - Perl_croak(aTHX_ "Bad symbol for filehandle"); + if (!gv || SvTYPE((SV*)gv) != SVt_PVGV) { + + /* + * if it walks like a dirhandle, then let's assume that + * this is a dirhandle. + */ + const char *fh = PL_op->op_type == OP_READDIR || + PL_op->op_type == OP_TELLDIR || + PL_op->op_type == OP_SEEKDIR || + PL_op->op_type == OP_REWINDDIR || + PL_op->op_type == OP_CLOSEDIR ? + "dirhandle" : "filehandle"; + Perl_croak(aTHX_ "Bad symbol for %s", fh); + } + if (!GvIOp(gv)) { #ifdef GV_UNIQUE_CHECK if (GvUNIQUE(gv)) { |