Use a .pm file as a .pl file?

Discussion in 'Perl Misc' started by Electrorog@gmail.com, May 16, 2006.

  1. Guest

    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
     
    , May 16, 2006
    #1
    1. Advertising

  2. wrote in news::

    > 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.html#How-do-I-keep-my-own-module/library-directory?

    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/clpmisc_guidelines.html
     
    A. Sinan Unur, May 16, 2006
    #2
    1. Advertising

  3. <> 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
     
    Tad McClellan, May 16, 2006
    #3
  4. Ben Morrow Guest

    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
     
    Ben Morrow, May 16, 2006
    #4
  5. Babacio Guest

    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.
     
    Babacio, May 16, 2006
    #5
  6. 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
     
    Tad McClellan, May 16, 2006
    #6
  7. 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,
     
    Michele Dondi, May 17, 2006
    #7
  8. perlistpaul Guest

    use lib qw(where u install your moduel);
    use your module
     
    perlistpaul, May 17, 2006
    #8
  9. 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,
     
    Michele Dondi, May 17, 2006
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. M K
    Replies:
    11
    Views:
    7,063
    woods_jemmy
    Apr 9, 2008
  2. =?Utf-8?B?TWlybw==?=

    Could not use ''; file already in use

    =?Utf-8?B?TWlybw==?=, Sep 27, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    22,573
    gopijoshi
    May 24, 2009
  3. Learner
    Replies:
    6
    Views:
    4,330
    =?Utf-8?B?U2hlaGFiIEthbWFs?=
    Feb 16, 2006
  4. Ian U
    Replies:
    4
    Views:
    193
    Ian U
    Sep 23, 2004
  5. dinamointer
    Replies:
    5
    Views:
    263
    Randy Webb
    May 12, 2006
Loading...

Share This Page