Net::Plesk::Method::domain_add - Perl extension for Plesk XML Remote API domain addition


Net-Plesk documentation Contained in the Net-Plesk distribution.

Index


Code Index:

NAME

Top

Net::Plesk::Method::domain_add - Perl extension for Plesk XML Remote API domain addition

SYNOPSIS

Top

  use Net::Plesk::Method::domain_add

  my $p = new Net::Plesk::Method::domain_add ( $clientID, 'domain.com' );

  $request = $p->endcode;

DESCRIPTION

Top

This module implements an interface to construct a request for a domain addition using SWSOFT's Plesk.

METHODS

Top

init args ...

Initializes a Plesk domain_add object. The domain, client, and $<ip_address> options are required.

BUGS

Top

  Creepy crawlies.

SEE ALSO

Top

SWSOFT Plesk Remote API documentation (1.4.0.0 or later)

AUTHOR

Top

Jeff Finucane <jeff@cmh.net>

COPYRIGHT AND LICENSE

Top


Net-Plesk documentation Contained in the Net-Plesk distribution.
package Net::Plesk::Method::domain_add;

use strict;

use vars qw( $VERSION @ISA $AUTOLOAD $DEBUG );

@ISA = qw( Net::Plesk::Method );
$VERSION = '0.02';

$DEBUG = 0;

sub init {
  my ($self, $domain, $client, $ip, $template, $user, $pass) = @_;
  my $xml = join ( "\n", (
	            '<domain>',
	            '<add>',
	            '<gen_setup>',
	            '<name>',
	            $self->encode($domain),
	            '</name>',
	            '<client_id>',
	            $self->encode($client),
	            '</client_id>',
                 ));
  $xml .= '<htype>vrt_hst</htype>' if defined($user);
  $xml .= join ( "\n", ( '<ip_address>',
	          $self->encode($ip),
	          '</ip_address>',
	          '</gen_setup>',
               ));
  if (defined($user)) {
    $xml .= "<hosting><vrt_hst><ftp_login>" . $self->encode($user);
    $xml .= "</ftp_login><ftp_password>" . $self->encode($pass);
    $xml .= "</ftp_password><ip_address>" . $self->encode($ip);
    $xml .= "</ip_address></vrt_hst></hosting>";
  }
  if ($template) {
    $xml .= "<template-name>" . $self->encode($template) . "</template-name>";
  }
  $xml .= '</add></domain>';

  $$self = $xml;
}

1;