|
Posted by Chad on October 15, 2004, 3:07 pm
Please log in for more thread options
Hello,
I am still in the first week or 2 of trying to learn Perl and get my
servers patched to what I need. I have a question about the Perl modules.
DO all Perl *.pm files require you to compile or can some be just
downloaded and placed into the proper directory?
The Red Hat 7.3 server directory (upgrading Linux is not an
option at this time)
/usr/lib/perl5/5.6.1/
has tons of *.pl and *.pm files.
I downloaded from CPAN via the web page the source files for HTML::Template
, Mail::Sender , HTML::Template::Set and HTML::Embperl
The files are Embperl.pm , Sender.pm , Set.pm , Template.pm
Can I just copy these files over to the
/usr/lib/perl5/5.6.1/ directory and use them? Assuming
all extra needed pm files are there?
That is just my guess. I have tried to download some of these via CPAN
utility and it either does not find these or I do not have it typed in fully
correct. I have downloaded some items and CPAN compiled and installed them
fine. I have downloaded the Template.pm file and tried doing the make
commands and it did not work.
How do you know if a *.pm needs to be compiled with the make file command
or not? I read in one post or readme file that said something like if you
do not see a .c or .h file it does not need to be compiled.
My first thoughts on how the files in the directory look and how they look
when I download them to my computer, they appear to look the same
filename.pl or filename.pm
Sorry I am so new to all this.
Chad
|
|
Posted by Bill Karwin on October 15, 2004, 2:20 pm
Please log in for more thread options
Chad wrote:
> DO all Perl *.pm files require you to compile or can some be just
> downloaded and placed into the proper directory?
Well, it may not need a C compiler if there are no .c or .h files (or
..cpp or .cxx or whatever for C++) present in the distribution. Assuming
the Makefile doesn't _generate_ C code during the make process
(uncommon, I guess, but possible).
But that still doesn't mean that the Makefile does nothing if there's no
C code to compile. It might need to prepare the .pm files, actually
editing the file with values that apply to your local system (libnet
does this, for example).
Installing into the /usr/lib/perl5/site_perl tree isn't always the
matter of a single .pm file. There's an "auto" directory too; I'm a
little fuzzy on my understanding of this, but I think it has something
to do with whether the module has some Autoloader features in it.
The Makefile can check for module dependencies or non-Perl technology
dependencies, it can prompt you for installing optional components, it
can run tests to make sure the module works before you install it, it
can prepare POD documentation files and install those, and so many other
possibilities!
The bottom line is that it's easier to run "make test && make install"
for a Perl module than to figure out if a given module can be installed
with a file copy, and then troubleshoot any problems that come up if one
of the modules you installed couldn't be installed that way.
Regards,
Bill K.
|
|
Posted by Jim Keenan on October 16, 2004, 12:10 am
Please log in for more thread options Chad wrote:
> Hello,
>
> I am still in the first week or 2 of trying to learn Perl and get my
> servers patched to what I need. I have a question about the Perl modules.
> DO all Perl *.pm files require you to compile or can some be just
> downloaded and placed into the proper directory?
>
>
I second what Bill K. wrote. Downloading files and manually
transferring them to the proper directory *might* work in a few cases
but will fail in many, if not most cases. More importantly, it will
fail in the *most important* cases.
Most distros on CPAN contain 'README' files which tell you how to
install the distro and what your installation options are. In the vast
majority of cases I have encountered, it's as simple as:
perl Makefile.PL
make
make test
make install
Look at the MANIFEST file in each CPAN distro to see if it contains
files which imply the need for a C-compiler. I would add one thing to
what Bill wrote: Distributions which contain a '.xs' file need a C
compiler because the XS is the glue between the C and the Perl. But
even if you don't have a C-compiler, the overwhelming majority of CPAN
modules which need compilation can be installed with a '.ppm' file from
ActiveState (for Windows *and* lots of other OSes), a '.rpm' file for
many Linux distributions or a '.deb' file for Debian Linux.
Let us know if you encounter further problems.
jimk
|
|
Posted by chad on October 17, 2004, 5:16 am
Please log in for more thread options Hello,
so for example if I download HTML::Template
Do I put the name in the make file like
perl Template.PL
make
make test
make install
Or how does the make file know what module I want it done on?
Sorry I am still green on the make file / compile stuff.
Do I make a temp directory to copy the file / files into and then type the
commands as you said while in that directory? I was not sure how Make knew
what file or files to run the make on unless it just looks at what is in
that directory and does it to just them files in it?
perl Makefile.PL
make
make test
make install
I am Using CPAN shell as much as I can. Some times the files work, sometimes
they do not. The 2 machines at work are completely undocumented and I am
kinda winging it. One is 6.2 & 7.3 red hat. I have installed Fedora on a
machine at home and am trying to develope and figure things out on that.
Since I installed everything that was part of Fedora, I figure I will have
better luck figuring it out on that machine and then try to set it up at
work. I will also be putting a hard drive in my desk computer at work to
put a full install of Red Hat 7.3 and or 6.2 on and develope that way and
then migrate. Hice to have old hard drives sitting around.
Thank you for your help to all who have responded to my posts.
Sincerely,
Chad
> Chad wrote:
> > Hello,
> >
> > I am still in the first week or 2 of trying to learn Perl and get my
> > servers patched to what I need. I have a question about the Perl
modules.
> > DO all Perl *.pm files require you to compile or can some be just
> > downloaded and placed into the proper directory?
> >
> >
>
> I second what Bill K. wrote. Downloading files and manually
> transferring them to the proper directory *might* work in a few cases
> but will fail in many, if not most cases. More importantly, it will
> fail in the *most important* cases.
>
> Most distros on CPAN contain 'README' files which tell you how to
> install the distro and what your installation options are. In the vast
> majority of cases I have encountered, it's as simple as:
> perl Makefile.PL
> make
> make test
> make install
>
> Look at the MANIFEST file in each CPAN distro to see if it contains
> files which imply the need for a C-compiler. I would add one thing to
> what Bill wrote: Distributions which contain a '.xs' file need a C
> compiler because the XS is the glue between the C and the Perl. But
> even if you don't have a C-compiler, the overwhelming majority of CPAN
> modules which need compilation can be installed with a '.ppm' file from
> ActiveState (for Windows *and* lots of other OSes), a '.rpm' file for
> many Linux distributions or a '.deb' file for Debian Linux.
>
> Let us know if you encounter further problems.
>
> jimk
|
|
Posted by Jim Keenan on October 17, 2004, 2:34 pm
Please log in for more thread options chad wrote:
> Hello,
>
> so for example if I download HTML::Template
See below.
>
> Or how does the make file know what module I want it done on?
>
> Sorry I am still green on the make file / compile stuff.
>
> Do I make a temp directory to copy the file / files into and then type the
> commands as you said while in that directory? I was not sure how Make knew
> what file or files to run the make on unless it just looks at what is in
> that directory and does it to just them files in it?
>
If you're doing this 'manually (i.e., not through the 'cpan' shell),
then clicking on 'Download' on a distribution's search.cpan.org web page
will download the tarball file to a specific directory on your system.
You then need to unzip that file (see man pages for 'tar' and 'gunzip')
and switch to the directory in which those programs have placed the
Makefile.PL. At this point you're ready to say:
> perl Makefile.PL
> make
> make test
> make install
Assuming you're in the same directory as Makefile.PL, 'make' takes over
from there.
>
> I am Using CPAN shell as much as I can.
Good. Remember that if you're doing this work and you're not a sysadmin
and you want to install a distro for users in addition to yourself, you
either have to have the sysadmin do the installation for you or you have
to be able to get temporary superuser privileges for your use of the
'cpan' shell, for example:
sudo cpan
[you're prompted for password]
Some times the files work, sometimes
> they do not. The 2 machines at work are completely undocumented and I am
> kinda winging it. One is 6.2 & 7.3 red hat.
What does 'undocumented' mean here: no one printed any instructions
out? They should have all their documentation accessible as either
'man' or 'info' pages.
*Note on HTML::Template: Recall that in my previous post I advised
reading the README file included in each CPAN distribution. The README
for HTML::Template notes that it deviates from the standard installation
procedure in one respect.
"If you plan to use the shared memory cache you might want to test
it before you install. Make sure you have an up-to-date copy of
IPC::SharedCache installed (available from the same place you got
HTML::Template, either CPAN or SourceForge) and then do:"
TEST_SHARED_MEMORY=1 make test
An added complexity like this is a good argument for letting the cpan
shell do the work.
jimk
|
| Similar Threads | Posted | | General question on CPAN perl modules | March 13, 2005, 6:34 pm |
| download all CPAN modules ? | August 25, 2004, 10:35 pm |
| Looking for a base module that can automatically load sub modules | June 27, 2007, 6:16 am |
| Issues Installing CPAN Modules on Win NT - Activestate Perl 5.61 | November 19, 2004, 6:52 am |
| lwp-download http://..--how do I use it to download pages? | June 8, 2008, 5:47 pm |
| Perl Database Programing download for the template | January 9, 2008, 12:56 pm |
| Question on Wx modules | August 8, 2007, 5:36 pm |
| CPAN module local installation question | July 12, 2006, 4:49 am |
| Question about building modules on W2K | September 24, 2004, 7:09 am |
| Question about creating modules | May 27, 2006, 4:50 pm |
|