On Sunday, March 16, 2003, at 12:58 PM, Chris Devers wrote:

That's why there's no option to run individual CPAN.pm commands as sudo

Well, actually... there is. Just let me put on my Pedant Hat for a moment, while I explain... Newbies don't need to know any of this, by the way - it's mostly for paranoid wizards. ;-)


The CPAN "install Foo" command is actually a shortcut that executes several commands. It looks to see if the needed module has been downloaded and untarred; if not, it executes the "get Foo" command. Then, it checks to see if the module has been configured and built; if not, it executes the "make Foo" command. Finally, it checks to see if the module's self tests have been run successfully; if not, it executes the "test Foo" command. And, last but not least, it runs "make install" in the module's build directory.

You can perform one or more of these steps manually. If you want to pass parameters to Makefile.PL, you can issue "look Foo". The "look Foo" command will, if needed, run "get Foo" to download the Foo tarball and unpack it. Then it opens a sub-shell in the build directory. You can then run "perl Makefile.PL OPTX=1 OPTY=2" to configure the module. Then, you can exit from the sub-shell, and run "test Foo" and "install Foo" to complete the process.

Strictly speaking, only the final "make install" must be run as root. You can do this with the CPAN shell, too. Just run it normally, without sudo. Instead of using "install Foo", use "test Foo" instead; this will cause the CPAN shell to download, unpack, build, and test the module, but it will stop short of running the final "make install". Then, use "look Foo" to open up a sub-shell in the module's build directory; you can then use "sudo make install" to run the final install step as root.

sherm--

The highest sounds are hardest to hear.
Going forward is a way to retreat.
Great talent shows itself late in life.
Even a perfect program still has bugs.

-- The Tao of Programming



Reply via email to