This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Allow bareword file handle as argument to chdir().
[perl5.git] / pp_sys.c
index fdda730..1659888 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3293,7 +3293,10 @@ PP(pp_chdir)
 
     if( MAXARG == 1 ) {
        SV * const sv = POPs;
-        if (SvTYPE(sv) == SVt_PVGV) {
+       if (PL_op->op_flags & OPf_SPECIAL) {
+           gv = gv_fetchsv(sv, 0, SVt_PVIO);
+       }
+        else if (SvTYPE(sv) == SVt_PVGV) {
            gv = (GV*)sv;
         }
        else if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVGV) {