Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Cannot access CPAN Installs

by cristofayre (Sexton)
on Dec 04, 2019 at 19:28 UTC ( [id://11109671]=perlquestion: print w/replies, xml ) Need Help??

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

I am using Strawberry Perl, which resides at "C:/Strawberry" When I install modules via CPAN, for some reason best known to itself, it installs them in "C:/Users/Chris Brown/Perl5/lib/perl5" (For example, PDF::API2 can be found in "...perl5/PDF/API2"

I have tried setting the "Perl5lib" path via My Computer / Enviroment variables to that shown in the first part above (It also showed my spaced name as "Chris~1" (DOS?), but changing it to the full name made no difference. I have also put the path in the main progrem:

use lib qw(C:/Users/Chris Brown/perl5/lib/perl5);\n use PDF::API2;

I have also tried combinations such as "perl5", "perl5/lib" but none of them work. The script simply cannot locate the library, asking me if I need to install it !!

I don'tknow what to try next to get it to run. NB: Perl is installed correctly as it will run files from the shebang (#!/usr/bin/perl) It's just the CPAN modules it can't locate. (I even tried >use lib qw(C:/Users/Chris Brown/perl5/lib/perl5/PDF/API2.pm) but got nothing!)

HELP !!

Replies are listed 'Best First'.
Re: Cannot access CPAN Installs
by haukex (Archbishop) on Dec 04, 2019 at 19:39 UTC
    When I install modules via CPAN, for some reason best known to itself, it installs them in "C:/Users/Chris Brown/Perl5/lib/perl5"

    Sounds like local::lib, as Corion pointed out the last time you asked. Check if you've got the environment variables PERL_MB_OPT and/or PERL_MM_OPT set, which would explain why modules get installed to that path.

    I have also put the path in the main progrem: use lib qw(C:/Users/Chris Brown/perl5/lib/perl5);

    With that path, I believe the correct lib would be: use lib 'C:/Users/Chris Brown/Perl5/lib/perl5'; (Update: yup, confirmed with a test that a path like that should work). On Windows, and especially with multiple Perls installed, perhaps try not relying on the PERL5LIB environment variable.

    If that still doesn't work, then you've got something really strange going on with your install. Are you sure you only have one Perl installed on your machine? (Again, look for any environment variables from old installs.)

      Just pointing out an important difference between the following:

      use lib qw(C:/Users/Chris Brown/perl5/lib/perl5); use lib 'C:/Users/Chris Brown/Perl5/lib/perl5';

      The qw(...) syntax will split the string on whitespace and turn it into a list. So the first line is equivalent to:

      use lib ( 'C:/Users/Chris', 'Brown/perl5/lib/perl5' );

      And that is not what you want. haukex correctly uses quotes for the path and that is why it works for him.

      VERY RED FACED ...

      Seems I have (at least) TWO versions of PERL on computer -maybe three! And when I go to CMD and enter "cpan", it loads the module relating to the Perl5 install that I did at some time, which resides in my user profile as stated above. What I SHOULD have done is gone to start menu, Strawberry Perl folder, and used the cpan module within that folder ! (Sorry, everyone!)

      But ... I've also found I have "C:/usr/perl/bin" - the same as the shebang ... which I thought was the one running ... but maybe not. I thought I would rename it, the theory being if 'redundant' and really using Strwaberry, the name change would go un-noticed. But ... (lots of 'buts') it reports that it is in use by another program, and cannot be changed. Which MUST mean it's being lauched at startup! Somehow

      Been to the startup folder in Users, but that only shows a few programs that are started up by choice. Tried the C:startup, and that has a lot of files, including Apache Monitor, (which doesn't start as no icon shown; properties says it has come from another computer, and has a block on it), makefile and similar. But nowehere can I see any entries that are loading "C:/usr/perl/bin"

      So,whilst not related to original question, how can I 'stop' usr/perl/bin so I can delete it?

      Of interest, here are my full paths:

      C:\Program Files (x86)\Common Files\Oracle\Java\javapath; C:\ProgramData\Oracle\Java\javapath; C:\usr\site\bin; C:\usr\bin; C:\Perl64\site\bin; C:\Perl64\bin; C:\Windows\system32; C:\Windows; C:\Windows\System32\Wbem; C:\Windows\System32\WindowsPowerShell\v1.0\; C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static; C:\Users\Chris Brown\AppData\Local\Smartbar\Application\; C:\Users\Chris Brown\AppData\Local\Smartbar\Application\; C:\Strawberry\c\bin; C:\Strawberry\perl\site\bin; C:\Strawberry\perl\bin; C:\PHP; C:\Program Files (x86)\QuickTime\QTSystem\; C:\usr\c\bin; C:\usr\perl\site\bin; C:\usr\perl\bin; C:\Users\CHRISB~1\perl5\bin

      (Looking at that, maybe PERL64 needs to go as well... and they're not even shown in programs/control panel to delete that way!) Oh, and one final point. Despite having the "notify me when someone replies to my post", I never get any notifications to the email address - which is correct

        it reports that it is in use by another program

        Process Explorer from Microsoft SysInternals is your friend. It allows for searching for what processes/DLLs have a file open (Ctrl+F, enter the search string), and for executables shows the hierarchy of comands. For example, when I run perl from Notepad++'s NppExec plugin, so it's in a little command shell, it shows the notepad++.exe > perl.exe call-chain: https://i.imgur.com/3CczLaH.png

        how can I 'stop' usr/perl/bin so I can delete it?

        you can kill any perl.exe using Task Manager or Process Explorer. If you're trying to stop the process that has a file or folder open, after searching in Process Explorer, it will tell you the PID of the process that has it open, so you can use Process Explorer or Task Manager to kill the process that's holding it open.

        edit:

        I never get any notifications to the email address

        Notifications go to your PerlMonks Message Inbox, not to your email. Perlmonks was designed to not send any email (except maybe a welcome email -- I don't remember for sure -- and your plaintext password when you request a password reset).

Re: Cannot access CPAN Installs
by Lotus1 (Vicar) on Dec 04, 2019 at 20:02 UTC

    Are you using a portable version of Strawberry Perl? If so you need to run C:\Strawberry\portableshell.bat before running cpan.

    To help us understand your setup please provide the output from these commands at the command prompt:

    perl -V:"install.*" where perl where cpan perl -V
Re: Cannot access CPAN Installs
by karlgoethebier (Abbot) on Dec 05, 2019 at 18:16 UTC

    BTW, as you are on windoz your/the shebang doesn’t matter. And the path you provide to use lib points to a module, not a folder where libraries usually reside. And do you have some other Perl installations on your box? Probably Cygwin? You may read Strawberry Perl: my @INC gets/is destroyed on XP after some days and some related nodes. Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

    perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Re: Cannot access CPAN Installs
by Anonymous Monk on Dec 05, 2019 at 02:21 UTC

    HELP !!

    Why don't you post the output of perl -V and similarly your cpan configuration?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-25 21:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found