$body = $method;
}
-
- my ( $current_package, $current_name ) = Class::MOP::get_code_info($body);
-
- if ( !defined $current_name || $current_name eq '__ANON__' ) {
- my $full_method_name = ($self->name . '::' . $method_name);
- subname($full_method_name => $body);
- }
-
$self->add_package_symbol(
{ sigil => '&', type => 'CODE', name => $method_name },
$body,
gv = gv_fetchpv(fq_name, ix | (flags & GLOB_CREATE ? GV_ADDMULTI : 0), type);
}
-
+ assert(isGV_with_GP(gv));
if(SvOK(ref)){ /* add_package_symbol with a value */
GvCV(gv) = NULL;
}
sv_setsv_mg((SV*)gv, ref); /* *glob = $ref */
+
+ if(type == SVt_PVCV){
+ CV* const subr = (CV*)SvRV(ref);
+ if(CvANON(subr)
+ && CvGV(subr)
+ && isGV(CvGV(subr))
+ && strEQ(GvNAME(CvGV(subr)), "__ANON__")){
+ CvGV(subr) = gv;
+ CvANON_off(subr);
+ }
+ }
RETVAL = ref;
}
else { /* no values */