Code Comments
Programming Forum and web based access to our favorite programming groups.Hi list, How do I know whether a given module is installed on machine or not? Thanks and Regards, Manish
Post Follow-up to this message> Hi list, > How do I know whether a given module is installed on > machine or not? > > Thanks and Regards, > Manish > Hi Manish - The way I check to see if a module is installed perl -e "use ModuleName;" (eg. perl -e "use XML::Simple:" If you get an error, then it is not installed. Now I use ActiveState Perl on an XP box. If you're using perl on a Unix-type machine, the double quotes may need to be perl -e 'use XML::Simple;' Someone here will correct me if I'm wrong about this. HTH, Mark
Post Follow-up to this messageOn Sun, 27 Mar 2005 20:28:42 +0800, Manish Sapariya <manishs@gs-lab.com> wrote: > Hi list, Hi > How do I know whether a given module is installed on > machine or not? perl -MModule::Name -e 'print "it is installed\n";' or it's simpler variant perl -MModule::Name -e1 Hth -- Edward WIJAYA Singapore
Post Follow-up to this messageEdward Wijaya wrote: > On Sun, 27 Mar 2005 20:28:42 +0800, Manish Sapariya > <manishs@gs-lab.com> wrote: > > > > Hi > > > > perl -MModule::Name -e 'print "it is installed\n";' > > or it's simpler variant > > perl -MModule::Name -e1 or even perldoc -l Module::Name
Post Follow-up to this messageJust execute perl and say "use <module name> forexample : perl -e "use Net::SNMP;" it will throw errors if the module "Net::SNMP" was not installed , if not your module is installed then :) "Manish Sapariya" <manishs@gs-lab.com> wrote in message news:20050327122842.16021.qmail@lists.develooper.com... > Hi list, > How do I know whether a given module is installed on > machine or not? > > Thanks and Regards, > Manish >
Post Follow-up to this messageJust execute perl and say "use <module name> forexample : perl -e "use Net::SNMP;" it will throw errors if the module "Net::SNMP" was not installed , if not your module is installed then :) Manish Sapariya wrote: > Hi list, > How do I know whether a given module is installed on > machine or not? > > Thanks and Regards, > Manish >
Post Follow-up to this messageOn Sun, 27 Mar 2005 09:27:09 -0500, Randy W. Sims wrote: > > or even > > perldoc -l Module::Name > Nope, that won't do. What if a module is installed but has no pod file or embedded pod? Example: > perldoc -l Pod::Perldoc No documentation found for "Pod::Perldoc". > perl -MPod::Perldoc -e'print "Exists!\n"' Exists! -- Offer Kaye
Post Follow-up to this messageHave you noticed that "-l" parameter? If it is used, the perldoc command just show the directory where the module is installed. Teddy ----- Original Message ----- From: "Offer Kaye" <offer.kaye@gmail.com> To: "Perl Beginners" <beginners@perl.org> Sent: duminica, 27 martie 2005 18:02 PM Subject: Re: ideintifying whether a module is already installed or not On Sun, 27 Mar 2005 09:27:09 -0500, Randy W. Sims wrote: > > or even > > perldoc -l Module::Name > Nope, that won't do. What if a module is installed but has no pod file or embedded pod? Example: > perldoc -l Pod::Perldoc No documentation found for "Pod::Perldoc". > perl -MPod::Perldoc -e'print "Exists!\n"' Exists! -- Offer Kaye -- To unsubscribe, e-mail: beginners-unsubscribe@perl.org For additional commands, e-mail: beginners-help@perl.org <http://learn.perl.org/> <http://learn.perl.org/first-response>
Post Follow-up to this messageOn Sun, 27 Mar 2005 18:19:22 +0300, Octavian Rasnita wrote: > Have you noticed that "-l" parameter? > If it is used, the perldoc command just show the directory where the modul e > is installed. > > Teddy > Sigh... did you even try out my example? Please read my answer *carefully*, the "perldoc Pod::Perldoc" command will return 'No documentation found for "Pod::Perldoc".' regardless of whether you use the "-l" switch or not, since Pod::Perldoc *has no pod documentation*. However, Pod::Perldoc *is* an installed module. So using "perldoc -l Module::Name" as a means to finding out whether or not a module is installed is not a very robust way of doing it. The other ways posted by various people are much better. Cheers, -- Offer Kaye
Post Follow-up to this messageOffer Kaye wrote: > On Sun, 27 Mar 2005 18:19:22 +0300, Octavian Rasnita wrote: > > > > Sigh... did you even try out my example? He most likely did. Your example works fine here because there is pod in that file at least in some versions. But you are correct that files without pod will simply generate a "No documentation found..." error. I've never ran into that problem, but then I don't use that "trick" too much prefering the more idiomatic 'perl -MModule -e1'. I saw the perldoc trick mentioned on P5P several years ago, so I usually mention it when this topic comes up as an interesting tidbit. Randy. > Please read my answer *carefully*, the "perldoc Pod::Perldoc" command > will return 'No documentation found for "Pod::Perldoc".' regardless of > whether you use the "-l" switch or not, since Pod::Perldoc *has no pod > documentation*. However, Pod::Perldoc *is* an installed module. > So using "perldoc -l Module::Name" as a means to finding out whether > or not a module is installed is not a very robust way of doing it. The > other ways posted by various people are much better. > > Cheers,
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.