Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

where the module file *.pm located

by ytjPerl (Scribe)
on Jul 20, 2017 at 15:57 UTC ( [id://1195631]=perlquestion: print w/replies, xml ) Need Help??

ytjPerl has asked for the wisdom of the Perl Monks concerning the following question:

Hi folks, I am facing an issue that I have no internet access on my VM, so when I running my perl script containing external modules, I have to manually copy *.pm from local machine to VM. For instance, I need to use File::Readbackwards. I have that locally at C:\Perl64\site\lib\File\Readbackwards.pm, but in my VM, I only have directory perl\site\lib(no sub-directory File), so I manually copied there, \Perl\lib\ as well. When I execute my script, it is still saying cannot locate File::Readbackwards. Please help! Thanks

Replies are listed 'Best First'.
Re: where the module file *.pm located
by 1nickt (Canon) on Jul 20, 2017 at 16:22 UTC

    When your script tries to use File::Readbackwards, Perl looks in the directories in @INC to find a directory called File with a file Readbackwards.pm in it. Just make it so :-)


    The way forward always starts with a minimal test.

      I already put ReadBackwards.pm at location \perl\site\lib and \perl\lib, but still not working.

        As was already explained, that file needs to go into a directory called 'File' -- so you should move the file ReadBackwards.pm from \perl\site\lib to the new location \perl\site\lib\File. (Hint: you may need to create that directory.)

        Alex / talexb / Toronto

        Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

Re: where the module file *.pm located
by duyet (Friar) on Jul 21, 2017 at 06:09 UTC
    As already mentioned by other monks, it should be in your @INC. You can check if the required dirs are in it.
    use Data::Dumper; print STDERR Dumper( \@INC );
    If it's not there, the module won't be found. You can add it to the @INC with:
    sub BEGIN { unshift @INC, 'c:/Perl64/site/lib'; unshift @INC, 'c:/.....'; # what ever you needed }
    BTW, it should be '/' and not '\' in your script.
Re: where the module file *.pm located
by ablanke (Monsignor) on Jul 22, 2017 at 13:33 UTC
    Hi ytjPerl,

    try this:

    1. Download the tarball from CPAN to your local machine File-ReadBackwards
    2. Copy the tarball from your local machine to your VM
    3. Install the module manually on your VM Installing Modules
Re: where the module file *.pm located
by beech (Parson) on Jul 20, 2017 at 22:39 UTC

    Hi,

    Instead of trying to copy a few module .pm files, why not copy the entire perl directory?

Re: where the module file *.pm located
by dbander (Scribe) on Jul 21, 2017 at 15:23 UTC

    Additional consideration on Windows: xcopy /D will only copy updated files.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1195631]
Approved by sweetblood
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-20 02:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found