@@ -1570,18 +1570,7 @@ Perl_call_method(pTHX_ const char *methname, I32 flags)
1570
1570
/* name of the subroutine */
1571
1571
/* See G_* flags in cop.h */
1572
1572
{
1573
- dSP ;
1574
- OP myop ;
1575
- if (!PL_op ) {
1576
- Zero (& myop , 1 , OP );
1577
- PL_op = & myop ;
1578
- }
1579
- XPUSHs (sv_2mortal (newSVpv (methname ,0 )));
1580
- PUTBACK ;
1581
- pp_method ();
1582
- if (PL_op == & myop )
1583
- PL_op = Nullop ;
1584
- return call_sv (* PL_stack_sp -- , flags );
1573
+ return call_sv (sv_2mortal (newSVpv (methname ,0 )), flags | G_METHOD );
1585
1574
}
1586
1575
1587
1576
/* May be called with any of a CV, a GV, or an SV containing the name. */
@@ -1601,6 +1590,7 @@ Perl_call_sv(pTHX_ SV *sv, I32 flags)
1601
1590
{
1602
1591
dSP ;
1603
1592
LOGOP myop ; /* fake syntax tree node */
1593
+ UNOP method_op ;
1604
1594
I32 oldmark ;
1605
1595
I32 retval ;
1606
1596
I32 oldscope ;
@@ -1638,6 +1628,14 @@ Perl_call_sv(pTHX_ SV *sv, I32 flags)
1638
1628
&& !(flags & G_NODEBUG ))
1639
1629
PL_op -> op_private |= OPpENTERSUB_DB ;
1640
1630
1631
+ if (flags & G_METHOD ) {
1632
+ Zero (& method_op , 1 , UNOP );
1633
+ method_op .op_next = PL_op ;
1634
+ method_op .op_ppaddr = PL_ppaddr [OP_METHOD ];
1635
+ myop .op_ppaddr = PL_ppaddr [OP_ENTERSUB ];
1636
+ PL_op = & method_op ;
1637
+ }
1638
+
1641
1639
if (!(flags & G_EVAL )) {
1642
1640
CATCH_SET (TRUE);
1643
1641
call_body ((OP * )& myop , FALSE);
@@ -1655,7 +1653,7 @@ Perl_call_sv(pTHX_ SV *sv, I32 flags)
1655
1653
ENTER ;
1656
1654
SAVETMPS ;
1657
1655
1658
- push_return (PL_op -> op_next );
1656
+ push_return (Nullop );
1659
1657
PUSHBLOCK (cx , (CXt_EVAL |CXp_TRYBLOCK ), PL_stack_sp );
1660
1658
PUSHEVAL (cx , 0 , 0 );
1661
1659
PL_eval_root = PL_op ; /* Only needed so that goto works right. */
0 commit comments