API-CPanel

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

--- #YAML:1.0
name:               API-CPanel
version:            0.09
abstract:           interface to the CPanel Hosting Panel API ( http://cpanel.net )
author:
    - Konstantin Vlasov <knvlasov@reg.ru>
license:            unknown
distribution_type:  module
configure_requires:
    ExtUtils::MakeMaker:  0
build_requires:
    ExtUtils::MakeMaker:  0
requires:
    Data::Dumper:    0
    Exporter::Lite:  0
    Getopt::Long:    0
    LWP::UserAgent:  0
    XML::Simple:     0

README  view on Meta::CPAN

that should be provided before the module is installed.

A README file is required for CPAN modules since CPAN extracts the
README file from a module distribution so that people browsing the
archive can use it get an idea of the modules uses. It is usually a
good idea to provide version information here so that people can
decide whether fixes for the module are worth downloading.

INSTALLATION

To install this module type the following:

   perl Makefile.PL
   make
   make test
   make install

DEPENDENCIES

This module requires these other modules and libraries:

lib/API/CPanel.pm  view on Meta::CPAN


    return '' unless ( $query_string && $auth_hash );
    warn "Auth hash: $auth_hash\nQuery string: $query_string\n" if $DEBUG;

    my $ua = LWP::UserAgent->new;
    my $request = HTTP::Request->new( GET => $query_string );
    $request->header( Authorization => $auth_hash );
    my $response = $ua->request( $request );

    my $content = $response->content;
    if ($response->header('content-type') eq 'text/xml') {
        warn $content if $DEBUG;
        return $content;
    } else {
        return '';
    }
}

# Parse answer
# STATIC(HASHREF: params)
# params:

t/01-test.t  view on Meta::CPAN


#diag Dumper( $result );

# Mysql òåñòû

$API::CPanel::FAKE_ANSWER = ! $ONLINE ? <<THEEND : undef;
<?xml version="1.0" ?>
<cpanelresult>
    <module>Mysql</module>
    <func>adduser</func>
    <type>event</type>
    <source>internal</source>
    <apiversion>1</apiversion>
    <data>
        <result></result>
    </data>
    <event>
        <result>1</result>
     </event>
</cpanelresult>
THEEND

t/01-test.t  view on Meta::CPAN

        password   => 'test13pass',
    }
);
is( $result, 1, 'API::CPanel::Mysql::adduser');

$API::CPanel::FAKE_ANSWER = ! $ONLINE ? <<THEEND : undef;
<?xml version="1.0" ?>
<cpanelresult>
    <module>Mysql</module>
    <func>adddb</func>
    <type>event</type>
    <source>internal</source>
    <apiversion>1</apiversion>
    <data>
        <result></result>
    </data>
    <event>
        <result>1</result>
    </event>
</cpanelresult>
THEEND

t/01-test.t  view on Meta::CPAN

    }
);
is( $result, 1, 'API::CPanel::Mysql::adddb');


$API::CPanel::FAKE_ANSWER = ! $ONLINE ? <<THEEND : undef;
<?xml version="1.0" ?>
<cpanelresult>
    <module>Mysql</module>
    <func>adduserdb</func>
    <type>event</type>
    <source>internal</source>
    <apiversion>1</apiversion>
    <data>
        <result></result>
    </data>
    <event>
        <result>1</result>
    </event>
</cpanelresult>
THEEND



( run in 0.854 second using v1.01-cache-2.11-cpan-df04353d9ac )