line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# vim: filetype=perl:noexpandtab:ts=3:sw=3 |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Copyright (C) 2009 NZ Registry Services |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# This program is free software: you can redistribute it and/or modify |
6
|
|
|
|
|
|
|
# it under the terms of the Artistic License 2.0 or later. You should |
7
|
|
|
|
|
|
|
# have received a copy of the Artistic License the file COPYING.txt. |
8
|
|
|
|
|
|
|
# If not, see <http://www.perlfoundation.org/artistic_license_2_0> |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
1801
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
11
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package SRS::EPP::Message; |
14
|
|
|
|
|
|
|
{ |
15
|
|
|
|
|
|
|
$SRS::EPP::Message::VERSION = '0.22'; |
16
|
|
|
|
|
|
|
} |
17
|
1
|
|
|
1
|
|
5
|
use Moose; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has 'xml' => |
20
|
|
|
|
|
|
|
is => "rw", |
21
|
|
|
|
|
|
|
; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has 'message' => |
24
|
|
|
|
|
|
|
is => "rw", |
25
|
|
|
|
|
|
|
handles => [qw(to_xml)], |
26
|
|
|
|
|
|
|
trigger => sub { $_[0]->message_trigger }, |
27
|
|
|
|
|
|
|
; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# for use with 'around', 'after' modifiers |
30
|
0
|
|
|
0
|
0
|
|
sub message_trigger { } |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has 'error' => |
33
|
|
|
|
|
|
|
is => "rw", |
34
|
|
|
|
|
|
|
; |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
1
|
|
9385
|
use Scalar::Util qw(refaddr); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
245
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
use overload '""' => sub { |
39
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
40
|
0
|
|
|
|
|
0
|
my $class = ref $self; |
41
|
0
|
|
|
|
|
0
|
$class =~ s{SRS::EPP::}{}; |
42
|
0
|
|
|
|
|
0
|
my @bits = map { lc $_ } split "::", $class; |
|
0
|
|
|
|
|
0
|
|
43
|
0
|
|
|
|
|
0
|
my @ids = eval{ $self->ids }; |
|
0
|
|
|
|
|
0
|
|
44
|
0
|
0
|
|
|
|
0
|
if ( !@ids ) { |
45
|
0
|
|
|
|
|
0
|
@ids = sprintf("0x%x",(0+$self)); |
46
|
|
|
|
|
|
|
} |
47
|
0
|
|
|
|
|
0
|
push @bits, @ids; |
48
|
0
|
|
|
|
|
0
|
s{:}{\xff1a}g for @bits; |
49
|
0
|
|
|
|
|
0
|
join ":", @bits |
50
|
|
|
|
|
|
|
}, |
51
|
|
|
|
|
|
|
'0+' => sub { |
52
|
0
|
|
|
0
|
|
0
|
refaddr(shift); |
53
|
|
|
|
|
|
|
}, |
54
|
1
|
|
|
1
|
|
5
|
fallback => 1; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
15
|
|
55
|
|
|
|
|
|
|
|
56
|
1
|
|
|
1
|
|
75
|
no Moose; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
57
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 NAME |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
SRS::EPP::Message - abstract type for a single message particle |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 SYNOPSIS |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
my $msg = SRS::EPP::Message->new( |
70
|
|
|
|
|
|
|
message => $object, |
71
|
|
|
|
|
|
|
xml => $xml, |
72
|
|
|
|
|
|
|
error => $message, |
73
|
|
|
|
|
|
|
); |
74
|
|
|
|
|
|
|
# convert a message to XML |
75
|
|
|
|
|
|
|
$message->to_xml; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 DESCRIPTION |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This class is a common ancestor of EPP commands and responses, as well |
80
|
|
|
|
|
|
|
as SRS requests and responses. Currently the only method that all of |
81
|
|
|
|
|
|
|
these implement is conversion to XML; however parsing is likely to |
82
|
|
|
|
|
|
|
follow. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 SEE ALSO |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
L<SRS::EPP::Command>, L<SRS::EPP::Response> |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=for thought |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
What space should we stick SRS messages under? I reckon maybe plain |
91
|
|
|
|
|
|
|
SRS::Request:: and SRS::Response::, and subclass them... |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# Local Variables: |
96
|
|
|
|
|
|
|
# mode:cperl |
97
|
|
|
|
|
|
|
# indent-tabs-mode: t |
98
|
|
|
|
|
|
|
# cperl-continued-statement-offset: 8 |
99
|
|
|
|
|
|
|
# cperl-brace-offset: 0 |
100
|
|
|
|
|
|
|
# cperl-close-paren-offset: 0 |
101
|
|
|
|
|
|
|
# cperl-continued-brace-offset: 0 |
102
|
|
|
|
|
|
|
# cperl-continued-statement-offset: 8 |
103
|
|
|
|
|
|
|
# cperl-extra-newline-before-brace: nil |
104
|
|
|
|
|
|
|
# cperl-indent-level: 8 |
105
|
|
|
|
|
|
|
# cperl-indent-parens-as-block: t |
106
|
|
|
|
|
|
|
# cperl-indent-wrt-brace: nil |
107
|
|
|
|
|
|
|
# cperl-label-offset: -8 |
108
|
|
|
|
|
|
|
# cperl-merge-trailing-else: t |
109
|
|
|
|
|
|
|
# End: |