diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-09-17 23:18:08 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-09-17 23:20:26 -0700 |
commit | 8561ea1dd1a3357825e765e1df4f883e53f89a9d (patch) | |
tree | fd16385d6265ed60c2ceb1e718f0c37d0ec14d0c /mg.c | |
parent | 79bffe477e0016f596b86950244ad3a10a753e58 (diff) | |
download | perl-8561ea1dd1a3357825e765e1df4f883e53f89a9d.tar.gz |
${^LAST_FH}
This was brought up in ticket #96672.
This variable gives access to the last-read filehandle that Perl uses
when it appends ", <STDIN> line 1" to a warning or error message.
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -906,6 +906,20 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) case '\011': /* ^I */ /* NOT \t in EBCDIC */ sv_setpv(sv, PL_inplace); /* Will undefine sv if PL_inplace is NULL */ break; + case '\014': /* ^LAST_FH */ + if (strEQ(remaining, "AST_FH")) { + if (PL_last_in_gv) { + assert(isGV_with_GP(PL_last_in_gv)); + SV_CHECK_THINKFIRST_COW_DROP(sv); + prepare_SV_for_RV(sv); + SvOK_off(sv); + SvRV_set(sv, SvREFCNT_inc_simple_NN(PL_last_in_gv)); + SvROK_on(sv); + sv_rvweaken(sv); + } + else sv_setsv_nomg(sv, NULL); + } + break; case '\017': /* ^O & ^OPEN */ if (nextchar == '\0') { sv_setpv(sv, PL_osname); |