summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pp.c13
-rw-r--r--pp_hot.c7
-rw-r--r--t/op/tie.t12
3 files changed, 15 insertions, 17 deletions
diff --git a/pp.c b/pp.c
index fa20914f70..d6e3132fe6 100644
--- a/pp.c
+++ b/pp.c
@@ -139,6 +139,7 @@ PP(pp_rv2gv)
{
dVAR; dSP; dTOPss;
+ SvGETMAGIC(sv);
if (SvROK(sv)) {
wasref:
tryAMAGICunDEREF(to_gv);
@@ -156,11 +157,6 @@ PP(pp_rv2gv)
}
else {
if (!isGV_with_GP(sv)) {
- if (SvGMAGICAL(sv)) {
- mg_get(sv);
- if (SvROK(sv))
- goto wasref;
- }
if (!SvOK(sv) && sv != &PL_sv_undef) {
/* If this is a 'my' scalar and flag is set then vivify
* NI-S 1999/05/07
@@ -276,8 +272,8 @@ PP(pp_rv2sv)
dVAR; dSP; dTOPss;
GV *gv = NULL;
+ SvGETMAGIC(sv);
if (SvROK(sv)) {
- wasref:
tryAMAGICunDEREF(to_sv);
sv = SvRV(sv);
@@ -295,11 +291,6 @@ PP(pp_rv2sv)
gv = MUTABLE_GV(sv);
if (!isGV_with_GP(gv)) {
- if (SvGMAGICAL(sv)) {
- mg_get(sv);
- if (SvROK(sv))
- goto wasref;
- }
gv = Perl_softref2xv(aTHX_ sv, "a SCALAR", SVt_PV, &sp);
if (!gv)
RETURN;
diff --git a/pp_hot.c b/pp_hot.c
index ea24062bc5..d5c13fecd9 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -820,8 +820,8 @@ PP(pp_rv2av)
const bool is_pp_rv2av = PL_op->op_type == OP_RV2AV;
const svtype type = is_pp_rv2av ? SVt_PVAV : SVt_PVHV;
+ SvGETMAGIC(sv);
if (SvROK(sv)) {
- wasref:
tryAMAGICunDEREF_var(is_pp_rv2av ? to_av_amg : to_hv_amg);
sv = SvRV(sv);
@@ -858,11 +858,6 @@ PP(pp_rv2av)
GV *gv;
if (!isGV_with_GP(sv)) {
- if (SvGMAGICAL(sv)) {
- mg_get(sv);
- if (SvROK(sv))
- goto wasref;
- }
gv = Perl_softref2xv(aTHX_ sv, is_pp_rv2av ? an_array : a_hash,
type, &sp);
if (!gv)
diff --git a/t/op/tie.t b/t/op/tie.t
index 5db6cfb859..281c0d97a0 100644
--- a/t/op/tie.t
+++ b/t/op/tie.t
@@ -840,6 +840,10 @@ fetching... <=> 1
{
package overloaded;
use overload
+ '*{}' => sub { print '*{}'; \*100 },
+ '@{}' => sub { print '@{}'; \@100 },
+ '%{}' => sub { print '%{}'; \%100 },
+ '${}' => sub { print '${}'; \$100 },
map {
my $op = $_;
$_ => sub { print "$op"; 100 }
@@ -868,6 +872,10 @@ $ghew=undef; $ghew<=1; print "\n";
$ghew=undef; $ghew >=1; print "\n";
$ghew=undef; $ghew != 1; print "\n";
$ghew=undef; $ghew<=>1; print "\n";
+$ghew=\*shrext; *$ghew; print "\n";
+$ghew=\@spled; @$ghew; print "\n";
+$ghew=\%frit; %$ghew; print "\n";
+$ghew=\$drile; $$ghew; print "\n";
EXPECT
fetching... +
fetching... **
@@ -885,3 +893,7 @@ fetching... <=
fetching... >=
fetching... !=
fetching... <=>
+fetching... *{}
+fetching... @{}
+fetching... %{}
+fetching... ${}