at master 6.7 kB view raw
1From: =?UTF-8?q?Christian=20K=C3=B6gler?= <ck3d@gmx.de> 2Date: Mon, 10 Apr 2023 22:12:24 +0200 3Subject: [PATCH] miniperl compatible modules 4 5CPAN::Meta 6ExtUtils::MakeMaker 7JSON::PP 8Data::Dumper 9 10Updated for perl v5.40.0 by marcus@means.no 11 12--- 13 14 # safe if given an unblessed reference 15diff --git a/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm b/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm 16index 746abd63bc..c55d7cd2d0 100644 17--- a/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm 18+++ b/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm 19@@ -1,6 +1,7 @@ 20 use 5.008001; # sane UTF-8 support 21 use strict; 22 use warnings; 23+no warnings 'experimental::builtin'; 24 package CPAN::Meta::YAML; # git description: v1.68-2-gcc5324e 25 # XXX-INGY is 5.8.1 too old/broken for utf8? 26 # XXX-XDG Lancaster consensus was that it was sufficient until 27@@ -650,27 +651,29 @@ sub _dump_string { 28 join '', map { "$_\n" } @lines; 29 } 30 31-sub _has_internal_string_value { 32+# taken from cpan/JSON-PP/lib/JSON/PP.pm 33+sub _looks_like_number { 34 my $value = shift; 35- my $b_obj = B::svref_2object(\$value); # for round trip problem 36- return $b_obj->FLAGS & B::SVf_POK(); 37+ no warnings 'numeric'; 38+ # if the utf8 flag is on, it almost certainly started as a string 39+ return if utf8::is_utf8($value); 40+ # detect numbers 41+ # string & "" -> "" 42+ # number & "" -> 0 (with warning) 43+ # nan and inf can detect as numbers, so check with * 0 44+ return unless length((my $dummy = "") & $value); 45+ return unless 0 + $value eq $value; 46+ return 1 if $value * 0 == 0; 47+ return -1; # inf/nan 48 } 49 50 sub _dump_scalar { 51 my $string = $_[1]; 52 my $is_key = $_[2]; 53- # Check this before checking length or it winds up looking like a string! 54- my $has_string_flag = _has_internal_string_value($string); 55 return '~' unless defined $string; 56 return "''" unless length $string; 57- if (Scalar::Util::looks_like_number($string)) { 58- # keys and values that have been used as strings get quoted 59- if ( $is_key || $has_string_flag ) { 60- return qq['$string']; 61- } 62- else { 63- return $string; 64- } 65+ if (_looks_like_number($string)) { 66+ return qq['$string']; 67 } 68 if ( $string =~ /[\x00-\x09\x0b-\x0d\x0e-\x1f\x7f-\x9f\'\n]/ ) { 69 $string =~ s/\\/\\\\/g; 70@@ -800,9 +803,6 @@ sub errstr { 71 # Helper functions. Possibly not needed. 72 73 74-# Use to detect nv or iv 75-use B; 76- 77 # XXX-INGY Is flock CPAN::Meta::YAML's responsibility? 78 # Some platforms can't flock :-( 79 # XXX-XDG I think it is. When reading and writing files, we ought 80@@ -822,35 +822,8 @@ sub _can_flock { 81 } 82 } 83 84- 85-# XXX-INGY Is this core in 5.8.1? Can we remove this? 86-# XXX-XDG Scalar::Util 1.18 didn't land until 5.8.8, so we need this 87-##################################################################### 88-# Use Scalar::Util if possible, otherwise emulate it 89- 90-use Scalar::Util (); 91 BEGIN { 92- local $@; 93- if ( eval { Scalar::Util->VERSION(1.18); } ) { 94- *refaddr = *Scalar::Util::refaddr; 95- } 96- else { 97- eval <<'END_PERL'; 98-# Scalar::Util failed to load or too old 99-sub refaddr { 100- my $pkg = ref($_[0]) or return undef; 101- if ( !! UNIVERSAL::can($_[0], 'can') ) { 102- bless $_[0], 'Scalar::Util::Fake'; 103- } else { 104- $pkg = undef; 105- } 106- "$_[0]" =~ /0x(\w+)/; 107- my $i = do { no warnings 'portable'; hex $1 }; 108- bless $_[0], $pkg if defined $pkg; 109- $i; 110-} 111-END_PERL 112- } 113+ *refaddr = *builtin::refaddr; 114 } 115 116 delete $CPAN::Meta::YAML::{refaddr}; 117diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm 118index 3604eae402..991f69d275 100644 119--- a/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm 120+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm 121@@ -1,12 +1,13 @@ 122 use strict; 123 use warnings; 124+no warnings 'experimental::builtin'; 125 126 package CPAN::Meta::Merge; 127 128 our $VERSION = '2.150010'; 129 130 use Carp qw/croak/; 131-use Scalar::Util qw/blessed/; 132+use builtin qw/blessed/; 133 use CPAN::Meta::Converter 2.141170; 134 135 sub _is_identical { 136diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm 137index d4e93fd8a5..809da68d02 100644 138--- a/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm 139+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm 140@@ -1,6 +1,7 @@ 141 use 5.006; 142 use strict; 143 use warnings; 144+no warnings 'experimental::builtin'; 145 package CPAN::Meta::Prereqs; 146 147 our $VERSION = '2.150010'; 148@@ -14,7 +15,6 @@ our $VERSION = '2.150010'; 149 #pod =cut 150 151 use Carp qw(confess); 152-use Scalar::Util qw(blessed); 153 use CPAN::Meta::Requirements 2.121; 154 155 #pod =method new 156@@ -168,7 +168,12 @@ sub types_in { 157 sub with_merged_prereqs { 158 my ($self, $other) = @_; 159 160- my @other = blessed($other) ? $other : @$other; 161+ eval 'require Scalar::Util'; 162+ my @other = unless($@){ 163+ Scalar::Util::blessed($other) ? $other : @$other; 164+ }else{ 165+ builtin::blessed($other) ? $other : @$other; 166+ } 167 168 my @prereq_objs = ($self, @other); 169 170diff --git a/cpan/JSON-PP/lib/JSON/PP.pm b/cpan/JSON-PP/lib/JSON/PP.pm 171index fc8fcbc8f0..cda7b90c65 100644 172--- a/cpan/JSON-PP/lib/JSON/PP.pm 173+++ b/cpan/JSON-PP/lib/JSON/PP.pm 174@@ -4,6 +4,7 @@ package JSON::PP; 175 176 use 5.008; 177 use strict; 178+no warnings 'experimental::builtin'; 179 180 use Exporter (); 181 BEGIN { our @ISA = ('Exporter') } 182diff --git a/dist/Data-Dumper/Dumper.pm b/dist/Data-Dumper/Dumper.pm 183index bb6d3caedb..0c2fde4743 100644 184--- a/dist/Data-Dumper/Dumper.pm 185+++ b/dist/Data-Dumper/Dumper.pm 186@@ -11,6 +11,7 @@ package Data::Dumper; 187 188 use strict; 189 use warnings; 190+no warnings 'experimental::builtin'; 191 192 #$| = 1; 193 194@@ -125,8 +126,7 @@ sub new { 195 # Packed numeric addresses take less memory. Plus pack is faster than sprintf 196 197 sub format_refaddr { 198- require Scalar::Util; 199- pack "J", Scalar::Util::refaddr(shift); 200+ pack "J", builtin::refaddr(shift); 201 }; 202 203 # 204@@ -282,9 +282,8 @@ sub _dump { 205 warn "WARNING(Freezer method call failed): $@" if $@; 206 } 207 208- require Scalar::Util; 209- my $realpack = Scalar::Util::blessed($val); 210- my $realtype = $realpack ? Scalar::Util::reftype($val) : ref $val; 211+ my $realpack = builtin::blessed($val); 212+ my $realtype = $realpack ? builtin::reftype($val) : ref $val; 213 $id = format_refaddr($val); 214 215 # Note: By this point $name is always defined and of non-zero length. 216@@ -576,7 +575,7 @@ sub _dump { 217 # here generates a different result. So there are actually "three" different 218 # implementations of Data::Dumper (kind of sort of) but we only test two. 219 elsif (!defined &_vstring 220- and ref $ref eq 'VSTRING' || eval{Scalar::Util::isvstring($val)}) { 221+ and ref $ref eq 'VSTRING') { 222 $out .= sprintf "v%vd", $val; 223 } 224 # \d here would treat "1\x{660}" as a safe decimal number