diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2012-02-08 09:51:30 +0000 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2012-02-08 12:28:33 +0000 |
commit | a4a5e2bf376c447a0f259a4a8033781dfc6c46fa (patch) | |
tree | 2c60b16bfc333144cfcb3ffa3ee8da82597b24b3 /cpan/Parse-CPAN-Meta/lib | |
parent | ce09a8a1b524f8cb4818cc8d1da635553aefdafd (diff) | |
download | perl-a4a5e2bf376c447a0f259a4a8033781dfc6c46fa.tar.gz |
Update Parse-CPAN-Meta to CPAN version 1.4402
[DELTA]
1.4402 Tue Feb 07 2012
- Minor maintenance: standardized newlines to Unix style
Diffstat (limited to 'cpan/Parse-CPAN-Meta/lib')
-rw-r--r-- | cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm b/cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm index f7d717cdb1..04ac3e16a1 100644 --- a/cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm +++ b/cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm @@ -5,7 +5,7 @@ use Carp 'croak'; # UTF Support? sub HAVE_UTF8 () { $] >= 5.007003 } -sub IO_LAYER () { $] >= 5.008001 ? ":utf8" : "" } +sub IO_LAYER () { $] >= 5.008001 ? ":utf8" : "" } BEGIN { if ( HAVE_UTF8 ) { @@ -17,7 +17,7 @@ BEGIN { # Class structure require 5.004; require Exporter; - $Parse::CPAN::Meta::VERSION = '1.4401'; + $Parse::CPAN::Meta::VERSION = '1.4402'; @Parse::CPAN::Meta::ISA = qw{ Exporter }; @Parse::CPAN::Meta::EXPORT_OK = qw{ Load LoadFile }; } @@ -40,7 +40,7 @@ sub load_yaml_string { my ($class, $string) = @_; my $backend = $class->yaml_backend(); my $data = eval { no strict 'refs'; &{"$backend\::Load"}($string) }; - if ( $@ ) { + if ( $@ ) { croak $backend->can('errstr') ? $backend->errstr : $@ } return $data || {}; # in case document was valid but empty @@ -88,7 +88,7 @@ sub _slurp { or die "can't open $_[0] for reading: $!"; return do { local $/; <$fh> }; } - + sub _can_load { my ($module, $version) = @_; (my $file = $module) =~ s{::}{/}g; @@ -133,21 +133,21 @@ Parse::CPAN::Meta - Parse META.yml and META.json CPAN metadata files ############################################# # In your file - + --- name: My-Distribution version: 1.23 resources: homepage: "http://example.com/dist/My-Distribution" - - + + ############################################# # In your program - + use Parse::CPAN::Meta; - + my $distmeta = Parse::CPAN::Meta->load_file('META.yml'); - + # Reading properties my $name = $distmeta->{name}; my $version = $distmeta->{version}; @@ -196,7 +196,7 @@ C<load_yaml_string>. my $metadata_structure = Parse::CPAN::Meta->load_json_string($json_string); -This method deserializes the given string of JSON and the result. +This method deserializes the given string of JSON and the result. If the source was UTF-8 encoded, the string must be decoded before calling C<load_json_string>. |