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!

Error: hook not found when registering a perl module

Discussion in 'cPanel Developers' started by ansgarat, Apr 25, 2012.

  1. ansgarat

    ansgarat Registered

    Joined:
    Nov 18, 2011
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Root Administrator
    Hi, I'm having problems with registering a perl module hook (WHM 11.32). I created a perl module following the example in the cpanel docs but when trying to register it, I got the error "Hook not found".

    So I took the sample code directly from the docs (from here), and placed it in the file /var/cpanel/perl5/lib/MyApp/WHM.pm on the server (as instructed). Then I executed the register command from the docs:

    root@host [/usr/local/cpanel/bin]# ./manage_hooks add module MyApp::WHM

    and I still got a "Hook not found" error.

    The file WHM.pm is executable (0777). What am I missing? The code taken directly from the docs should have worked...

    Thank you for your help.
     
  2. KostonConsulting

    KostonConsulting Well-Known Member

    Joined:
    Jun 17, 2010
    Messages:
    255
    Likes Received:
    1
    Trophy Points:
    68
    Location:
    San Francisco, CA
    cPanel Access Level:
    Root Administrator
    The example isn't actually valid as it does not return a true value. Your module will need to return a true value for it to work. Add this line to the bottom of your .pm file:

    Code:
    1;
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. NetMantis

    NetMantis BANNED

    Joined:
    Apr 22, 2012
    Messages:
    116
    Likes Received:
    1
    Trophy Points:
    66
    Location:
    Utah
    cPanel Access Level:
    DataCenter Provider
    Side footnote, make that 0755
     
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