Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

ideintifying whether a module is already installed or not
Hi list,
How do I know whether a given module is installed on
machine or not?

Thanks and Regards,
Manish


Report this thread to moderator Post Follow-up to this message
Old Post
Manish Sapariya
03-27-05 08:55 PM


Re: ideintifying whether a module is already installed or not
> 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


Report this thread to moderator Post Follow-up to this message
Old Post
Mark Taylor
03-27-05 08:55 PM


Re: ideintifying whether a module is already installed or not
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

Report this thread to moderator Post Follow-up to this message
Old Post
Edward Wijaya
03-27-05 08:55 PM


Re: ideintifying whether a module is already installed or not
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



Report this thread to moderator Post Follow-up to this message
Old Post
Randy W. Sims
03-27-05 08:55 PM


Re: ideintifying whether a module is already installed or not
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
>



Report this thread to moderator Post Follow-up to this message
Old Post
M Nikhil \
03-27-05 08:55 PM


Re: ideintifying whether a module is already installed or not
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
>

Report this thread to moderator Post Follow-up to this message
Old Post
Nikhil
03-27-05 08:55 PM


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

Report this thread to moderator Post Follow-up to this message
Old Post
Offer Kaye
03-27-05 08:55 PM


Re: ideintifying whether a module is already installed or not
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>



Report this thread to moderator Post Follow-up to this message
Old Post
Octavian Rasnita
03-27-05 08:55 PM


Re: ideintifying whether a module is already installed or not
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 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

Report this thread to moderator Post Follow-up to this message
Old Post
Offer Kaye
03-27-05 08:55 PM


Re: ideintifying whether a module is already installed or not
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,



Report this thread to moderator Post Follow-up to this message
Old Post
Randy W. Sims
03-27-05 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:52 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.