Perl hooks with API calls
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
-
Hello :) The following thread, although a bit dated, may be helpful to you: How to automate SQL database creation upon new user creation Thank you. 0 -
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! 0
Please sign in to leave a comment.
Comments
2 comments