df2acd47e850320a4de49e0b9be036cfe9c0334a
[Net-Plesk.git] / lib / Net / Plesk / Method.pm
1 package Net::Plesk::Method;
2
3 use strict;
4
5 use vars qw( $VERSION @ISA $AUTOLOAD $DEBUG );
6
7 $VERSION = '0.01';
8
9 $DEBUG = 0;
10
11 my %char_entities = (
12   '&' => '&',
13   '<' => '&lt;',
14   '>' => '&gt;',
15 );
16
17 =head1 NAME
18
19 Net::Plesk::Method - Perl base class for Plesk XML Remote API Method
20
21 =head1 SYNOPSIS
22
23   use Exporter;
24   @ISA = qw( Net::Plesk::Method );
25
26 =head1 DESCRIPTION
27
28 This module implements a base class for constructing requests using SWSOFT's
29 Plesk.
30
31 =head1 METHODS
32
33 =over 4
34
35 =item new
36
37 Creates a new Net::Plesk::Method object and initializes it.
38 =cut
39
40 sub new {
41   my $proto = shift;
42   my $class = ref($proto) || $proto;
43   my $me;
44   my $self = \$me;
45   bless($self, $class);
46   $self->init(@_);
47   return $self;
48 }
49
50
51 =item encode
52
53 Returns the xml encoded entity
54
55 =cut
56
57 sub encode {
58   my ($self,$value) = (shift,shift);
59   $value =~ s/([&<>])/$char_entities{$1}/ge;
60   return $value;
61 }
62
63 =back
64
65 =head1 BUGS
66
67   Creepy crawlies.
68
69 =head1 SEE ALSO
70
71 SWSOFT Plesk Remote API documentation (1.4.0.0 or later)
72
73 =head1 AUTHOR
74
75 Jeff Finucane E<lt>jeff@cmh.netE<gt>
76
77 =head1 COPYRIGHT AND LICENSE
78
79 Copyright (C) 2006 Jeff Finucane
80
81 This library is free software; you can redistribute it and/or modify
82 it under the same terms as Perl itself.
83
84 =cut
85
86 1;
87