The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Adding Perl modules to the include path

Discussion in 'General Discussion' started by peterr, Jul 3, 2007.

  1. peterr

    peterr Well-Known Member

    Joined:
    Sep 24, 2003
    Messages:
    75
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Version 11.4.19-RELEASE
    cPanel Build 14379

    There is a Perl module I wanted to use, it wasn't installed on the system, so I went to install it. It installed okay via CPanel, but when I ran a Perl script, there was a message about the @INC variable (include path).

    I then added the code shown in CPanel ...


    and ran the script again. The 'include' seemed to work, in that now there are quite a few more paths in the error message from the perl script ..

    The Perl module "utils.pm" is in /home/username/perl/usr/lib/perl5/site_perl/5.8.7/Net/Abuse/

    Does the Perl code shown in CPanel (at https://example.com/frontend/x3/module_installers/index.html?lang=perl ) work correctly ? There are a lot of other paths that have been added to the @INC variable though, so it would seem it works.

    Just that the path where the module is hasn't been included. :confused:
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    I know this is off-topic, but are you sure you are running Perl 5.8.8? I know some people have encountered issues while running 5.8.7 with cPanel 11.

    For instructions on how to check and how to upgrade, check out this thread: http://forums.cpanel.net/showthread.php?t=66166
     
  3. peterr

    peterr Well-Known Member

    Joined:
    Sep 24, 2003
    Messages:
    75
    Likes Received:
    0
    Trophy Points:
    6
    Hmm, it seems not, a script just showed ..

    Thanks, I will have to get my hosting provider to upgrade to perl 5.8.8
     
  4. nopersonalive

    nopersonalive Registered

    Joined:
    Jul 5, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Where to add code

    Hello Peter, Where did you add the code? in the module you installed? or where?? Im new at this trying to install modules...
     
  5. Miraenda

    Miraenda Well-Known Member

    Joined:
    Jul 28, 2004
    Messages:
    242
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Coralville, Iowa USA
    If you go to your cPanel account > Perl Modules area, you will see the code indicated on the page:

    Code:
    You will need to add /home/username/perl to the include path.
    You can do this by adding the following code to your script:
    
    BEGIN {
        my $base_module_dir = (-d '/home/username/perl' ? '/home/username/perl' : ( getpwuid($>) )[7] . '/perl/');
        unshift @INC, map { $base_module_dir . $_ } @INC;
    }
    This is the code that is noted there (where username will be your cPanel username). It isn't added into the module but into your script that is using the module.
     
    #5 Miraenda, Jul 5, 2010
    Last edited: Jul 5, 2010
Loading...

Share This Page