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.

Perl hooks with API calls

Discussion in 'cPanel Developers' started by rkv_wwi, Sep 19, 2013.

  1. rkv_wwi

    rkv_wwi Member

    Joined:
    Jun 3, 2013
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    Greetings!

    So I've managed to hook into the 'Accounts::Create' process by writing a Perl module and /usr/local/cpanel/bin/manage_hooks add'ing it to the system. The hook runs fine, albeit with a rather ancient Perl and next to no external modules. So far, so good.

    What I'd like to end up with, is that this hook automatically creates a database for the newly created user. I gather that, for creating databases, I should be using one of the numerous (and rather poorly documented, I might add) API's. Do I have any way of calling any of these from my Perl module hook? Does anybody have an example lying around, which I could perhaps have a look at?

    I'm rather confused by now, in no little part due to the abundance of API's (LiveAPI, PublicAPI, UAPI, APIv1, APIv2) and lack of, or, at best, conflicting information as to which one is considered 'best practice' to utilize in this regard, so I'd be grateful for any input :)

    Cheers,
    R. Vestergaard
     
  2. rkv_wwi

    rkv_wwi Member

    Joined:
    Jun 3, 2013
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    Michael,

    Brilliant! Moving to a script hook instead of a module, and letting myself inspire from the code in your link did the trick.

    Thank you very much!
     
Loading...

Share This Page