Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use Time::HiRes or other module?

Status
Not open for further replies.

grimbys

Programmer
Dec 19, 2002
34
0
0
ES
Hi, I want to use Time::HiRes module, but perl gives me next error:

Can't locate loadable object for module Time::HiRes in @INC (@INC contains: ./Time /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 .) at util.pl line 2
Compilation failed in require at util.pl line 2.

I tried to copy HiRes.pm to /usr/lib/perl5/5.8.0/Time/, I tried too
use lib qw|./Time|; (you can see it at error message) (with HiRes.pm at Time/)

How can I use HiRes.pm? It should be accessible by default with use Time::HiRes?

Thanks, your help is useful.
 
When searching for a module Perl uses the @INC array to determine which paths to search. It then takes the package name, in this case Time::HiRes, and turns it into a file path, such as Time/HiRes.pm. It then searches each path in @INC for the specified module.

By adding ./Time you are actually searching for ./Time/Time/HiRes.pm. If you have installed this module correctly then it should have been installed into a valid path. How have you installed this?

Note that just copying HiRes.pm to the Time directory isn't enough as you have a few other files that Time::HiRes uses, including the XS module.

Install using CPAN (perl -MCPAN -e shell;) if you can as that will ensure things get put in the right place.

Barbie
Leader of Birmingham Perl Mongers
 
After I accept all default options in
perl -MCPAN -e shell;
I tried to install my wanted package:
cpan> install Time::HiRes
CPAN: Storable loaded ok
Fetching with LWP:
ftp://ftp.rediris.es/mirror/CPAN/authors/01mailrc.txt.gz
Going to read /home/i5513/.cpan/sources/authors/01mailrc.txt.gz
Fetching with LWP:
ftp://ftp.rediris.es/mirror/CPAN/modules/02packages.details.txt.gz
Going to read /home/i5513/.cpan/sources/modules/02packages.details.txt.gz
Database was generated on Wed, 28 May 2003 04:42:40 GMT

There's a new CPAN.pm version (v1.70) available!
[Current version is v1.61]
You might want to try
install Bundle::CPAN
reload cpan
without quitting the current session. It should be a seamless upgrade
while we are running...

Fetching with LWP:
ftp://ftp.rediris.es/mirror/CPAN/modules/03modlist.data.gz
Going to read /home/i5513/.cpan/sources/modules/03modlist.data.gz
Going to write /home/i5513/.cpan/Metadata
Time::HiRes is up to date.

But the message error is the same.
Where can I saw how to install correctly this package / Module?
I didn't find any Time.tar.gz (I looked at cpan where they said about compile module).

Sorry for my ignorence.
Thank again
 
Once in the CPAN shell, you can type 'force install Time::HiRes' to ensure you have a clean copy. Alternatively, go the following CPAN link [1] and download the tarball [2]. gunzip/untar into a local directory and run the usual commands of:

perl Makefile.PL
make
make test
make install

note that to do the install you should be running as root.

If the test sequence should throw up any problems, see if the error message can shed any light why you might be experiencing a problem.

Getting to grips with installing modules can sometime be a bit confusing if you've not done it much before, but once you get the hang of it, you'll wonder why it seemed so confusing :)

[1] [2]
Barbie
Leader of Birmingham Perl Mongers
 
Thanks you.

Finally I found Time-HiRes...tar.gz and I compiled (manually) it.

Now I can use Time::HiRes module
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top