Re: Newbie Adding Module to Perl
by zby (Vicar) on Apr 09, 2003 at 19:17 UTC
|
First read the README file. If it does not help: perl Makefile.PL; make test; make install
should do the trick. But the best way to do it would be by using the CPAN module: perl -MCPAN -e shell. There is a help command in it - so you should not be lost there. The command install Sys::Alarm would download the module, compile it (if it is needed) and install it for you. | [reply] [d/l] [select] |
|
|
Thanks for the help everyone. I tried both ways. When I tried with the cpan.pm, I received a configuration dialog (below) are there recommended locations for these items? Basically I went with manual configuration but then bailed out since it wanted to place the cache under root's directory. Thanks again. -Laura
[root@uswsy1 bin]# perl -MCPAN -e shell
We have to reconfigure CPAN.pm due to following uninitialized paramete
+rs:
cpan_home, keep_source_where, build_dir, build_cache, scan_cache, inde
+x_expire,y
/usr/lib/perl5/5.6.0/CPAN/Config.pm initialized.
CPAN is the world-wide archive of perl resources. It consists of about
100 sites that all replicate the same contents all around the globe.
Many countries have at least one CPAN site already. The resources
found on CPAN are easily accessible with the CPAN.pm module. If you
want to use CPAN.pm, you have to configure it properly.
If you do not want to enter a dialog now, you can answer 'no' to this
question and I'll try to autoconfigure. (Note: you can revisit this
dialog anytime later by typing 'o conf init' at the cpan prompt.)
Are you ready for manual configuration? [yes]
update (broquaint): added formatting | [reply] [d/l] |
|
|
For me the placement of the cache never was a problem. It creates it's own directory for it so it won't overwrite anything there. Why did you not found it problematic?
| [reply] |
Re: Newbie Adding Module to Perl
by fruiture (Curate) on Apr 09, 2003 at 19:12 UTC
|
No, you generally don't recompile perl, you maybe needn't compile anything at all, but if, it's only the module. As i am probably like you not into doing such things the hardcore way (download, untar, make, make test, ...), i use CPAN.pm, which directly connects to some CPAN mirror and will do all the steps for you. try `perl -MCPAN -e shell`!
--
http://fruiture.de
| [reply] |
Re: Newbie Adding Module to Perl
by blaze (Friar) on Apr 09, 2003 at 19:20 UTC
|
just go to where you downloaded the module, do
$ tar -zxvf Sys-Alarm.tar.gz
$ cd Sys-Alarm
$ perl Makefile.PL
$ make
$ make test
$ make install
All done, easy huh...there is a place here at the monastery that might offer additional help
hth
-Robert
Update: Pointed to Tutorials | [reply] [d/l] |
|
|
I tried to go to the directory where AlarmCall.pm is and typing the following:
root@uswsqa Sys# /usr/bin/perl Makefile.PL
Can't open perl script "Makefile.PL": No such file or directory
Can you see what am I missing? I checked that perl is indeed in /usr/bin though I should not have to type the full path since /usr/bin is in roots path. Does Makefile.PL need the argument of AlarmCall.pm? Thanks!
| [reply] |
|
|
for me, i download modules to my /tmp directory, so id download Sys-AlarmCall-1.2.tar.gz..then id do the following:
$ cd /tmp
$ tar -zxvf Sys-AlarmCall-1.2.tar.gz
this is where it would show the files being unzipped and a directory call Sys-AlarmCall-1.2 would be created
$ cd Sys-AlarmCall-1.2
now we're in the Sys-AlarmCall-1.2 directory which is where Makefile.PL is
$ perl Makefile.PL
$ make
$ make test
$ make install
so if you download the module to a directory called uswsqa Sys, then all you should have to do is substitute that directory for /tmp in the above instructions...
even though CPAN.pm is suppose to be much easier, i dont push it much cause i once got bit by it, but using make is usually a very easy straight foward process
hth
Robert | [reply] [d/l] [select] |
Re: Newbie Adding Module to Perl
by vek (Prior) on Apr 09, 2003 at 19:51 UTC
|
One more thing to add, if you don't have root access you can still install the module by specifying a directory of your choice:
perl Makefile.PL PREFIX=/path-to/your-dir LIB=/path-to/your-dir
Then when you use the module in your code, make sure Perl knows to look in that directory to find the module:
#!/usr/bin/perl -w
use lib '/path-to/your-dir';
use Sys::AlarmCall;
--
vek
-- | [reply] [d/l] [select] |
Re: Newbie Adding Module to Perl
by pemungkah (Priest) on Apr 09, 2003 at 19:28 UTC
|
Installing Perl modules is easy, especially if you've got root access.
CPAN modules follow a simple build protocol:
tar zxvf Module.tar.gz
cd Module
perl Makefile.PL
make
make test
make install
if you prefer not working as root (and no one sensible does!), I highly recommend installing sudo, which will let execute single commands as root.
Following this way of doing it has the additional benefit of making sure that you have all the modules you need to use the one you're installing - you'll get a warning from the perl Makefile.PL about it.
As was mentioned, though, using CPAN.pm makes it much simpler; CPAN.pm will automagically grab anything else you need as a prerequisite and install it too. Once you've gone through the process of initializing CPAN.pm once (I recommend using the http: CPAN mirrors, by the way, as they tend to be faster to access), you can do things like this:
sudo perl -MCPAN -e'install Some::Module'
and have CPAN.pm sort it all out for you. | [reply] |
Re: Newbie Adding Module to Perl
by Bilbo (Pilgrim) on Apr 10, 2003 at 14:41 UTC
|
I just tried downloading Sys::Alarm. The .tgz file
contains one file: Sys/AlarmCall.pm. There is no
Readme file and no Makefile.pl. To install it you should
presumably just copy it into a directory that is searched for
perl modules. You can get a list of them by running
perl -e 'print join("\n", @INC);'
or put it in a new directory and put
use lib "/my/directory/name/";
at the top of
your program.
Update: Ooops. I just tried following the CPAN link
Sys::Alarm that I gave above and got a file which did
include a Makefile.PL etc. I somehow found an old version (1.1)
before which didn't. It sounds from what you say in your question
and your comment about that you did too. It would explain
why it was claiming not to find Makefile.PL, and you did say that
you just got Sys/AlarmCall.pm out of the tgz file. Try following
this link and getting version 1.2.
| [reply] [d/l] [select] |