Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

My local libs are not being used by my browser

by Lady_Aleena (Curate)
on Sep 28, 2016 at 23:50 UTC ( #1172875=perlquestion: print w/replies, xml ) Need Help??
Lady_Aleena has asked for the wisdom of the Perl Monks concerning the following question:

Hello all. I am having a problem with my browser not recognizing my local libs. I set them up because I was told installing modules with sudo cpan and putting them in the main libs was not great. So I set up my local libs and installed all kinds of modules into them, got apache set up so I could view my website in my browser, but the browser does not use my local libs.

Here is the result of perl -e 'print "$_\n" for sort @INC' on the command line:

. /etc/perl /home/me/Documents/fantasy/files/lib /home/me/perl5/lib/perl5 /home/me/perl5/lib/perl5/5.20.0 /home/me/perl5/lib/perl5/5.20.2 /home/me/perl5/lib/perl5/5.20.2/x86_64-linux-gnu-thread-multi /home/me/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /usr/lib/x86_64-linux-gnu/perl/5.20 /usr/lib/x86_64-linux-gnu/perl5/5.20 /usr/local/lib/site_perl /usr/local/lib/x86_64-linux-gnu/perl/5.20.2 /usr/local/share/perl/5.20.2 /usr/share/perl/5.20 /usr/share/perl5

Here is the list of libs my browser is looking in:

files/lib /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.20.2 /usr/local/share/perl/5.20.2 /usr/lib/x86_64-linux-gnu/perl5/5.20 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.20 /usr/share/perl/5.20 /usr/local/lib/site_perl

I ran echo 'eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"' >>~/.bashrc at the command line, and it added the following lines to my .bashrc file:

PATH="/home/me/perl5/bin${PATH:+:${PATH}}"; export PATH; PERL5LIB="/home/me/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export P +ERL5LIB; PERL_LOCAL_LIB_ROOT="/home/me/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCA +L_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT; PERL_MB_OPT="--install_base \"/home/me/perl5\""; export PERL_MB_OPT; PERL_MM_OPT="INSTALL_BASE=/home/me/perl5"; export PERL_MM_OPT; eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"

I already have several PATH statements above these lines and a PERL5LIB line, so I do not know if there is a conflict. Here are the lines:

# My changes to things # export LC_ALL=C export LC_COLLATE=C export LESS=-SXi export PERL5LIB="$HOME/Documents/fantasy/files/lib" PATH="$PATH:$HOME/bin" PATH="$PATH:$HOME/Documents/fantasy" PATH="$PATH:$HOME/Documents/scripts" export PATH setterm --linewrap off

So can anyone tell me what I am missing here?

Thank you!

No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
Lady Aleena

Replies are listed 'Best First'.
Re: My local libs are not being used by my browser
by Your Mother (Chancellor) on Sep 29, 2016 at 01:44 UTC

    *Probably* just put this at the top of your CGIs(? If not CGIs, follow up with more info).

    use local::lib "/home/me/perl5";

    As Anymonk alluded, apache runs the webserver and knows nothing about your environment and shell. You can set this up in your apache config files but putting it in the scripts/CGIs is probably easier, clearer for now.

      Your Mother, that won't work. My scripts have been written in such a way that they can be uploaded to a remote server and work just as they do on my computer. So, if I add that line to my scripts locally, they will break remotely since my remote host does not have a directory called /home/me/perl5. I do not know where they remote host puts the local libs, all I know is they work there.

      So, if I can not get apache to see my local libs, I will sudo cpan all the modules to to root's libs and let the local libs just sit there.

      No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
      Lady Aleena

        You can easily print the list of library paths in @INC (see later). After omitting seemingly system paths (depends on your system environment), you would (hopefully) be left with the path(s) related to your account. Use that path in use lib ....

        Create the CGI program that will run ...

        print join "\n", sort @INC;
Re: My local libs are not being used by my browser
by Your Mother (Chancellor) on Sep 29, 2016 at 12:47 UTC

    Messing with the system Perl is a very bad idea. Depending on your OS, you could hose your computer. And if I'm following, it won't fix your real problem even if it works. Let's backup.

    You seem to be talking about two different setups. Your home computer/server and your host server. Is this right?

    Installing things in your system on your computer will have no effect on a remote host/server. Can you upload files/directories to your host *outside* your cgi-bin and your www-root?

    Do you have a shell account to ssh into your host? Or is it pure (S)FTP?

      I have /home/me/Documents/fantasy (where my site lives on my computer) and the location on Xecu.net. Everything on Xecu.net is fine, I can install modules into a local lib they set up for me. It is local libs in /home/me/perl5 which my Apache is ignoring because I do not know how to tell Apache to look at them.

      One way to avoid having to wrestle Apache anymore is to just sudo cpan modules instead of just cpan modules. I did it that way on my last install of Debian because I did not know how to set up local libs.

      I upload files to Xecu.net with FileZilla. I never use the terminal emulator to upload files to Xecu.net.

      That reminds me, I need to set up FileZilla again.

      No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
      Lady Aleena

        I'm still not clear on your setup. But if I'm following you, this might do it. It's not pretty, has to go in the top of every CGI, but it will allow you to use local::lib locally and on your host without messing with apache or apache's ENV.

        #!/usr/bin/env perl use strict; use warnings; my $local_lib; BEGIN { $local_lib = $YOUR_XECU_LOCAL_LIB_DIR if -d $YOUR_XECU_LOCAL_LIB +_DIR; $local_lib ||= $YOUR_HOME_COMPUTER_LOCAL_LIB_DIR; }; use local::lib $local_lib; # ... your script ...
Re: My local libs are not being used by my apache ( apache doenst load .bashrc)
by Anonymous Monk on Sep 29, 2016 at 00:08 UTC
    Hi

    .bashrc ..

    Ask yourself what .bashrc has to do with apache?

    The answer is nothing, apache doesn't load .bashrc

    Hello all. I am having a problem with my browser not recognizing my local libs

    Hi, browser has nothing to do with it, browser is not apache, it doesn't set env vars, it doesn't affect @INC, its got nothing to do with perl

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1172875]
Approved by Old_Gray_Bear
help
Chatterbox?
[sierpinski]: thanks LanX that helps
[haukex]: the first index is always 0 - $#array gives you the last index in @array
[sierpinski]: gotcha, thanks
[LanX]: length = last index +1

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (16)
As of 2017-12-13 16:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (369 votes). Check out past polls.

    Notices?