&& (this_regex = (REGEXP*) This) \
&& (Other = d)) )
-
-# define SM_OBJECT ( \
- (sv_isobject(d) && (SvTYPE(SvRV(d)) != SVt_REGEXP)) \
- || \
- (sv_isobject(e) && (SvTYPE(SvRV(e)) != SVt_REGEXP)) ) \
-
# define SM_OTHER_REF(type) \
(SvROK(Other) && SvTYPE(SvRV(Other)) == SVt_##type)
sv_2mortal(newSViv(PTR2IV(sv))), 0)
tryAMAGICbinSET(smart, 0);
-
+
SP -= 2; /* Pop the values */
/* Take care only to invoke mg_get() once for each argument.
if (SvGMAGICAL(e))
e = sv_mortalcopy(e);
- if (SM_OBJECT) {
- if (!SvOK(d) || !SvOK(e))
+ if (!SvOK(e)) {
+ if (SvOK(d))
RETPUSHNO;
else
- Perl_croak(aTHX_ "Smart matching a non-overloaded object breaks encapsulation");
+ RETPUSHYES;
}
+ if ((sv_isobject(d) && (SvTYPE(SvRV(d)) != SVt_REGEXP))
+ || (sv_isobject(e) && (SvTYPE(SvRV(e)) != SVt_REGEXP)))
+ Perl_croak(aTHX_ "Smart matching a non-overloaded object breaks encapsulation");
+
if (SM_REF(PVCV)) {
I32 c;
ENTER;
RETPUSHNO;
}
}
- else if (!SvOK(d) || !SvOK(e)) {
- if (!SvOK(d) && !SvOK(e))
- RETPUSHYES;
- else
- RETPUSHNO;
- }
else if (SM_REGEX) {
PMOP * const matcher = make_matcher(this_regex);
is($ok, 1, "Given(0) when($undef++)");
}
{
- my $ok = 1;
- given (undef) { when(0) {$ok = 0} }
+ no warnings "uninitialized";
+ my $ok = 0;
+ given (undef) { when(0) {$ok = 1} }
is($ok, 1, "Given(undef) when(0)");
}
{
+ no warnings "uninitialized";
my $undef;
- my $ok = 1;
- given ($undef) { when(0) {$ok = 0} }
+ my $ok = 0;
+ given ($undef) { when(0) {$ok = 1} }
is($ok, 1, 'Given($undef) when(0)');
}
########
is($ok, 1, 'Given("") when($undef)');
}
{
- my $ok = 1;
- given (undef) { when("") {$ok = 0} }
+ no warnings "uninitialized";
+ my $ok = 0;
+ given (undef) { when("") {$ok = 1} }
is($ok, 1, 'Given(undef) when("")');
}
{
+ no warnings "uninitialized";
my $undef;
- my $ok = 1;
- given ($undef) { when("") {$ok = 0} }
+ my $ok = 0;
+ given ($undef) { when("") {$ok = 1} }
is($ok, 1, 'Given($undef) when("")');
}
########
my $ok;
$v = undef;
is($f->count(), 0, "Sanity check: $test_name");
+ no warnings "uninitialized";
given(my $undef) {
when(sub{0}->()) {}
when("21") {}