Jifty/Plugin/RPC.pm untested

filter: Statementstmt 0.0% 0 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 28 CC 1 SCAR 6.9
CC
1
Cov
0%
prereq_plugins
2.0
init
2.0
BEGIN
2.0
CRAP 2.0
1 use strict;
2 use warnings;
3  
4 package Jifty::Plugin::RPC;
5 use base qw/Jifty::Plugin/;
6  
7 =head1 NAME
8  
9 Jifty::Plugin::RPC - Use AMQP for RPC
10  
11 =head1 SYNOPSIS
12  
13 Jifty->rpc->call( name => "remote-method" );
14  
15 =head1 DESCRIPTION
16  
17 L<Jifty::Plugin::PubSub> interfaces with an L<AnyEvent::RabbitMQ>
18 connection to provide a message bus. This provides C<Jifty->rpc> which
19 implements an L<AnyEvent::RabbitMQ::RPC> using that connection; see that
20 module for complete documentation.
21  
22 =head1 METHODS
23  
24 =head2 prereq_plugins
25  
26 Use of this plugin requires (or implicitly loads, if missing) the
27 L<Jifty::Plugin::PubSub> plugin.
28  
29 =cut
30  
31 use AnyEvent::RabbitMQ::RPC;
32  
33 sub prereq_plugins { 'PubSub' }
34  
35 our $VERSION = '0.5';
36  
37 =head2 init
38  
39 This plugin has one configuration option, C<serialize>, which defaults
40 to C<Storable>. See L<AnyEvent::RabbitMQ::RPC> for documentation on the
41 possible alternatives.
42  
43 =cut
44  
45 our $RPC;
46 sub init {
47 my $self = shift;
48 my %opt = (
49 serialize => "Storable",
50 @_,
51 );
52  
53 $RPC = AnyEvent::RabbitMQ::RPC->new(
54 serialize => $opt{serialize},
55 connection => Jifty->bus->_rf,
56 );
57  
58 *Jifty::rpc = sub { $RPC };
59 }
60  
61 1;