Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Use a .pm file as a .pl file?

Reply
Thread Tools

Use a .pm file as a .pl file?

 
 
Electrorog@gmail.com
Guest
Posts: n/a
 
      05-15-2006
Hello. My University doesn't have the Perl modules installed that I
want to use but said that I can install them in my own directory for my
own use. I can access my directory but when I put the .pm file (like
NetPacket::TCP) and try to run my .pl file, I still get the can't find
module error since Perl is still looking in the same place for the
modules using @INC I assume (I am not a CS major so this is proving to
be frustrating). I was wondering if I could just save the .pm file as
a .pl file, put my code that I want to run at the end of the .pm file
and run it that way. If I can't, could someone please tell me how I
can use these great modules in a private directory? I appreciate any
help.

Roger

 
Reply With Quote
 
 
 
 
A. Sinan Unur
Guest
Posts: n/a
 
      05-15-2006
wrote in news: oups.com:

> Hello. My University doesn't have the Perl modules installed that I
> want to use but said that I can install them in my own directory for
> my own use.


You should check the FAQ before you post.

perldoc -q lib

or

http://perldoc.perl.org/perlfaq8.htm...y-directory%3f

Sinan

--
A. Sinan Unur <>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc...uidelines.html

 
Reply With Quote
 
 
 
 
Tad McClellan
Guest
Posts: n/a
 
      05-15-2006
<> wrote:

> could someone please tell me how I
> can use these great modules in a private directory?



Your Question is Asked Frequently:

perldoc -q module

How do I keep my own module/library directory?


--
Tad McClellan SGML consulting
Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Ben Morrow
Guest
Posts: n/a
 
      05-16-2006

Quoth :
> Hello. My University doesn't have the Perl modules installed that I
> want to use but said that I can install them in my own directory for my
> own use. I can access my directory but when I put the .pm file (like
> NetPacket::TCP)


It is generally better to install Perl modules properly, using the
Makefile.PL/Build.PL than just copy them into the relevant directories.
This way XS modules get built, and any other configuration necessary is
done as well. MakeMaker (Makefile.PL) has a PREFIX option; read perldoc
ExtUtils::MakeMaker. Module::Build (Build.PL) has an install_base
option; read perldoc Module::Build.

> and try to run my .pl file, I still get the can't find
> module error since Perl is still looking in the same place for the
> modules using @INC I assume (I am not a CS major so this is proving to
> be frustrating). I was wondering if I could just save the .pm file as
> a .pl file, put my code that I want to run at the end of the .pm file
> and run it that way.


No.

> If I can't, could someone please tell me how I
> can use these great modules in a private directory?


perldoc lib

Ben

--
Outside of a dog, a book is a man's best friend.
Inside of a dog, it's too dark to read.
Groucho Marx
 
Reply With Quote
 
Babacio
Guest
Posts: n/a
 
      05-16-2006
Tad McClellan

>> could someone please tell me how I
>> can use these great modules in a private directory?

>
>
> Your Question is Asked Frequently:
>
> perldoc -q module
>
> How do I keep my own module/library directory?


This one can be useful too:

perldoc -q 'search path'

How do I add the directory my program lives in to the module/library
search path?

use FindBin;
use lib "$FindBin::Bin";
use your_own_modules;


--
Ouah, ouah, ouah.
 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      05-16-2006
Babacio <> wrote:
> Tad McClellan



>> perldoc -q module
>>
>> How do I keep my own module/library directory?

>
> This one can be useful too:



> How do I add the directory my program lives in to the module/library
> search path?



And the OP would have seen that one too with the query that I provided.


--
Tad McClellan SGML consulting
Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Michele Dondi
Guest
Posts: n/a
 
      05-16-2006
dOn Tue, 16 May 2006 08:17:34 +0200, Babacio <> wrote:

>perldoc -q 'search path'
>
> How do I add the directory my program lives in to the module/library
> search path?
>
> use FindBin;
> use lib "$FindBin::Bin";

^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^

Incidentally while we're there we should note that this FAQ entry is
giving a bad example, given that we warn people all the time against
always quoting variables...


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
 
Reply With Quote
 
perlistpaul
Guest
Posts: n/a
 
      05-17-2006
use lib qw(where u install your moduel);
use your module

 
Reply With Quote
 
Michele Dondi
Guest
Posts: n/a
 
      05-17-2006
On 16 May 2006 23:36:53 -0700, "perlistpaul" <>
wrote:

>use lib qw(where u install your moduel);
>use your module


Huh?!?


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Could not use ''; file already in use =?Utf-8?B?TWlybw==?= ASP .Net 5 05-24-2009 04:36 AM
Could not use ''; file already in use. M K ASP .Net 11 04-09-2008 11:35 AM
Error - System.Data.OleDb.OleDbException: Could not use ''; file already in use. - please help Learner ASP .Net 6 02-16-2006 09:29 AM
Help with "Couldn't Use '(unknown)'; File Already in Use" error Ian U ASP General 4 09-23-2004 12:51 PM
Can I use XPath or something to a remote Mac or Linux box and just query an xml file, not using web services and use encyrption? jake ASP .Net 0 07-06-2004 02:16 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57