Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

[CPANEL-23475] 3rd Party Perl Module Install Location

Discussion in 'General Discussion' started by Frank Jance, Jan 21, 2018.

Tags:
  1. Frank Jance

    Frank Jance Member

    Joined:
    Jan 13, 2018
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    When installing Perl modules to be used by cPanel's 3rd Party Perl, I use the following command:

    /usr/local/cpanel/3rdparty/perl/524/bin/cpan -i List::Compare

    However, the modules get installed here:

    # perldoc -l List::Compare
    /home/user/perl5/lib/perl5/List/Compare.pm


    Why is that? I get errors when trying to run a script, e.g.:

    Can't locate List/Compare.pm in @INC (you may need to install the List::Compare module) (@INC contains: /home/user/scripts/../perl/Modules /home/user/perl5/lib/perl5 /home/user/perl5/lib/perl5/x86_64-linux-thread-multi /home/user/perl/usr/local/cpanel /home/user/perl/usr/local/cpanel/3rdparty/perl/524/lib64/perl5/cpanel_lib/x86_64-linux-64int /home/user/perl/usr/local/cpanel/3rdparty/perl/524/lib64/perl5/cpanel_lib /home/user/perl/usr/local/cpanel/3rdparty/perl/524/lib64/perl5/5.24.1/x86_64-linux-64int /home/user/perl/usr/local/cpanel/3rdparty/perl/524/lib64/perl5/5.24.1 /home/user/perl/opt/cpanel/perl5/524/site_lib/x86_64-linux-64int /home/user/perl/opt/cpanel/perl5/524/site_lib /usr/local/cpanel /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/cpanel_lib/x86_64-linux-64int /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/cpanel_lib /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/5.24.1/x86_64-linux-64int /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/5.24.1 /opt/cpanel/perl5/524/site_lib/x86_64-linux-64int /opt/cpanel/perl5/524/site_lib) at /home/user/scripts/files_compare.pl line 23.
    BEGIN failed--compilation aborted at /home/user/scripts/files_compare.pl line 23.


    How can I get the modules to install in a location that the 3rd party Perl knows about?

    Thanks,
    Frank
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,442
    Likes Received:
    1,961
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello Frank,

    The following documents include information about using Perl in the cPanel environment:

    Guide to Perl in cPanel - Perl Environments - Software Development Kit - cPanel Documentation
    Prepare Perl Scripts for Our Internal Perl - cPanel Knowledge Base - cPanel Documentation

    What shebang are you using at the beginning of your Perl script? Additionally, note the following quote from our Documentation:

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Frank Jance

    Frank Jance Member

    Joined:
    Jan 13, 2018
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    This is the shebang I'm using:

    #!/usr/local/cpanel/3rdparty/bin/perl

    The weird thing about what I posted above is that "/home/user/perl5/lib/perl5" shows as being included in @INC in the error message, so why would pushing it onto @INC solve the problem?

    That 2nd link you posted says:

    "Install custom modules for this Perl environment into the /opt/cpanel/perl5/524/site_lib directory."

    Shouldn't that command install modules there on it's own, or do I need to add a path to that directory?

    /usr/local/cpanel/3rdparty/perl/524/bin/cpan -i Module::Name

    I would think that using that command, the modules would automatically be usable by that version of Perl without have to append to @INC.

    Thanks for the help,
    Frank
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,442
    Likes Received:
    1,961
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    Could you open a support ticket using the link in my signature so we can take a closer look?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. dont_panic

    dont_panic Member

    Joined:
    Nov 7, 2018
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Prague
    cPanel Access Level:
    Root Administrator
    Hello,

    I am facing the same questions - can you share what you discovered?

    I am attempting to install Linode's Longview monitoring client on a CPanel/WHM 74 CentOS 6.10 server. It is a perl script, and it will not run using the system perl (the script shebang is #!/usr/bin/env perl). It fails with:

    Code:
    11/07 07:53:05 INFO Longview[19190] - 500 Can't connect to longview.linode.com:443 (Network is unreachable)
    11/07 07:53:05 INFO Longview[19190] - Can't connect to longview.linode.com:443 (Network is unreachable)
    
    LWP::Protocol::https::Socket: connect: Network is unreachable at /usr/local/share/perl5/LWP/Protocol/http.pm line 47.
    
    I can reach that host with curl just fine, so I don't believe it is actually a firewall/network problem. Linode support suggest it is the system's old version of perl (5.10.1), so I am trying to use the more up to date 3rd party version (5.26) which is also installed.

    I modified the script shebang to use the 3rd party perl (#!/usr/local/cpanel/3rdparty/bin/perl), but now it fails bcs it is missing modules:

    Code:
    Starting longview (With Debug Flag): Can't locate Log/LogLite.pm in @INC (you may need to install the Log::LogLite module) (@INC contains: 
    /usr/local/cpanel
    /usr/local/cpanel/3rdparty/perl/526/lib64/perl5/cpanel_lib/x86_64-linux-64int
    /usr/local/cpanel/3rdparty/perl/526/lib64/perl5/cpanel_lib
    /usr/local/cpanel/3rdparty/perl/526/lib64/perl5/5.26.0/x86_64-linux-64int
    /usr/local/cpanel/3rdparty/perl/526/lib64/perl5/5.26.0
    /opt/cpanel/perl5/526/site_lib/x86_64-linux-64int
    /opt/cpanel/perl5/526/site_lib
    /opt/linode/longview/Linode/../
    /opt/linode/longview/Linode/../lib/perl5
    /opt/linode/longview/Linode/../lib/perl5/x86_64-linux-64int/
    /opt/linode/longview/Linode/../usr/include)
    at /opt/linode/longview/Linode/../Linode/Longview/Logger.pm line 10.
    
    /opt/cpanel/perl5 does not exist, so there are certainly no modules in /opt/cpanel/perl5/526/site_lib - it looks like there are no modules installed for this 3rd party 5.26 Perl?

    I found this WHM doc which describes using /usr/local/cpanel/3rdparty/perl/<version>/bin/cpan, exactly as the OP describes, and also like the OP I want to make sure whatever I install goes a) in the right place, so that perl 5.26 can find it, and b) does not interfere with the system perl.

    Did you resolve this issue, or if not, any suggestions about what I should do? Any help appreciated.

    Thanks.
     
  6. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,442
    Likes Received:
    1,961
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @dont_panic,

    This topic was recently brought up as part of internal case CPANEL-23475. It was determined that the best approach to install modules for cPanel's Perl version is by using cpanm. For example:

    Code:
    /usr/local/cpanel/3rdparty/bin/perl /usr/local/cpanel/bin/cpanm Log::LogLite
    We have a documentation case open (DOC-11763) to ensure the existing document on this topic is updated to reflect this information. Can you let me know if using the above command helps?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. dont_panic

    dont_panic Member

    Joined:
    Nov 7, 2018
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Prague
    cPanel Access Level:
    Root Administrator
    Thanks for the reply.

    I can confirm that command worked, and installed modules to /opt/cpanel/perl5/526/site_lib.

    The longview script now generates a different error, so I assume that means it can find the newly installed Log::LogLite module, so I think that part is a success, thank you.

    [Moved separate issue to a new thread at New Thread - Question about Perl header files when using cPanel's Perl ]
     
    #7 dont_panic, Nov 9, 2018
    Last edited by a moderator: Nov 9, 2018
  8. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,442
    Likes Received:
    1,961
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice