--- Meta.pm 2014-03-04 15:22:05.000000000 -0500
+++ /u01/oracle/Meta.pm 2014-04-10 11:24:46.069085636 -0400
@@ -2,7 +2,7 @@ use 5.008001;
use strict;
package Parse::CPAN::Meta;
# ABSTRACT: Parse META.yml and META.json CPAN metadata files
-our $VERSION = '1.4414'; # VERSION
+our $VERSION = '1.4413'; # VERSION
use Exporter;
use Carp 'croak';
@@ -13,30 +13,15 @@ our @EXPORT_OK = qw/Load LoadFile/;
sub load_file {
my ($class, $filename) = @_;
- my $meta = _slurp($filename);
-
if ($filename =~ /\.ya?ml$/) {
- return $class->load_yaml_string($meta);
- }
- elsif ($filename =~ /\.json$/) {
- return $class->load_json_string($meta);
- }
- else {
- $class->load_string($meta); # try to detect yaml/json
+ return $class->load_yaml_string(_slurp($filename));
}
-}
-sub load_string {
- my ($class, $string) = @_;
- if ( $string =~ /^---/ ) { # looks like YAML
- return $class->load_yaml_string($string);
- }
- elsif ( $string =~ /^\s*\{/ ) { # looks like JSON
- return $class->load_json_string($string);
- }
- else { # maybe doc-marker-free YAML
- return $class->load_yaml_string($string);
+ if ($filename =~ /\.json$/) {
+ return $class->load_json_string(_slurp($filename));
}
+
+ croak("file type cannot be determined by filename");
}
sub load_yaml_string {
@@ -136,7 +121,7 @@ Parse::CPAN::Meta - Parse META.yml and M
=head1 VERSION
-version 1.4414
+version 1.4413
=head1 SYNOPSIS
@@ -216,13 +201,6 @@ This method deserializes the given strin
If the source was UTF-8 encoded, the string must be decoded before ca
+lling
C<load_json_string>.
-=head2 load_string
-
- my $metadata_structure = Parse::CPAN::Meta->load_string($some_strin
+g);
-
-If you don't know whether a string contains YAML or JSON data, this m
+ethod
-will use some heuristics and guess. If it can't tell, it assumes YAM
+L.
-
=head2 yaml_backend
my $backend = Parse::CPAN::Meta->yaml_backend;
Will see if I can trouble shoot further. Any suggestions appreciated.
|