summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-08-21 10:57:34 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-08-25 14:22:20 -0700
commitc2f922f11b8978a4eea0e0d28626dd3c1f6eaba7 (patch)
tree3fd3855c5f37c62bc93923780a8f41c49486cb25 /pp.c
parentf6a1686942506c3f2a041ff124bdc34d22ed5f26 (diff)
downloadperl-c2f922f11b8978a4eea0e0d28626dd3c1f6eaba7.tar.gz
&CORE::bless()
This commit allows &CORE::bless to be called through references and via ampersand syntax. pp_bless is modified to take into account the nulls pushed on to the stack in pp_coreargs, since pp_coreargs has no other way to tell bless how many arguments it’s actually getting.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/pp.c b/pp.c
index 302b5cc37e..04e4e4afd8 100644
--- a/pp.c
+++ b/pp.c
@@ -590,13 +590,15 @@ PP(pp_bless)
HV *stash;
if (MAXARG == 1)
+ curstash:
stash = CopSTASH(PL_curcop);
else {
SV * const ssv = POPs;
STRLEN len;
const char *ptr;
- if (ssv && !SvGMAGICAL(ssv) && !SvAMAGIC(ssv) && SvROK(ssv))
+ if (!ssv) goto curstash;
+ if (!SvGMAGICAL(ssv) && !SvAMAGIC(ssv) && SvROK(ssv))
Perl_croak(aTHX_ "Attempt to bless into a reference");
ptr = SvPV_const(ssv,len);
if (len == 0)