[NTLUG:Discuss] mod_perl question

MadHat madhat at unspecific.com
Mon Jun 2 09:08:37 CDT 2003


On Sun, 2003-06-01 at 19:32, Rev. wRy wrote:
> On Sun, 2003-06-01 at 19:04, Rick Matthews wrote:
> 
> > I'm not sure exactly what you mean by "Tried CPAN?".  I spent over 
> > two hours looking for answers before I posted my question, and CPAN 
> > was one of the MANY sites that I visited.  
> 
> Sorry.  I wasn't trying to be flip - I know several people that have
> missed modules or used an rpm and been let down.  My thought process was
> only that if it's PERL, and you are missing something, CPAN is the first
> place to look.

I prefer source for Perl, Apache, and other such things but that is
personal preference (but seems to make my life easier in the long run). 
As for CPAN, not everyone understands it is more than a site. 
http://search.cpan.org/ is a good place to start.  There is also an
interactive CPAN shell that will help you install the necessary modules
(though not all), including grabbing dependencies when necessary.

as root, or using sudo[1], run
$ perl -MCPAN -eshell
The first time you run it, you will have to configure it, but it is
pretty easy, usually sticking with the defaults is safe.  The only thing
to really choose is your CPAN mirror.  Warning, unless you have links
(for 5.8) or lynx (for pre-5.8) or the LWP module already installed, do
not choose an http site as a mirror.  If it is installed, the http sites
are usually faster.

once in the shell, 'h' will get you started.
cpan> h

Display Information
 command  argument          description
 a,b,d,m  WORD or /REGEXP/  about authors, bundles, distributions,
modules
 i        WORD or /REGEXP/  about anything of above
 r        NONE              reinstall recommendations
 ls       AUTHOR            about files in the author's directory

Download, Test, Make, Install...
 get                        download
 make                       make (implies get)
 test      MODULES,         make test (implies make)
 install   DISTS, BUNDLES   make install (implies test)
 clean                      make clean
 look                       open subshell in these dists' directories
 readme                     display these dists' README files

Other
 h,?           display this menu       ! perl-code   eval a perl command
 o conf [opt]  set and query options   q             quit the cpan shell
 reload cpan   load CPAN.pm again      reload index  load newer indices
 autobundle    Snapshot                force cmd     unconditionally do
cmd

cpan> i /Constants/
CPAN: Storable loaded ok
<SNIP ... >
Distribution    C/CH/CHROMATIC/Devel-Constants-0.20.tar.gz
Distribution    D/DU/DUFFEE/Astro-Constants-0.09.tar.gz
Distribution    S/SA/SAMV/Pod-Constants-0.15.tar.gz
Module          Apache::Constants (D/DO/DOUGM/mod_perl-1.27.tar.gz)
<SNIP ... >
51 items found

So it should be included with mod_per, but if you say
'install Apache::Constants' it will try to install mod_perl and will
want to know where the source for apache is and really mess up an RPM
installation of Apache and mod_per if already installed.

Also, if you want to know if something is installed with perl, or want
to know the version, it usually works to do:
$ perl -MLWP -e 'print "$LWP::VERSION\n"'
5.65
$ perl -MCPAN -e 'print "$CPAN::VERSION\n"'
1.70

And this works for sub-modules, as in LWP::UserAgent
$ perl -MLWP -e 'print "$LWP::UserAgent::VERSION\n"'
2.001

I don't have mod_perl installed on this box, so...

$ perl -MApache -e 'print "$Apache::Constants::VERSION\n"'
Can't locate Apache.pm in @INC (@INC contains:
/usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .).


[1] there are ways to run CPAN as a regular user and install the modules
in your own directory, but then they are not accessible to the whole
system.  This is useful on a shared system, or where you do not have
root access, but is more involved to setup, by a little bit anyway.

-- 
MadHat at Unspecific.com
`But I don't want to go among mad people,' Alice remarked.
`Oh, you can't help that,' said the Cat: `we're all mad here...'
   -- Lewis Carroll - _Alice's_Adventures_in_Wonderland_




More information about the Discuss mailing list