diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2011-09-12 19:44:07 +0100 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2011-09-12 20:39:01 +0100 |
commit | 53b10071adc2e67f88bbc0d32e2dc6f982598c98 (patch) | |
tree | a91d1e47bf7c93c95bd80f223630c2ae20a78a56 /cpan/CPAN-Meta-YAML | |
parent | f87cd9fa1ebcc853dbe704413ca1e72118e57151 (diff) | |
download | perl-53b10071adc2e67f88bbc0d32e2dc6f982598c98.tar.gz |
Update CPAN-Meta-YAML to CPAN version 0.004
[DELTA]
0.004 2011-09-06 09:42:52 America/New_York
- Generated from ADAMK/YAML-Tiny-1.50.tar.gz
Diffstat (limited to 'cpan/CPAN-Meta-YAML')
-rw-r--r-- | cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm | 38 | ||||
-rw-r--r-- | cpan/CPAN-Meta-YAML/t/03_regression.t | 15 |
2 files changed, 44 insertions, 9 deletions
diff --git a/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm b/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm index 2e94a18084..1b1ae99578 100644 --- a/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm +++ b/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm @@ -1,6 +1,6 @@ package CPAN::Meta::YAML; -BEGIN { - $CPAN::Meta::YAML::VERSION = '0.003'; +{ + $CPAN::Meta::YAML::VERSION = '0.004'; } use strict; @@ -459,7 +459,7 @@ sub _write_scalar { $string =~ s/([\x00-\x1f])/\\$UNPRINTABLE[ord($1)]/g; return qq|"$string"|; } - if ( $string =~ /(?:^\W|\s)/ or $QUOTE{$string} ) { + if ( $string =~ /(?:^\W|\s|:\z)/ or $QUOTE{$string} ) { return "'$string'"; } return $string; @@ -610,12 +610,13 @@ sub LoadFile { # Use Scalar::Util if possible, otherwise emulate it BEGIN { + local $@; eval { require Scalar::Util; - *refaddr = *Scalar::Util::refaddr; }; - eval <<'END_PERL' if $@; -# Failed to load Scalar::Util + if ( $@ or $Scalar::Util::VERSION < 1.18 ) { + eval <<'END_PERL' if $@; +# Scalar::Util failed to load or too old sub refaddr { my $pkg = ref($_[0]) or return undef; if ( !! UNIVERSAL::can($_[0], 'can') ) { @@ -629,7 +630,9 @@ sub refaddr { $i; } END_PERL - + } else { + *refaddr = *Scalar::Util::refaddr; + } } 1; @@ -644,7 +647,7 @@ CPAN::Meta::YAML - Read and write a subset of YAML for CPAN Meta files =head1 VERSION -version 0.003 +version 0.004 =head1 SYNOPSIS @@ -682,6 +685,25 @@ L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=YAML-Tiny> L<YAML::Tiny>, L<YAML>, L<YAML::XS> +=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders + +=head1 SUPPORT + +=head2 Bugs / Feature Requests + +Please report any bugs or feature requests by email to C<bug-cpan-meta-yaml at rt.cpan.org>, or through +the web interface at L<http://rt.cpan.org/Public/Dist/Display.html?Name=CPAN-Meta-YAML>. You will be automatically notified of any +progress on the request by the system. + +=head2 Source Code + +This is open source software. The code repository is available for +public review and contribution under the terms of the license. + +L<http://github.com/dagolden/cpan-meta-yaml> + + git clone http://github.com/dagolden/cpan-meta-yaml + =head1 AUTHORS =over 4 diff --git a/cpan/CPAN-Meta-YAML/t/03_regression.t b/cpan/CPAN-Meta-YAML/t/03_regression.t index 27a7519ba5..8fae7e4ba2 100644 --- a/cpan/CPAN-Meta-YAML/t/03_regression.t +++ b/cpan/CPAN-Meta-YAML/t/03_regression.t @@ -10,7 +10,7 @@ BEGIN { use File::Spec::Functions ':ALL'; use t::lib::Test; -use Test::More tests(37, 0, 12); +use Test::More tests(37, 0, 13); use CPAN::Meta::YAML qw{ Load Dump LoadFile DumpFile @@ -701,3 +701,16 @@ is_deeply( CPAN::Meta::YAML->new( [ qw{ - 'Off' - 'OFF' END_YAML + + + + + +###################################################################### +# Always quote for scalars ending with : + +is_deeply( + CPAN::Meta::YAML->new( [ 'A:' ] )->write_string, + "---\n- 'A:'\n", + 'Simple scalar ending in a colon is correctly quoted', +); |