The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WHM Perl Modules Documentation

Discussion in 'cPanel Developers' started by nickp666, Oct 28, 2008.

  1. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    770
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    /dev/null
    I am presently developing some plugins for WHM, but am unable to find any documentation whatsoever on any of the Whostmgr:: perl modules, I have managed to cobble a few things together by looking at chirpys work but dont know where to look for docs on the methods available.

    For example, im looking for a list of methods for: Whostmgr::HTMLInterface

    Does anyone know where I can find this info out?

    TIA
     
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Perl methods look like:

    Code:
    sub foo{
    
    Thus, looking at all the lines that start with sub will give you a list of methods. As for parameters, those are usually just underneath the method name, like:

    Code:
    my( $self, $one, $two) =@_;
    
    or
    Code:
    my $self = shift;
    my $one = shift;
    my $two = shift;
    
    where $one and $two are the arguments you provide and $self[/$b] is a reference to the object (not all will have $self).

    UPDATE:
    As for documentation itself, that is what the code is for.
     
    #2 cPanelKenneth, Oct 28, 2008
    Last edited: Oct 28, 2008
  3. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    770
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    /dev/null
    Thanks Kenneth, where will i find the perl module files?

    TIA
     
  4. DaveUsedToWorkHere

    DaveUsedToWorkHere Well-Known Member

    Joined:
    Dec 28, 2001
    Messages:
    689
    Likes Received:
    1
    Trophy Points:
    18
    /usr/local/cpanel/Whostmgr/

    on any cPanel server. If you are looking to access specific WHM methods, the preferred method is through the XML API:

    http://www.cpanel.net/plugins/xmlapi/

    We do not recommend relying on perl modules as they will not remain constant.
     
  5. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    770
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    /dev/null
    The plugins I am developing have no need for the functions provided by the XMLAPI.

    I noticed this morning with the latest CURRENT that Whostmgr::HTMLInterface has been changed - surely this is a pre-requisite to any WHM Plugin?
     
  6. DaveUsedToWorkHere

    DaveUsedToWorkHere Well-Known Member

    Joined:
    Dec 28, 2001
    Messages:
    689
    Likes Received:
    1
    Trophy Points:
    18
    While utilizing these libraries can help out, it is not required. We cannot guarantee that these modules will not change, in fact they change frequently to provide new/updated features in WHM. The core aspects of the software are provided through APIs and hooks which retain backwards compatibility.
     
  7. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    770
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    /dev/null
    Thanks for the clarification, but is there some way we can be notified when there are changes to the WHM perl modules (as the changelog is a little unspecific)

    Every plugin I have ever looked at for WHM (and every plugin I have developed) makes use of:

    Cpanel::Form
    Whostmgr::HTMLInterface
    Whostmgr::ACLS
    Cpanel::SafeFile

    It would be nice to know when changes are made to these as they are so commonly used, realistically specific changes dont need to be detailed, as plugin developers should be expected to actually read the syntax, but knowing when we need to would be a good idea rather than waiting for our clients to scream that plugins dont work :)
     
    #7 nickp666, Nov 4, 2008
    Last edited: Nov 4, 2008
  8. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,426
    Likes Received:
    2
    Trophy Points:
    38
    cPanel Access Level:
    DataCenter Provider
    All 4 of those as well as Whostmgr::UI are generally kept backwards compatible
     
  9. DaveUsedToWorkHere

    DaveUsedToWorkHere Well-Known Member

    Joined:
    Dec 28, 2001
    Messages:
    689
    Likes Received:
    1
    Trophy Points:
    18
    Nick,
    We typically don't document changes to the modules as we don't encourage plugin developers to develop against these modules. We can offer you a development license however which can be set to a tree that will provide insight on changes before they hit your users. Please pm me for info on getting a development license set up.
     
Loading...

Share This Page