develooper Front page | perl.module.build | Postings from March 2008

Re: Optioanlly installing YAML and YAML::Syck

Thread Previous | Thread Next
From:
Michael G Schwern
Date:
March 13, 2008 16:56
Subject:
Re: Optioanlly installing YAML and YAML::Syck
Message ID:
47D9BF0A.8060403@pobox.com
Ron Savage wrote:
> Because of this curiosity:
> 
> ron@zoe:~/perl.modules$ perl -MCPAN -e 'install YAML'
> Can't locate object method "install" via package "YAML" at -e line 1.
> ron@zoe:~/perl.modules$ perl -MCPAN -e 'install YAML::Syck'
> Can't locate object method "install" via package "YAML::Syck" at -e line
> 1.
> ron@zoe:~/perl.modules$ perl -MCPAN -e 'install CPAN::Mini'
> CPAN: File::HomeDir loaded ok (v0.66)
> ...etc...
> 
> it's not clear to me how to optionally install YAML and YAML::Syck after
> asking the user if they want to. Or are these modules designed
> deliberately to disallow that?

You're running into the ambiguity surrounding indirect object syntax, has 
nothing to do with CPAN.pm.

$ perl -wle 'foo Bar'
Can't locate object method "foo" via package "Bar" (perhaps you forgot to load 
"Bar"?) at -e line 1.

Perl thinks you're saying Bar->foo().  Use a + to disambiguate:

$ perl -MCPAN -e 'install +YAML'
CPAN: File::HomeDir loaded ok (v0.69)
...

Or use the cpan script:

$ cpan YAML
CPAN: File::HomeDir loaded ok (v0.69)
...


-- 
I am somewhat preoccupied telling the laws of physics to shut up and sit down.
	-- Vaarsuvius, "Order of the Stick"
            http://www.giantitp.com/comics/oots0107.html

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About