I had a working custom cPanel module in /usr/local/cpanel/Cpanel/API that works with calls to...
...which stopped working in a new WHM version. The error in /usr/local/cpanel/logs/error_log is below:
-------------------------
[2023-11-17 07:58:12 +0000] die [Internal Death while parsing unknown 501082] Cannot convert a reference to HASH to typeglob at /usr/local/cpanel/Cpanel/API.pm line 367.
at /usr/local/cpanel/Cpanel/API.pm line 367.
Cpanel::API::_run_module_function(Cpanel::Args=HASH(0x29952c8), Cpanel::Result=HASH(0x2994fd0), "ExampleDevModule", "test_function") called at /usr/local/cpanel/Cpanel/API.pm line 253
Cpanel::API::execute("StarshipDev", "test_function", HASH(0x2994c10)) called at cpanel.pl line 1344
cpanel::cpanel::docpanelaction(HASH(0x2994e08)) called at cpanel.pl line 4587
cpanel::cpanel::run_fast_json_mode() called at cpanel.pl line 927
cpanel::cpanel::script("cpanel::cpanel", "--json-fast-connect", "--stdin") called at cpanel.pl line 324
Cannot convert a reference to HASH to typeglob at /usr/local/cpanel/Cpanel/API.pm line 367.
-------------------------
The error is not possible to debug since it does not give any info about what may be wrong in the module. It also gives the feeling that this module template may now be outdated since it looks like it cant even run the module function. But I cant find any example .pm modules anywhere on the internet and the one at github is from ten years ago. Checking other modules in the API dir does not give enough info about what could be wrong. Also developer documentation is all over the place, links and references given from forum threads or other cpanel documentation end up in 404. I spent an hour in between dead links in between the forum, old documentation etc.
Can someone point me in the direction of an up to date .pm module template or an actual, up to date, working documentation that exemplifies how to implement a module file for this endpoint? Alternatively anything that would allow me to call a WHM api and run a root-owned bash script or a root-owned PHP script in some folder inside the server to do some custom stuff would also work. (I may also run whm and cpanel commands from those scripts)
...which stopped working in a new WHM version. The error in /usr/local/cpanel/logs/error_log is below:
-------------------------
[2023-11-17 07:58:12 +0000] die [Internal Death while parsing unknown 501082] Cannot convert a reference to HASH to typeglob at /usr/local/cpanel/Cpanel/API.pm line 367.
at /usr/local/cpanel/Cpanel/API.pm line 367.
Cpanel::API::_run_module_function(Cpanel::Args=HASH(0x29952c8), Cpanel::Result=HASH(0x2994fd0), "ExampleDevModule", "test_function") called at /usr/local/cpanel/Cpanel/API.pm line 253
Cpanel::API::execute("StarshipDev", "test_function", HASH(0x2994c10)) called at cpanel.pl line 1344
cpanel::cpanel::docpanelaction(HASH(0x2994e08)) called at cpanel.pl line 4587
cpanel::cpanel::run_fast_json_mode() called at cpanel.pl line 927
cpanel::cpanel::script("cpanel::cpanel", "--json-fast-connect", "--stdin") called at cpanel.pl line 324
Cannot convert a reference to HASH to typeglob at /usr/local/cpanel/Cpanel/API.pm line 367.
-------------------------
The error is not possible to debug since it does not give any info about what may be wrong in the module. It also gives the feeling that this module template may now be outdated since it looks like it cant even run the module function. But I cant find any example .pm modules anywhere on the internet and the one at github is from ten years ago. Checking other modules in the API dir does not give enough info about what could be wrong. Also developer documentation is all over the place, links and references given from forum threads or other cpanel documentation end up in 404. I spent an hour in between dead links in between the forum, old documentation etc.
Can someone point me in the direction of an up to date .pm module template or an actual, up to date, working documentation that exemplifies how to implement a module file for this endpoint? Alternatively anything that would allow me to call a WHM api and run a root-owned bash script or a root-owned PHP script in some folder inside the server to do some custom stuff would also work. (I may also run whm and cpanel commands from those scripts)
Last edited: