Model/XMLRPC.pm

filter: Statementstmt 48.9% 24 / 49 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 58.3% 7 / 12 Podpod 100% 1 / 1 totaltotal 44.4% 32 / 72 CC 6 SCAR 23.3
CC
6
Cov
41%
_client
30.0
AUTOLOAD
6.0
new
2.0
CRAP 10.3
↑ Summary Helper/Model/XMLRPC.pm »
1 package Catalyst::Model::XMLRPC;
2 2 ▶use base qw/Catalyst::Model/;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use NEXT;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use RPC::XML;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use RPC::XML::Client;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 our $VERSION = '0.04';
12 2 our $AUTOLOAD;
13  
14  
15 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
16 0 my ($class, $c, $config) = @_;
17  
18 0 my $self = $class->NEXT::new($c, $config);
19 0 $self->config($config);
20  
21 0 return $self;
22 }
23  
24  
25 0 ▶sub _client {
Subroutine _client: not called CC=5 SCAR=34.0
26 0 my $self = shift;
27 0 my %config = %{ $self->config };
28  
29 0 my $location = $config{location};
30 0 ▶ croak "Must provide an location" unless $location;
Branch: 1 branch
BranchTrueFalseTotal
unless $location 0 0 0
31 0 delete $config{location};
32  
33 0 ▶ unless (exists $config{error_handler}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $config{"error_handler"}) 0 0 0
34 0 ▶ $config{error_handler} = sub { croak $_[0] };
Subroutine __ANON__: not called CC=1 SCAR=6.9
35 }
36 0 ▶ unless (exists $config{fault_handler}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $config{"fault_handler"}) 0 0 0
37 0 ▶ $config{fault_handler} = sub { croak $_[0] };
Subroutine __ANON__: not called CC=1 SCAR=6.9
38 }
39  
40 0 my $client = RPC::XML::Client->new($location, %config);
41 0 ▶ croak "Can't create RPC::XML::Client object"
Branch: 1 branch
BranchTrueFalseTotal
unless UNIVERSAL::isa($client, "RPC::XML::Client") 0 0 0
42 unless UNIVERSAL::isa($client, 'RPC::XML::Client');
43  
44 0 return $client;
45 }
46  
47  
48 0 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: not called CC=2 SCAR=17.9
49 0 my ($self, @args) = @_;
50
51 0 ▶ return if $AUTOLOAD =~ /::DESTROY$/;
Branch: 1 branch
BranchTrueFalseTotal
if $Catalyst::Model::XMLRPC::AUTOLOAD =~ /::DESTROY$/ 0 0 0
52  
53 0 (my $op = $AUTOLOAD) =~ s/^.*:://;
54  
55 0 my $client = $self->_client;
56
57 0 my $msg = $client->$op(@args);
58  
59 0 return $msg;
60 }
61  
62  
63 2 1;
64  
65 __END__
↑ Summary Helper/Model/XMLRPC.pm »