diff --git a/Kernel/cpan-lib/YAML.pm b/Kernel/cpan-lib/YAML.pm index 6d0f4ea6d9e..9e142837f65 100644 --- a/Kernel/cpan-lib/YAML.pm +++ b/Kernel/cpan-lib/YAML.pm @@ -1,5 +1,5 @@ package YAML; -our $VERSION = '1.20'; +our $VERSION = '1.23'; use YAML::Mo; @@ -7,8 +7,18 @@ use Exporter; push @YAML::ISA, 'Exporter'; our @EXPORT = qw{ Dump Load }; our @EXPORT_OK = qw{ freeze thaw DumpFile LoadFile Bless Blessed }; +our ( + $UseCode, $DumpCode, $LoadCode, + $SpecVersion, + $UseHeader, $UseVersion, $UseBlock, $UseFold, $UseAliases, + $Indent, $SortKeys, $Preserve, + $AnchorPrefix, $CompressSeries, $InlineSeries, $Purity, + $Stringify, $Numify +); + use YAML::Node; # XXX This is a temp fix for Module::Build +use Scalar::Util qw/ openhandle /; # XXX This VALUE nonsense needs to go. use constant VALUE => "\x07YAML\x07VALUE\x07"; @@ -44,7 +54,7 @@ sub Load { sub DumpFile { my $OUT; my $filename = shift; - if (ref $filename eq 'GLOB') { + if (openhandle $filename) { $OUT = $filename; } else { @@ -70,7 +80,7 @@ sub DumpFile { sub LoadFile { my $IN; my $filename = shift; - if (ref $filename eq 'GLOB') { + if (openhandle $filename) { $IN = $filename; } else { diff --git a/Kernel/cpan-lib/YAML/Any.pm b/Kernel/cpan-lib/YAML/Any.pm index af644f2d818..3afe8553832 100644 --- a/Kernel/cpan-lib/YAML/Any.pm +++ b/Kernel/cpan-lib/YAML/Any.pm @@ -1,6 +1,6 @@ use strict; use warnings; package YAML::Any; -our $VERSION = '1.20'; +our $VERSION = '1.23'; use Exporter (); diff --git a/Kernel/cpan-lib/YAML/Error.pm b/Kernel/cpan-lib/YAML/Error.pm index abf321d4fd9..1a258fc87f9 100644 --- a/Kernel/cpan-lib/YAML/Error.pm +++ b/Kernel/cpan-lib/YAML/Error.pm @@ -106,7 +106,7 @@ YAML_DUMP_ERR_BAD_REGEXP YAML_LOAD_ERR_BAD_MAP_ELEMENT Invalid element in map YAML_LOAD_WARN_DUPLICATE_KEY - Duplicate map key found. Ignoring. + Duplicate map key '%s' found. Ignoring. YAML_LOAD_ERR_BAD_SEQ_ELEMENT Invalid element in sequence YAML_PARSE_ERR_INLINE_MAP diff --git a/Kernel/cpan-lib/YAML/Loader.pm b/Kernel/cpan-lib/YAML/Loader.pm index f29f9a9ccef..cc31abe24f6 100644 --- a/Kernel/cpan-lib/YAML/Loader.pm +++ b/Kernel/cpan-lib/YAML/Loader.pm @@ -355,7 +355,7 @@ sub _parse_mapping { $self->_parse_next_line(COLLECTION); my $value = $self->_parse_node(); if (exists $mapping->{$key}) { - $self->warn('YAML_LOAD_WARN_DUPLICATE_KEY'); + $self->warn('YAML_LOAD_WARN_DUPLICATE_KEY', $key); } else { $mapping->{$key} = $value; @@ -454,6 +454,11 @@ sub _parse_inline { $node = $self->_parse_inline_simple(); } $node = $self->_parse_implicit($node) unless $explicit; + + if ($self->numify and defined $node and not ref $node and length $node + and $node =~ m/\A-?(?:0|[1-9][0-9]*)?(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?\z/) { + $node += 0; + } } if ($explicit) { $node = $self->_parse_explicit($node, $explicit); @@ -486,7 +491,7 @@ sub _parse_inline_mapping { unless $self->{inline} =~ s/^\: \s*//; my $value = $self->_parse_inline(); if (exists $node->{$key}) { - $self->warn('YAML_LOAD_WARN_DUPLICATE_KEY'); + $self->warn('YAML_LOAD_WARN_DUPLICATE_KEY', $key); } else { $node->{$key} = $value; @@ -638,7 +643,10 @@ sub _parse_next_line { $self->die('YAML_EMIT_ERR_BAD_LEVEL') unless defined $offset; shift @{$self->lines}; $self->eos($self->{done} = not @{$self->lines}); - return if $self->eos; + if ($self->eos) { + $self->offset->[$level + 1] = $offset + 1; + return; + } $self->{line}++; # Determine the offset for a new leaf node diff --git a/Kernel/cpan-lib/YAML/Loader/Base.pm b/Kernel/cpan-lib/YAML/Loader/Base.pm index 6558acdd921..334c5a69e97 100644 --- a/Kernel/cpan-lib/YAML/Loader/Base.pm +++ b/Kernel/cpan-lib/YAML/Loader/Base.pm @@ -20,12 +20,14 @@ has indent => default => sub {0}; has major_version => default => sub {0}; has minor_version => default => sub {0}; has inline => default => sub {''}; +has numify => default => sub {0}; sub set_global_options { my $self = shift; $self->load_code($YAML::LoadCode || $YAML::UseCode) if defined $YAML::LoadCode or defined $YAML::UseCode; - $self->preserve($YAML::Preserve) if defined $YAML::Preserve + $self->preserve($YAML::Preserve) if defined $YAML::Preserve; + $self->numify($YAML::Numify) if defined $YAML::Numify; } sub load {