This worked on my Mac using the examples (META.yml) they posted on the perldoc.
mbp:Development dj_goku$ cat parse_cpan_meta.pl
use Parse::CPAN::Meta;
my $distmeta = Parse::CPAN::Meta->load_file('META.yml');
# Reading properties
my $name = $distmeta->{name};
my $version = $distmeta->{version};
my $homepage = $distmeta->{resources}{homepage};
print $name, $version, $homepage;
mbp:Development dj_goku$ cat META.yml
---
name: My-Distribution
version: 1.23
resources:
homepage: "http://example.com/dist/My-Distribution"
mbp:Development dj_goku$ perl -v
This is perl 5, version 14, subversion 1 (v5.14.1) built for
darwin-thread-multi-2level
Jonathan Otsuka
On May 17, 2012, at 9:35 PM, Luke Patterson wrote:
> I'm having troubles loading files from the current working directory.
>
> e.g.
> running this:
> use Parse::CPAN::Meta;
> my $distmeta = Parse::CPAN::Meta->load_file('META.json');
> yields:
> "can't open META.json for reading: No such file or directory at
> /home/vagrant/perlbrew/perls/perl-5.14.2/lib/5.14.2/Parse/CPAN/Meta.pm line
> 87."
>
> even though the file is indeed in the same directory as the script and the
> same directory from which I launch the script
>
> I verified that the current working directory is correct by running:
> use Cwd;
> my $dir = cwd();
> print $dir
> which yields the correct working directory
>
>
> I've tried passing simple file names and fully-qualified files names with
> path but neither seems to work. It doesn't seem to be just that API call
> shown above, a couple others API calls I've tried don't seem to work either.
>
> I must be missing something basic. Ideas?
>
>
> Thanks,
> Luke
> _______________________________________________
> kc mailing list
> [email protected]
> http://mail.pm.org/mailman/listinfo/kc
_______________________________________________
kc mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/kc