Home > Archive > PERL Beginners > March 2005 > ideintifying whether a module is already installed or not
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
ideintifying whether a module is already installed or not
|
|
| Manish Sapariya 2005-03-27, 3:55 pm |
| Hi list,
How do I know whether a given module is installed on
machine or not?
Thanks and Regards,
Manish
| |
| Mark Taylor 2005-03-27, 3:55 pm |
| > 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
| |
| Edward Wijaya 2005-03-27, 3:55 pm |
| On 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
| |
| Randy W. Sims 2005-03-27, 3:55 pm |
| Edward 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
| |
| M Nikhil \ 2005-03-27, 3:55 pm |
| Just 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
>
| |
| Nikhil 2005-03-27, 3:55 pm |
| Just 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
>
| |
| Offer Kaye 2005-03-27, 3:55 pm |
| 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
| |
| Octavian Rasnita 2005-03-27, 3:55 pm |
| Have 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>
| |
| Offer Kaye 2005-03-27, 3:55 pm |
| On 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 module
> 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
| |
| Randy W. Sims 2005-03-27, 3:55 pm |
| Offer 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,
|
|
|
|
|