One of the most flexible ways of working within cPanel is by creating CGI applications. Of course, this isn’t the most efficient method, however sometimes efficiency isn’t your best bet when you’re in a rush. You can use a standard CGI script within cPanel, you are limited by our APIs, such as what perl version to use.
First thing to note, is that these CGI scripts have to be placed in /usr/local/cpanel/base/3rdparty/ with normal CGI permissions (have to be executable by the user, cannot be globally writable, etc). Once placed here it can be accessed via $IP:2083/3rdparty/scriptnamed.cgi. If you place them anywhere else within the cPanel document root, they will be offered up for download rather than executable.
When these CGI scripts are executed, they are executed as the user, so limited permissions apply.
my $xml = Cpanel::XML::cpanel_exec_fast(
'cpanel_xmlapi_module' => 'Email',
'cpanel_xmlapi_func' => 'listpopswithdisk',
$xml = XMLin($xml);
Now $xml is a hash reference containing all the information returned by the call.
To download the example of this in use, click here.