IoDIRP(datasv) = (DIR*)funcp; /* stash funcp into spare field */
if (filter_debug)
warn("filter_add func %lx (%s)", funcp, SvPV(datasv,na));
- av_push(rsfp_filters, datasv);
+ av_unshift(rsfp_filters, 1);
+ av_store(rsfp_filters, 0, datasv) ;
return(datasv);
}
if (!rsfp_filters || AvFILL(rsfp_filters)<0)
return;
/* if filter is on top of stack (usual case) just pop it off */
- if (IoDIRP(FILTER_DATA(AvFILL(rsfp_filters))) == (void*)funcp){
- sv_free(av_pop(rsfp_filters));
+ if (IoDIRP(FILTER_DATA(0)) == (void*)funcp){
+ /* sv_free(av_pop(rsfp_filters)); */
+ sv_free(av_shift(rsfp_filters));
+
return;
}
/* we need to search for the correct entry and clear it */
{
filter_t funcp;
SV *datasv = NULL;
+
if (!rsfp_filters)
return -1;
if (idx > AvFILL(rsfp_filters)){ /* Any more filters? */
/* Provide a default input filter to make life easy. */
/* Note that we append to the line. This is handy. */
- /* We ignore maxlen here */
if (filter_debug)
warn("filter_read %d: from rsfp\n", idx);
if (maxlen) {
/* If not a declared subroutine, it's an indirect object. */
/* (But it's an indir obj regardless for sort.) */
- if (last_lop_op == OP_SORT ||
- (!immediate_paren && (!gv || !GvCV(gv))) ) {
+ if ((last_lop_op == OP_SORT ||
+ (!immediate_paren && (!gv || !GvCV(gv))) ) &&
+ (last_lop_op != OP_MAPSTART && last_lop_op != OP_GREPSTART)){
expect = (last_lop == oldoldbufptr) ? XTERM : XOPERATOR;
goto bareword;
}
TERM(THING);
}
+ case KEY___DATA__:
case KEY___END__: {
GV *gv;
/*SUPPRESS 560*/
- if (!in_eval) {
- gv = gv_fetchpv("main::DATA",TRUE, SVt_PVIO);
+ if (!in_eval || tokenbuf[2] == 'D') {
+ char dname[256];
+ char *pname = "main";
+ if (tokenbuf[2] == 'D')
+ pname = HvNAME(curstash ? curstash : defstash);
+ sprintf(dname,"%s::DATA", pname);
+ gv = gv_fetchpv(dname,TRUE, SVt_PVIO);
SvMULTI_on(gv);
if (!GvIO(gv))
GvIOp(gv) = newIO();
if (d[1] == '_') {
if (strEQ(d,"__LINE__")) return -KEY___LINE__;
if (strEQ(d,"__FILE__")) return -KEY___FILE__;
+ if (strEQ(d,"__DATA__")) return KEY___DATA__;
if (strEQ(d,"__END__")) return KEY___END__;
}
break;
sv_upgrade((SV *)compcv, SVt_PVCV);
comppad = newAV();
- SAVEFREESV((SV*)comppad);
comppad_name = newAV();
- SAVEFREESV((SV*)comppad_name);
comppad_name_fill = 0;
min_intro_pending = 0;
av_push(comppad, Nullsv);
comppadlist = newAV();
AvREAL_off(comppadlist);
- av_store(comppadlist, 0, SvREFCNT_inc((SV*)comppad_name));
- av_store(comppadlist, 1, SvREFCNT_inc((SV*)comppad));
+ av_store(comppadlist, 0, (SV*)comppad_name);
+ av_store(comppadlist, 1, (SV*)comppad);
CvPADLIST(compcv) = comppadlist;
CvOUTSIDE(compcv) = (CV*)SvREFCNT_inc((SV*)outsidecv);