handle responses with an encoding= (though not actually the encoding)
[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   @ISA = qw( Net::Plesk::Method );
24
25 =head1 DESCRIPTION
26
27 This module implements a base class for constructing requests using SWSOFT's
28 Plesk.
29
30 =head1 METHODS
31
32 =over 4
33
34 =item new
35
36 Creates a new Net::Plesk::Method object and initializes it.
37 =cut
38
39 sub new {
40   my $proto = shift;
41   my $class = ref($proto) || $proto;
42   my $me;
43   my $self = \$me;
44   bless($self, $class);
45   $self->init(@_);
46   return $self;
47 }
48
49
50 =item encode
51
52 Returns the xml encoded entity
53
54 =cut
55
56 sub encode {
57   my ($self,$value) = (shift,shift);
58   $value =~ s/([&<>])/$char_entities{$1}/ge;
59   return $value;
60 }
61
62 =back
63
64 =head1 BUGS
65
66   Creepy crawlies.
67
68 =head1 SEE ALSO
69
70 SWSOFT Plesk Remote API documentation (1.4.0.0 or later)
71
72 =head1 AUTHOR
73
74 Jeff Finucane E<lt>jeff@cmh.netE<gt>
75
76 =head1 COPYRIGHT AND LICENSE
77
78 Copyright (C) 2006 Jeff Finucane
79
80 This library is free software; you can redistribute it and/or modify
81 it under the same terms as Perl itself.
82
83 =cut
84
85 1;
86