Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I can't seem to find CGI.pm on Fedora16. I thought CGI.pm came bundled with Perl. In any case, I have not been able to find it. So I am seeking your help.

Also

1) How do I know if a particular module is installed on my system?

2) What is best way to install Perl modules? So far I was using CPAN to install them. Is there another way?

Thanks

Replies are listed 'Best First'.
Re: CGI.pm on Fedora 16
by Athanasius (Archbishop) on Jun 25, 2012 at 06:15 UTC
Re: CGI.pm on Fedora 16
by mantager (Sexton) on Jun 25, 2012 at 06:34 UTC
    What is best way to install Perl modules?

    You may want to use the modules shipped by your distro, so that they're updated automatically when you run an update of your system,
    although they're generally slightly older than the most recent modules you can find on CPAN.

    Try a
    yum search perl | less
    or
    yum search perl MODULENAME
    to find out if a module is available on Fedora as a separate module.

    Also,
    rpm -qa | grep perl
    may help you find out what modules you have installed (this will not list core modules or modules you installed via CPAN, though).

    I find modules installed via yum more manageable, but it's just a matter of taste.
    I fallback to CPAN whenever I need the latest version of a module or a module which is not packaged with the distro, although this rarely happens.

Re: CGI.pm on Fedora 16
by tobyink (Canon) on Jun 25, 2012 at 06:25 UTC

    Yes, CGI.pm does come bundled with Perl.

    1. You can find out if a file exists on your system using:

    locate -b CGI.pm

    (Note that locate doesn't really search the file system - it searches an index of the file system, which is usually configured to be updated on a nightly basis, so results can be up to 24 hours out of date.)

    To know if a module is installed in a place where Perl can find it, use:

    perl -e1 -MCGI

    This will print nothing if CGI can be loaded; and print an error if it cannot.

    There's also a module called V which is pretty handy. It allows you to type this:

    perl -MV=CGI

    ... and it will tell you what version number of CGI.pm you have installed.

    2. App::cpanminus is a pretty good CPAN client. And Fedora probably makes a large number of Perl modules available via their own packaging system (yum if I recall correctly).

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
Re: CGI.pm on Fedora 16
by Anonymous Monk on Jun 25, 2012 at 08:34 UTC
    Thanks everyone.