diff --git a/lib/B/C.pm b/lib/B/C.pm index c7e3b40aa..ccbb76280 100644 --- a/lib/B/C.pm +++ b/lib/B/C.pm @@ -345,6 +345,11 @@ BEGIN { eval q[sub SVt_PVGV() {13}]; eval q[sub CVf_WEAKOUTSIDE() { 0x0 }]; # unused } + if ($] >= 5.008005) { + B->import(qw(SVs_PADSTALE)); # added with 5.8.5 + } else { + eval q[sub SVs_PADSTALE() {0x0}]; # unused + } if ($] >= 5.010) { #require mro; # mro->import(); # not exported: @@ -4210,9 +4215,15 @@ sub B::CV::save { # XXX how is ANON with CONST handled? CONST uses XSUBANY [GH #246] if ($isconst and !is_phase_name($cvname) and - ( ($PERL522 and !($CvFLAGS & (CVf_ANONCONST|CVf_CONST))) - or (!$PERL522 and !($CvFLAGS & CVf_ANON)) ) - ) # skip const magic blocks (Attribute::Handlers) + ( + ( + $PERL522 + and !( $CvFLAGS & SVs_PADSTALE ) + and !( $CvFLAGS & CVf_WEAKOUTSIDE ) + and !( $fullname && $fullname =~ qr{^File::Glob::GLOB} and ( $CvFLAGS & (CVf_ANONCONST|CVf_CONST) ) ) + ) + or (!$PERL522 and !($CvFLAGS & CVf_ANON)) ) + ) # skip const magic blocks (Attribute::Handlers) { my $stash = $gv->STASH; #warn sprintf("$cvstashname\::$cvname 0x%x -> XSUBANY", $CvFLAGS) if $debug{cv};