SOLVED Calling custom Perl module issue

srkumar1986

Member
Mar 28, 2018
13
2
3
Coimbatore, Tamil Nadu
cPanel Access Level
Root Administrator
Hello,

I have created new Perl Module. In that, I have created subfunction to load details of certificates.

When i am calling the module and subfunction to my view file, it throws an error as below
"Failed to load module “CertificateDetails”: "

Module code :
Code:
sub load_certificate_details {
my ( $args, $result ) = @_;
my @certdetails;

my $cert_data = Crypt::OpenSSL::X509->new_from_file('cert.pem');

push @certdetails, $cert_data->issuer();
push @certdetails, $cert_data->email();

$result->data( \@certdetails );

return 1;

}
View file code :
Code:
$certficate_details = $cpanel->uapi(
'CertificateDetails', 'load_certificate_details'
);
Can anyone guide me what's wrong on this, please?

Thanks in advance!
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
I have placed my pm files in "/usr/local/cpanel/Cpanel/API/"
Hello,

Can you verify the module is named with the correct capitalization (E.g. /usr/local/cpanel/Cpanel/API/CertificateDetails.pm)? Also, have you added any other files to this location? If so, note the following warning on our Custom UAPI Modules document:

cPanel & WHM treats all of the modules in the /usr/local/cpanel/Cpanel/API/ directory as UAPI modules.
  • We recommend that you only save module files (.pm) to this location.
  • The presence of other files may cause problems, even if the files relate to your custom modules.
Thank you.
 

srkumar1986

Member
Mar 28, 2018
13
2
3
Coimbatore, Tamil Nadu
cPanel Access Level
Root Administrator
Hello,

Can you verify the module is named with the correct capitalization (E.g. /usr/local/cpanel/Cpanel/API/CertificateDetails.pm)? Also, have you added any other files to this location? If so, note the following warning on our Custom UAPI Modules document:



Thank you.
Hello,

Thank you for prompt reply.

Checked the capitalization. its the same as CertificateDetails.pm

Also, I have missed some basic things upon writing Perl Modules. I have corrected after checking the links which you've posted and some more in Perlmonks.

Now its working fine.

Thank you!
 
  • Like
Reactions: cPanelMichael