Re: Optioanlly installing YAML and YAML::Syck

[email protected] (Michael G Schwern)
Newsgroups perl.module.build
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.