| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
### plugin implementation |
|
2
|
|
|
|
|
|
|
{ package Catalyst::Plugin::Server; |
|
3
|
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
1618
|
use strict; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
55
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
35
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use base qw/Class::Data::Inheritable/; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
879
|
|
|
7
|
|
|
|
|
|
|
use MRO::Compat; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.28'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $ReqClass = 'Catalyst::Plugin::Server::Request'; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
__PACKAGE__->mk_classdata('server'); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub setup_dispatcher { |
|
16
|
|
|
|
|
|
|
my $class = shift; |
|
17
|
|
|
|
|
|
|
$class->next::method(@_); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
### Load Server class |
|
20
|
|
|
|
|
|
|
$class->server(Catalyst::Plugin::Server::Backend->new($class)); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
### Load our custom request_class |
|
23
|
|
|
|
|
|
|
$class->request_class( $ReqClass ); |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub prepare_action { |
|
27
|
|
|
|
|
|
|
my $c = shift; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
### since we have a custom request class now, we have to |
|
30
|
|
|
|
|
|
|
### be sure no one changed it from underneath us! |
|
31
|
|
|
|
|
|
|
unless( $c->req->isa($ReqClass) ) { |
|
32
|
|
|
|
|
|
|
$c->log->warn( "Request class no longer inherits from " . |
|
33
|
|
|
|
|
|
|
"$ReqClass -- this may break things!" ); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
$c->next::method( @_ ); |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
### plugin backend object |
|
40
|
|
|
|
|
|
|
{ package Catalyst::Plugin::Server::Backend; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
use strict; |
|
43
|
|
|
|
|
|
|
use warnings; |
|
44
|
|
|
|
|
|
|
use base qw/Class::Accessor::Fast/; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub new { |
|
47
|
|
|
|
|
|
|
my $class = shift; |
|
48
|
|
|
|
|
|
|
my $c = shift; |
|
49
|
|
|
|
|
|
|
my $self = $class->next::method( @_ ); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub register_server { |
|
53
|
|
|
|
|
|
|
my ($self, $name, $class) = @_; |
|
54
|
|
|
|
|
|
|
return unless ($name && $class); |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$self->mk_accessors($name); |
|
57
|
|
|
|
|
|
|
$self->$name($class); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
### the request class addition ### |
|
62
|
|
|
|
|
|
|
{ package Catalyst::Plugin::Server::Request; |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
use strict; |
|
65
|
|
|
|
|
|
|
use warnings; |
|
66
|
|
|
|
|
|
|
use Data::Dumper; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
use base qw/Catalyst::Request Class::Accessor::Fast/; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
*params = *parameters; |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub register_server { |
|
73
|
|
|
|
|
|
|
my ($self, $name, $class) = @_; |
|
74
|
|
|
|
|
|
|
return unless ($name && $class); |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
$self->mk_accessors($name); |
|
77
|
|
|
|
|
|
|
$self->$name($class); |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 NAME |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Catalyst::Plugin::Server - Base Server plugin for RPC-able protocols |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
use Catalyst qw/ |
|
92
|
|
|
|
|
|
|
Server |
|
93
|
|
|
|
|
|
|
Server::XMLRPC |
|
94
|
|
|
|
|
|
|
/; |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
MyAPP->register_server('soap', $blessed_reference); |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Base plugin for XMLRPC and our future SOAP server. For further information, |
|
102
|
|
|
|
|
|
|
see one of the Server plugins |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
L<Catalyst::Plugin::Server::XMLRPC>, L<Catalyst::Manual>, |
|
107
|
|
|
|
|
|
|
L<Catalyst::Request>, L<Catalyst::Response>, L<RPC::XML>, |
|
108
|
|
|
|
|
|
|
C<bin/rpc_client> |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 AUTHORS |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Original Authors: Jos Boumans (kane@cpan.org) and Michiel Ootjers (michiel@cpan.org) |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Actually maintained by Jose Luis Martinez Torres JLMARTIN (jlmartinez@capside.com) |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 THANKS |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Tomas Doran (BOBTFISH) for helping out with the debugging |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 BUG REPORTS |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Please submit all bugs regarding C<Catalyst::Plugin::Server> to |
|
123
|
|
|
|
|
|
|
C<bug-catalyst-plugin-server@rt.cpan.org> |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 LICENSE |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify |
|
128
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |