line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catalyst::Helper::Model::JabberRPC; |
2
|
1
|
|
|
1
|
|
1576
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
160
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Catalyst::Helper::Model::JabberRPC - Helper for JabberRPC models |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
script/myapp_create.pl model RemoteService JabberRPC myserver.org user:password jrpc.myserver.org/rpc-server |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 DESCRIPTION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Helper for the L<Catalyst> JabberRPC model. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 USAGE |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
When creating a new JabberRPC model class using this helper, you can |
20
|
|
|
|
|
|
|
specify much of the configuration and have it filled automatically. |
21
|
|
|
|
|
|
|
Using the example from the L</SYNOPSIS> section: |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=over |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=item * C<RemoteService> |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
The name of the model. This is also used to determine the filename, |
28
|
|
|
|
|
|
|
e.g. C<lib/MyApp/Model/RemoteService.pm>. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=item * C<JabberRPC> |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
The helper to use, i.e. this one. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=item * C<myserver.org> |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
The same as the B<server> arg. passed to L<Jabber::RPC::Client>. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=item * C<user:password> |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
The same as the B<identauth> arg. passed to L<Jabber::RPC::Client>. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=item * C<jrpc.myserver.org/rpc-server> |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
The same as the B<endpoint> arg. passed to L<Jabber::RPC::Client>. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=back |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 METHODS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 mk_compclass |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Makes the JabberRPC model class. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub mk_compclass { |
57
|
0
|
|
|
0
|
1
|
|
my ($self, $helper, $server, $identauth, $endpoint) = @_; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
0
|
|
|
|
$helper->{server} = $server || ''; |
60
|
0
|
|
0
|
|
|
|
$helper->{identauth} = $identauth || ''; |
61
|
0
|
|
0
|
|
|
|
$helper->{endpoint} = $endpoint || ''; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
$helper->render_file('modelclass', $helper->{file}); |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
return 1; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 mk_comptest |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Makes tests for the JabberRPC model. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub mk_comptest { |
75
|
0
|
|
|
0
|
1
|
|
my ($self, $helper) = @_; |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
$helper->render_file('modeltest', $helper->{test}); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 SEE ALSO |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=over 1 |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item * L<Catalyst::Model::JabberRPC> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item * L<Catalyst::Helper> |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item * L<Catalyst::Manual> |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=back |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 AUTHOR |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Florian Merges E<lt>fmerges@cpan.orgE<gt> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 LICENSE |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
99
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
__DATA__ |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=begin pod_to_ignore |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
__modelclass__ |
110
|
|
|
|
|
|
|
package [% class %]; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
use strict; |
113
|
|
|
|
|
|
|
use warnings; |
114
|
|
|
|
|
|
|
use base 'Catalyst::Model::JabberRPC'; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
__PACKAGE__->config( |
117
|
|
|
|
|
|
|
server => '[% server %]', |
118
|
|
|
|
|
|
|
identauth => '[% identauth %]', |
119
|
|
|
|
|
|
|
endpoint => '[% endpoint %]', |
120
|
|
|
|
|
|
|
# For more options take a look at L<Jabber::RPC::Client>. |
121
|
|
|
|
|
|
|
); |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 NAME |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
[% class %] - JabberRPC Catalyst model component |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 SYNOPSIS |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
See L<[% app %]>. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 DESCRIPTION |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
JabberRPC Catalyst model component. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 AUTHOR |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
[% author %] |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 LICENSE |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
142
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=cut |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
1; |
147
|
|
|
|
|
|
|
__modeltest__ |
148
|
|
|
|
|
|
|
use strict; |
149
|
|
|
|
|
|
|
use warnings; |
150
|
|
|
|
|
|
|
use Test::More tests => 2; |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
use_ok('Catalyst::Test', '[% app %]'); |
153
|
|
|
|
|
|
|
use_ok('[% class %]'); |
154
|
|
|
|
|
|
|
|