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.

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:
    1
    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:
    18
    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;
    
     
  3. NetMantis

    NetMantis BANNED

    Joined:
    Apr 22, 2012
    Messages:
    117
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Utah
    cPanel Access Level:
    DataCenter Provider
    Side footnote, make that 0755
     
Loading...

Share This Page