Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

SOLVED Calling custom Perl module issue

Discussion in 'cPanel Developers' started by srkumar1986, Mar 28, 2018.

  1. srkumar1986

    srkumar1986 Member

    Joined:
    Mar 28, 2018
    Messages:
    13
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    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!
     
    #1 srkumar1986, Mar 28, 2018
    Last edited by a moderator: Mar 28, 2018
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,569
    Likes Received:
    45
    Trophy Points:
    308
    cPanel Access Level:
    Root Administrator
    Hi,

    Where do you have the CertificateDetails.pm file?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. srkumar1986

    srkumar1986 Member

    Joined:
    Mar 28, 2018
    Messages:
    13
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Coimbatore, Tamil Nadu
    cPanel Access Level:
    Root Administrator
    I have placed my pm files in "/usr/local/cpanel/Cpanel/API/"

    Thanks
    Rajkumar S
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,442
    Likes Received:
    1,961
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. srkumar1986

    srkumar1986 Member

    Joined:
    Mar 28, 2018
    Messages:
    13
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Coimbatore, Tamil Nadu
    cPanel Access Level:
    Root Administrator
    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!
     
    cPanelMichael likes this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice