summaryrefslogtreecommitdiff
path: root/lib/Net/Plesk
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Net/Plesk')
-rw-r--r--lib/Net/Plesk/Method.pm87
-rw-r--r--lib/Net/Plesk/Method/client_add.pm108
-rw-r--r--lib/Net/Plesk/Method/client_get.pm82
-rw-r--r--lib/Net/Plesk/Method/client_ippool_add_ip.pm79
-rw-r--r--lib/Net/Plesk/Method/domain_add.pm85
-rw-r--r--lib/Net/Plesk/Method/domain_del.pm76
-rw-r--r--lib/Net/Plesk/Method/domain_get.pm80
-rw-r--r--lib/Net/Plesk/Method/mail_add.pm87
-rw-r--r--lib/Net/Plesk/Method/mail_remove.pm83
-rw-r--r--lib/Net/Plesk/Method/mail_set.pm96
-rw-r--r--lib/Net/Plesk/Response.pm114
11 files changed, 977 insertions, 0 deletions
diff --git a/lib/Net/Plesk/Method.pm b/lib/Net/Plesk/Method.pm
new file mode 100644
index 0000000..df2acd4
--- /dev/null
+++ b/lib/Net/Plesk/Method.pm
@@ -0,0 +1,87 @@
+package Net::Plesk::Method;
+
+use strict;
+
+use vars qw( $VERSION @ISA $AUTOLOAD $DEBUG );
+
+$VERSION = '0.01';
+
+$DEBUG = 0;
+
+my %char_entities = (
+ '&' => '&',
+ '<' => '&lt;',
+ '>' => '&gt;',
+);
+
+=head1 NAME
+
+Net::Plesk::Method - Perl base class for Plesk XML Remote API Method
+
+=head1 SYNOPSIS
+
+ use Exporter;
+ @ISA = qw( Net::Plesk::Method );
+
+=head1 DESCRIPTION
+
+This module implements a base class for constructing requests using SWSOFT's
+Plesk.
+
+=head1 METHODS
+
+=over 4
+
+=item new
+
+Creates a new Net::Plesk::Method object and initializes it.
+=cut
+
+sub new {
+ my $proto = shift;
+ my $class = ref($proto) || $proto;
+ my $me;
+ my $self = \$me;
+ bless($self, $class);
+ $self->init(@_);
+ return $self;
+}
+
+
+=item encode
+
+Returns the xml encoded entity
+
+=cut
+
+sub encode {
+ my ($self,$value) = (shift,shift);
+ $value =~ s/([&<>])/$char_entities{$1}/ge;
+ return $value;
+}
+
+=back
+
+=head1 BUGS
+
+ Creepy crawlies.
+
+=head1 SEE ALSO
+
+SWSOFT Plesk Remote API documentation (1.4.0.0 or later)
+
+=head1 AUTHOR
+
+Jeff Finucane E<lt>jeff@cmh.netE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2006 Jeff Finucane
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
+
diff --git a/lib/Net/Plesk/Method/client_add.pm b/lib/Net/Plesk/Method/client_add.pm
new file mode 100644
index 0000000..6cda065
--- /dev/null
+++ b/lib/Net/Plesk/Method/client_add.pm
@@ -0,0 +1,108 @@
+package Net::Plesk::Method::client_add;
+
+use strict;
+
+use vars qw( $VERSION @ISA $AUTOLOAD $DEBUG );
+
+@ISA = qw ( Net::Plesk::Method );
+$VERSION = '0.01';
+
+$DEBUG = 0;
+
+=head1 NAME
+
+Net::Plesk::Method::client_add - Perl extension for Plesk XML Remote API client addition
+
+=head1 SYNOPSIS
+
+ use Net::Plesk::Method::client_add
+
+ my $p = new Net::Plesk::client_add ( $clientID, 'client.com' );
+
+=head1 DESCRIPTION
+
+This module implements an interface to construct a request for a client
+addition using SWSOFT's Plesk.
+
+=head1 METHODS
+
+=over 4
+
+=item init args ...
+
+Initializes a Plesk client_add object. The I<login> and I<password>
+options are required.
+
+=cut
+
+sub init {
+ my ($self, $pname, $login, $passwd, $phone, $fax, $email, $address, $city,
+ $state, $pcode, $country) = @_;
+ $$self = join ( "\n", (
+ '<client>',
+ '<add>',
+ '<gen_info>',
+ '<pname>',
+ $self->encode($pname),
+ '</pname>',
+ '<login>',
+ $self->encode($login),
+ '</login>',
+ '<passwd>',
+ $self->encode($passwd),
+ '</passwd>',
+ '<phone>',
+ $self->encode($phone),
+ '</phone>',
+ '<fax>',
+ $self->encode($fax),
+ '</fax>',
+ '<email>',
+ $self->encode($email),
+ '</email>',
+ '<address>',
+ $self->encode($address),
+ '</address>',
+ '<city>',
+ $self->encode($city),
+ '</city>',
+ '<state>',
+ $self->encode($state),
+ '</state>',
+ '<pcode>',
+ $self->encode($pcode),
+ '</pcode>',
+ '<country>',
+ $self->encode($country),
+ '</country>',
+ '</gen_info>',
+ '</add>',
+ '</client>',
+ ));
+}
+
+=back
+
+=head1 BUGS
+
+ Creepy crawlies.
+
+=head1 SEE ALSO
+
+SWSOFT Plesk Remote API documentation (1.4.0.0 or later)
+
+=head1 AUTHOR
+
+Jeff Finucane E<lt>jeff@cmh.netE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2006 Jeff Finucane
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
+
diff --git a/lib/Net/Plesk/Method/client_get.pm b/lib/Net/Plesk/Method/client_get.pm
new file mode 100644
index 0000000..5118ea7
--- /dev/null
+++ b/lib/Net/Plesk/Method/client_get.pm
@@ -0,0 +1,82 @@
+package Net::Plesk::Method::client_get;
+
+use strict;
+
+use vars qw( $VERSION @ISA $AUTOLOAD $DEBUG );
+
+@ISA = qw( Net::Plesk::Method );
+$VERSION = '0.01';
+
+$DEBUG = 0;
+
+=head1 NAME
+
+Net::Plesk::Method::client_get - Perl extension for Plesk XML Remote API client
+ retrieval
+
+=head1 SYNOPSIS
+
+ use Net::Plesk::Method::client_get
+
+ my $p = new Net::Plesk::Method::client_get ( $login );
+
+ $request = $p->endcode;
+
+=head1 DESCRIPTION
+
+This module implements an interface to construct a request for a client
+retrieval using SWSOFT's Plesk.
+
+=head1 METHODS
+
+=over 4
+
+=item init args ...
+
+Initializes a Plesk client_get object. The I<login> options is required.
+
+=cut
+
+sub init {
+ my ($self, $login) = (shift, shift);
+ $$self = join ( "\n", (
+ '<client>',
+ '<get>',
+ '<filter>',
+ '<login>',
+ $self->encode($login),
+ '</login>',
+ '</filter>',
+ '<dataset>',
+ '<gen_info/>',
+ '</dataset>',
+ '</get>',
+ '</client>',
+ ));
+}
+
+=back
+
+=head1 BUGS
+
+ Creepy crawlies.
+
+=head1 SEE ALSO
+
+SWSOFT Plesk Remote API documentation (1.4.0.0 or later)
+
+=head1 AUTHOR
+
+Jeff Finucane E<lt>jeff@cmh.netE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2006 Jeff Finucane
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
+
diff --git a/lib/Net/Plesk/Method/client_ippool_add_ip.pm b/lib/Net/Plesk/Method/client_ippool_add_ip.pm
new file mode 100644
index 0000000..bafd5dd
--- /dev/null
+++ b/lib/Net/Plesk/Method/client_ippool_add_ip.pm
@@ -0,0 +1,79 @@
+package Net::Plesk::Method::client_ippool_add_ip;
+
+use strict;
+
+use vars qw( $VERSION @ISA $AUTOLOAD $DEBUG );
+
+@ISA = qw( Net::Plesk::Method );
+$VERSION = '0.01';
+
+$DEBUG = 0;
+
+=head1 NAME
+
+Net::Plesk::Method::client_ippool_add_ip - Perl extension for Plesk XML
+Remote API client ippool addition
+
+=head1 SYNOPSIS
+
+ use Net::Plesk::Method::client_ippool_add_ip
+
+ my $p = new Net::Plesk::Method::client_ippool_add_ip ( $clientID, $ipaddress );
+
+=head1 DESCRIPTION
+
+This module implements an interface to construct a request for a ippool
+addition to a client using SWSOFT's Plesk.
+
+=head1 METHODS
+
+=over 4
+
+=item init args ...
+
+Initializes a Plesk client ippool_add_ip. The I<clientID> and I<ipaddress>
+options are required.
+
+=cut
+
+sub init {
+ my ($self, $clientid, $ipaddress) = @_;
+ $$self = join ( "\n", (
+ '<client>',
+ '<ippool_add_ip>',
+ '<client_id>',
+ $self->encode($clientid),
+ '</client_id>',
+ '<ip_address>',
+ $self->encode($ipaddress),
+ '</ip_address>',
+ '</ippool_add_ip>',
+ '</client>',
+ ));
+}
+
+=back
+
+=head1 BUGS
+
+ Creepy crawlies.
+
+=head1 SEE ALSO
+
+SWSOFT Plesk Remote API documentation (1.4.0.0 or later)
+
+=head1 AUTHOR
+
+Jeff Finucane E<lt>jeff@cmh.netE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2006 Jeff Finucane
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
+
diff --git a/lib/Net/Plesk/Method/domain_add.pm b/lib/Net/Plesk/Method/domain_add.pm
new file mode 100644
index 0000000..cfe55be
--- /dev/null
+++ b/lib/Net/Plesk/Method/domain_add.pm
@@ -0,0 +1,85 @@
+package Net::Plesk::Method::domain_add;
+
+use strict;
+
+use vars qw( $VERSION @ISA $AUTOLOAD $DEBUG );
+
+@ISA = qw( Net::Plesk::Method );
+$VERSION = '0.01';
+
+$DEBUG = 0;
+
+=head1 NAME
+
+Net::Plesk::Method::domain_add - Perl extension for Plesk XML Remote API domain addition
+
+=head1 SYNOPSIS
+
+ use Net::Plesk::Method::domain_add
+
+ my $p = new Net::Plesk::Method::domain_add ( $clientID, 'domain.com' );
+
+ $request = $p->endcode;
+
+=head1 DESCRIPTION
+
+This module implements an interface to construct a request for a domain
+addition using SWSOFT's Plesk.
+
+=head1 METHODS
+
+=over 4
+
+=item init args ...
+
+Initializes a Plesk domain_add object. The I<domain>, I<client>, and
+$<ip_address> options are required.
+
+=cut
+
+sub init {
+ my ($self, $domain, $client, $ip) = @_;
+ $$self = join ( "\n", (
+ '<domain>',
+ '<add>',
+ '<gen_setup>',
+ '<name>',
+ $self->encode($domain),
+ '</name>',
+ '<client_id>',
+ $self->encode($client),
+ '</client_id>',
+ '<ip_address>',
+ $self->encode($ip),
+ '</ip_address>',
+ '</gen_setup>',
+ '</add>',
+ '</domain>',
+ ));
+}
+
+=back
+
+=head1 BUGS
+
+ Creepy crawlies.
+
+=head1 SEE ALSO
+
+SWSOFT Plesk Remote API documentation (1.4.0.0 or later)
+
+=head1 AUTHOR
+
+Jeff Finucane E<lt>jeff@cmh.netE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2006 Jeff Finucane
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
+
diff --git a/lib/Net/Plesk/Method/domain_del.pm b/lib/Net/Plesk/Method/domain_del.pm
new file mode 100644
index 0000000..76112f9
--- /dev/null
+++ b/lib/Net/Plesk/Method/domain_del.pm
@@ -0,0 +1,76 @@
+package Net::Plesk::Method::domain_del;
+
+use strict;
+
+use vars qw( $VERSION @ISA $AUTOLOAD $DEBUG );
+
+@ISA = qw( Net::Plesk::Method );
+$VERSION = '0.01';
+
+$DEBUG = 0;
+
+=head1 NAME
+
+Net::Plesk::Method::domain_del - Perl extension for Plesk XML Remote API domain deletion
+
+=head1 SYNOPSIS
+
+ use Net::Plesk::Method::domain_del
+
+ my $p = new Net::Plesk::Method::domain_del ( 'domain.com' );
+
+=head1 DESCRIPTION
+
+This module implements an interface to construct a request for a domain
+addition using SWSOFT's Plesk.
+
+=head1 METHODS
+
+=over 4
+
+=item init args ...
+
+Initializes a Plesk domain_del object. The I<domain> option is required.
+
+=cut
+
+sub init {
+ my ($self, $domain) = @_;
+ $$self = join ( "\n", (
+ '<domain>',
+ '<del>',
+ '<filter>',
+ '<domain_name>',
+ $self->encode($domain),
+ '</domain_name>',
+ '</filter>',
+ '</del>',
+ '</domain>',
+ ));
+}
+
+=back
+
+=head1 BUGS
+
+ Creepy crawlies.
+
+=head1 SEE ALSO
+
+SWSOFT Plesk Remote API documentation (1.4.0.0 or later)
+
+=head1 AUTHOR
+
+Jeff Finucane E<lt>jeff@cmh.netE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2006 Jeff Finucane
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
+
diff --git a/lib/Net/Plesk/Method/domain_get.pm b/lib/Net/Plesk/Method/domain_get.pm
new file mode 100644
index 0000000..fabfcb2
--- /dev/null
+++ b/lib/Net/Plesk/Method/domain_get.pm
@@ -0,0 +1,80 @@
+package Net::Plesk::Method::domain_get;
+
+use strict;
+
+use vars qw( $VERSION @ISA $AUTOLOAD $DEBUG );
+
+@ISA = qw( Net::Plesk::Method );
+$VERSION = '0.01';
+
+$DEBUG = 0;
+
+=head1 NAME
+
+Net::Plesk::Method::domain_get - Perl extension for Plesk XML Remote API domain
+ information retreival
+
+=head1 SYNOPSIS
+
+ use Net::Plesk::Method::domain_get
+
+ my $p = new Net::Plesk::Method::domain_get ( 'domain.com' );
+
+=head1 DESCRIPTION
+
+This module implements an interface to construct a request for domain
+information retreival using SWSOFT's Plesk.
+
+=head1 METHODS
+
+=over 4
+
+=item init args ...
+
+Initializes a Plesk domain_get object. The I<domain> option is required.
+
+=cut
+
+sub init {
+ my ($self, $domain) = @_;
+ $$self = join ( "\n", (
+ '<domain>',
+ '<get>',
+ '<filter>',
+ '<domain_name>',
+ $self->encode($domain),
+ '</domain_name>',
+ '</filter>',
+ '<dataset>',
+ '<gen_info/>',
+ '</dataset>',
+ '</get>',
+ '</domain>',
+ ));
+}
+
+=back
+
+=head1 BUGS
+
+ Creepy crawlies.
+
+=head1 SEE ALSO
+
+SWSOFT Plesk Remote API documentation (1.4.0.0 or later)
+
+=head1 AUTHOR
+
+Jeff Finucane E<lt>jeff@cmh.netE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2006 Jeff Finucane
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
+
diff --git a/lib/Net/Plesk/Method/mail_add.pm b/lib/Net/Plesk/Method/mail_add.pm
new file mode 100644
index 0000000..39e8b6f
--- /dev/null
+++ b/lib/Net/Plesk/Method/mail_add.pm
@@ -0,0 +1,87 @@
+package Net::Plesk::Method::mail_add;
+
+use strict;
+
+use vars qw( $VERSION @ISA $AUTOLOAD $DEBUG );
+
+@ISA = qw( Net::Plesk::Method );
+$VERSION = '0.01';
+
+$DEBUG = 0;
+
+=head1 NAME
+
+Net::Plesk::Method::mail_add - Perl extension for Plesk XML Remote API mail addition
+
+=head1 SYNOPSIS
+
+ use Net::Plesk::Method::mail_add
+
+ my $p = new Net::Plesk::Method::mail_add ( $domainID, $mailbox, $passwd );
+
+ $request = $p->endcode;
+
+=head1 DESCRIPTION
+
+This module implements an interface to construct a request for a mailbox
+addition using SWSOFT's Plesk.
+
+=head1 METHODS
+
+=over 4
+
+=item init args ...
+
+Initializes a Plesk mail_add object. The I<domainID>, I<mailbox>,
+and I<passwd> options are required.
+
+=cut
+
+sub init {
+ my ($self, $domainid, $mailbox, $password) = @_;
+ $$self = join ( "\n", (
+ '<mail>',
+ '<create>',
+ '<filter>',
+ '<domain_id>',
+ $self->encode($domainid),
+ '</domain_id>',
+ '<mailname>',
+ '<name>',
+ $self->encode($mailbox),
+ '</name>',
+ '<password>',
+ $self->encode($password),
+ '</password>',
+ '</mailname>',
+ '</filter>',
+ '</create>',
+ '</mail>',
+ ));
+}
+
+=back
+
+=head1 BUGS
+
+ Creepy crawlies.
+
+=head1 SEE ALSO
+
+SWSOFT Plesk Remote API documentation (1.4.0.0 or later)
+
+=head1 AUTHOR
+
+Jeff Finucane E<lt>jeff@cmh.netE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2006 Jeff Finucane
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
+
diff --git a/lib/Net/Plesk/Method/mail_remove.pm b/lib/Net/Plesk/Method/mail_remove.pm
new file mode 100644
index 0000000..49804ab
--- /dev/null
+++ b/lib/Net/Plesk/Method/mail_remove.pm
@@ -0,0 +1,83 @@
+package Net::Plesk::Method::mail_remove;
+
+use strict;
+
+use vars qw( $VERSION @ISA $AUTOLOAD $DEBUG );
+
+@ISA = qw( Net::Plesk::Method );
+$VERSION = '0.01';
+
+$DEBUG = 0;
+
+=head1 NAME
+
+Net::Plesk::Method::mail_remove - Perl extension for Plesk XML Remote API mail removal
+
+=head1 SYNOPSIS
+
+ use Net::Plesk::Method::mail_remove
+
+ my $p =
+ new Net::Plesk::Method::mail_remove ( $domainID, $mailbox );
+
+ $request = $p->endcode;
+
+=head1 DESCRIPTION
+
+This module implements an interface to construct a request for a mailbox
+removal using SWSOFT's Plesk.
+
+=head1 METHODS
+
+=over 4
+
+=item init args ...
+
+Initializes a Plesk mail_remove object. The I<domainID> and I<mailbox>
+options are required.
+
+=cut
+
+sub init {
+ my ($self, $domainid, $mailbox ) = @_;
+ $$self = join ( "\n", (
+ '<mail>',
+ '<remove>',
+ '<filter>',
+ '<domain_id>',
+ $self->encode($domainid),
+ '</domain_id>',
+ '<name>',
+ $self->encode($mailbox),
+ '</name>',
+ '</filter>',
+ '</remove>',
+ '</mail>',
+ ));
+}
+
+=back
+
+=head1 BUGS
+
+ Creepy crawlies.
+
+=head1 SEE ALSO
+
+SWSOFT Plesk Remote API documentation (1.4.0.0 or later)
+
+=head1 AUTHOR
+
+Jeff Finucane E<lt>jeff@cmh.netE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2006 Jeff Finucane
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
+
diff --git a/lib/Net/Plesk/Method/mail_set.pm b/lib/Net/Plesk/Method/mail_set.pm
new file mode 100644
index 0000000..df574f8
--- /dev/null
+++ b/lib/Net/Plesk/Method/mail_set.pm
@@ -0,0 +1,96 @@
+package Net::Plesk::Method::mail_set;
+
+use strict;
+
+use vars qw( $VERSION @ISA $AUTOLOAD $DEBUG );
+
+@ISA = qw( Net::Plesk::Method );
+$VERSION = '0.01';
+
+$DEBUG = 0;
+
+=head1 NAME
+
+Net::Plesk::Method::mail_set - Perl extension for Plesk XML Remote API mailbox setting
+
+=head1 SYNOPSIS
+
+ use Net::Plesk::Method::mail_set
+
+ my $p = new Net::Plesk::Method::mail_set
+ ( $domainID, $mailbox, $passwd, $enabled );
+
+ $request = $p->endcode;
+
+=head1 DESCRIPTION
+
+This module implements an interface to construct a request for setting a
+mailbox using SWSOFT's Plesk.
+
+=head1 METHODS
+
+=over 4
+
+=item init args ...
+
+Initializes a Plesk mail_set object. The I<domainID>, I<mailbox>, and
+I<password> options are required.
+
+=cut
+
+sub init {
+ my ($self, $domainid, $mailbox, $password, $enabled) = @_;
+ my $enabledflag = $enabled ? "true" : "false";
+ $$self = join ( "\n", (
+ '<mail>',
+ '<update>',
+ '<set>',
+ '<filter>',
+ '<domain_id>',
+ $self->encode($domainid),
+ '</domain_id>',
+ '<mailname>',
+ '<name>',
+ $self->encode($mailbox),
+ '</name>',
+ '<mailbox>',
+ '<enabled>',
+ $self->encode($enabledflag),
+ '</enabled>',
+ '</mailbox>',
+ '<password>',
+ $self->encode($password),
+ '</password>',
+ '</mailname>',
+ '</filter>',
+ '</set>',
+ '</update>',
+ '</mail>',
+ ));
+}
+
+=back
+
+=head1 BUGS
+
+ Creepy crawlies.
+
+=head1 SEE ALSO
+
+SWSOFT Plesk Remote API documentation (1.4.0.0 or later)
+
+=head1 AUTHOR
+
+Jeff Finucane E<lt>jeff@cmh.netE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2006 Jeff Finucane
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
+
diff --git a/lib/Net/Plesk/Response.pm b/lib/Net/Plesk/Response.pm
new file mode 100644
index 0000000..58203f7
--- /dev/null
+++ b/lib/Net/Plesk/Response.pm
@@ -0,0 +1,114 @@
+package Net::Plesk::Response;
+
+use strict;
+use XML::Simple;
+use XML::XPath;
+use XML::XPath::XMLParser;
+
+=head1 NAME
+
+Net::Plesk::Response - Plesk response object
+
+=head1 SYNOPSIS
+
+ my $response = $plesk->some_method( $and, $args );
+
+ if ( $response->is_success ) {
+
+ my $id = $response->id;
+ #...
+
+ } else {
+
+ my $error = $response->error; #error code
+ my $errortext = $response->errortext; #error message
+ #...
+ }
+
+=head1 DESCRIPTION
+
+The "Net::Plesk::Response" class represents Plesk responses.
+
+=cut
+
+sub new {
+ my $proto = shift;
+ my $class = ref($proto) || $proto;
+ my $self = {};
+ bless($self, $class);
+
+ my $data = shift;
+ $data =~ /^\<\?xml version=\"1.0\"\?\>(.*)$/s;
+
+ my $xp = XML::XPath->new(xml => $1);
+ my $nodeset = $xp->find('//result');
+ foreach my $node ($nodeset->get_nodelist) {
+ push @{$self->{'results'}}, XML::XPath::XMLParser::as_string($node);
+ }
+
+ $self;
+}
+
+sub is_success {
+ my $self = shift;
+ my $status = 1;
+ foreach my $result (@{$self->{'results'}}) {
+ $status = (XMLin($result)->{'status'} eq 'ok');
+ last unless $status;
+ }
+ $status;
+}
+
+sub error {
+ my $self = shift;
+ my @errcode;
+ foreach my $result (@{$self->{'results'}}) {
+ my $errcode = XMLin($result)->{'errcode'};
+ push @errcode, $errcode if $errcode;
+ }
+ return wantarray ? @errcode : $errcode[0];
+}
+
+sub errortext {
+ my $self = shift;
+ my @errtext;
+ foreach my $result (@{$self->{'results'}}) {
+ my $errtext = XMLin($result)->{'errtext'};
+ push @errtext, $errtext if $errtext;
+ }
+ return wantarray ? @errtext : $errtext[0];
+}
+
+sub id {
+ my $self = shift;
+ my @id;
+ foreach my $result (@{$self->{'results'}}) {
+ my $id = XMLin($result)->{'id'};
+ push @id, $id if $id;
+ }
+ return wantarray ? @id : $id[0];
+}
+
+
+=head1 BUGS
+
+Needs better documentation.
+
+=head1 SEE ALSO
+
+L<Net::Plesk>,
+
+=head1 AUTHOR
+
+Jeff Finucane E<lt>jeff@cmh.netE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2006 Jeff Finucane
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;