blib/lib/WWW/Ohloh/API/Role/Fetchable.pm

filter: Statementstmt 65.8% 27 / 41 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 8 / 10 Podpod 0.0% 0 / 2 totaltotal 61.4% 35 / 57 CC 3 SCAR 9.8
CC
3
Cov
60%
fetch
6.0
generate_query_url
6.0
BEGIN
1.0
CRAP 2.7
« blib/lib/WWW/Ohloh/API/StackEntry.pm ↑ Summary blib/lib/WWW/Ohloh/API/Kudos.pm »
1 package WWW::Ohloh::API::Role::Fetchable;
2  
3 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 16 ▶use Object::InsideOut;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 16 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 16 ▶use Params::Validate qw/ validate_with validate /;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 16 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 16 our $VERSION = '0.3.2';
13  
14 #<<<
15 16 my @request_url_of : Field
16 : Arg(Name => 'request_url', Preproc => \&WWW::Ohloh::API::Role::Fetchable::process_url)
17 : Get(request_url)
18 : Type(URI);
19 16 my @ohloh_of : Field
20 : Arg(ohloh)
21 : Set(set_ohloh)
22 : Get(ohloh);
23 #>>>
24 sub process_url {
25 12 ▶ my $value = $_[4];
Subroutine process_url: called CC=1 SCAR=0.0
Pod undocumented
26  
27 12 return URI->new($value);
28 }
29  
30 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31  
32 sub fetch {
33 0 ▶ my ( $class, @args ) = @_;
Subroutine fetch: not called CC=2 SCAR=17.9
Pod undocumented
34  
35 0 ▶ if ( ref $class ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $class) 0 0 0
36 0 push @args, ohloh => $class->ohloh;
37 0 $class = ref $class;
38 }
39  
40 0 my %param = validate_with(
41 params => \@args,
42 spec => { ohloh => 1 },
43 allow_extra => 1,
44 );
45  
46 0 my $ohloh = $param{ohloh};
47 0 delete $param{ohloh};
48  
49 0 my ($url) = $class->generate_query_url(%param);
50  
51 0 my ( undef, $xml ) = $ohloh->_query_server($url);
52  
53 0 my ($node) = $xml->findnodes( $class->element_name );
54  
55 0 return $class->new( ohloh => $ohloh, xml => $node, request_url => $url );
56 }
57  
58 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59  
60 sub generate_query_url : Chained(bottom up) {
61 0 ▶ my ( $self, $url, @args ) = @_;
Subroutine generate_query_url: not called CC=2 SCAR=17.9
62  
63 0 ▶ croak "$args[0] not a valid argument" if @args;
Branch: 1 branch
BranchTrueFalseTotal
if @args 0 0 0
64  
65 0 return ($url);
66 16 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
67  
68 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69  
70 16 'end of WWW::Ohloh::API::Role::Fetchable';
« blib/lib/WWW/Ohloh/API/StackEntry.pm ↑ Summary blib/lib/WWW/Ohloh/API/Kudos.pm »