$| = 1;
BEGIN { require './test.pl' }
-plan tests => 4942;
+plan tests => 4980;
use Scalar::Util qw(tainted);
sub iter { my ($x) = @_; return undef if $$x < 0; return $$x--; }
}
-# XXX iterator overload not intended to work with CORE::GLOBAL?
-if (defined &CORE::GLOBAL::glob) {
- is('1', '1');
- is('1', '1');
- is('1', '1');
-}
-else {
+{
my $iter = iterator->new(5);
my $acc = '';
my $out;
push @tests, [ \*RT57012A, '*RT57012B = *{%s}; our $RT57012B',
'(*{})', undef, [ 1, 1, 0 ], 0 ];
- # XXX TODO: '<>'
+ my $iter_text = ("some random text\n" x 100) . $^X;
+ open my $iter_fh, '<', \$iter_text
+ or die "open of \$iter_text gave ($!)\n";
+ $subs{'<>'} = '<$iter_fh>';
+ push @tests, [ $iter_fh, '<%s>', '(<>)', undef, [ 1, 1, 0 ], 1 ];
# eval should do tie, overload on its arg before checking taint */
push @tests, [ '1;', 'eval q(eval %s); $@ =~ /Insecure/',
"<$plain_term> taint of expected return");
for my $ov_pkg (qw(RT57012_OV RT57012_OV_FB)) {
- # the deref ops don't support fallback
next if $ov_pkg eq 'RT57012_OV_FB'
and not defined $exp_fb_funcs;
my ($exp_fetch_a, $exp_fetch_s, $exp_store) =
$ta[0] = bless [ $tainted_val ], $ov_pkg;
my $oload = bless [ $tainted_val ], $ov_pkg;
- for my $var ('$ta[0]', '$ts', '$oload') {
+ for my $var ('$ta[0]', '$ts', '$oload',
+ ($sub_term eq '<%s>' ? '${ts}' : ())
+ ) {
$funcs = '';
$fetches = 0;
* \ null - const(wildcard) - const(ix)
*/
o->op_flags |= OPf_SPECIAL;
+ o->op_targ = pad_alloc(OP_GLOB, SVs_PADTMP);
op_append_elem(OP_GLOB, o,
newSVOP(OP_CONST, 0, newSViv(PL_glob_index++)));
o = newLISTOP(OP_LIST, 0, o, NULL);
/* No longer used in core. Use AMG_CALLunary instead */
#define AMG_CALLun(sv,meth) AMG_CALLunary(sv, CAT2(meth,_amg))
-#define tryAMAGICunTARGET(meth, shift) \
+#define tryAMAGICunTARGET(meth, shift, jump) \
STMT_START { \
dSP; \
sp--; /* get TARGET from below PL_stack_sp */ \
if (opASSIGN) \
sp--; \
SETTARG; \
- RETURN; \
+ PUTBACK; \
+ if (jump) { \
+ PL_markstack_ptr--; \
+ return NORMAL->op_next->op_next; \
+ } \
+ return NORMAL; \
} \
} \
} STMT_END
{
dVAR;
OP *result;
+ dSP;
+ /* make a copy of the pattern, to ensure that magic is called once
+ * and only once */
+ TOPm1s = sv_2mortal(newSVsv(TOPm1s));
+
+ tryAMAGICunTARGET(iter_amg, -1, (PL_op->op_flags & OPf_SPECIAL));
if (PL_op->op_flags & OPf_SPECIAL) {
/* call Perl-level glob function instead. Stack args are:
}
/* stack args are: wildcard, gv(_GEN_n) */
- tryAMAGICunTARGET(iter_amg, -1);
/* Note that we only ever get here if File::Glob fails to load
* without at the same time croaking, for some reason, or if