DOAP.pm

filter: Statementstmt 69.0% 38 / 55 Branchbran 25.0% 1 / 4 Conditioncond 14.2% 1 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 76.9% 10 / 13 Podpod 100% 4 / 4 totaltotal 62.0% 54 / 87 CC 6 SCAR 12.2
CC
6
Cov
61%
project
8.3
from_file
6.0
from_model
2.0
CRAP 3.4
« DOAP/Change.pm ↑ Summary DOAP/Version.pm »
1 2 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package RDF::DOAP;
6  
7 2 our $AUTHORITY = 'cpan:TOBYINK';
8 2 our $VERSION = '0.105';
9  
10 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 extends 'RDF::DOAP::Resource';
12  
13 2 ▶use RDF::Trine;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 ▶use RDF::DOAP::Project;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 2 ▶use RDF::DOAP::Types -types;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 2 ▶use RDF::Trine::Namespace qw(rdf rdfs owl xsd);
Subroutine BEGIN: called CC=1 SCAR=0.0
18 2 my $doap = 'RDF::Trine::Namespace'->new('http://usefulinc.com/ns/doap#');
19  
20 has projects => (
21 is => 'ro',
22 isa => ArrayRef[Project],
23 0 ▶ default => sub { [] },
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 2 coerce => 1,
25 init_arg => '_projects',
26 );
27  
28 sub from_url
29 0 ▶{
Subroutine from_url: not called CC=1 SCAR=6.9
Pod documented
30 0 require RDF::Trine;
31
32 0 my $class = shift;
33 0 my ($url) = @_;
34
35 0 my $model = 'RDF::Trine::Model'->new;
36 0 'RDF::Trine::Parser'->parse_url_into_model("$url", $model);
37
38 0 return $class->from_model($model, { rdf_about => $url });
39 }
40  
41 sub from_file
42 0 ▶{
Subroutine from_file: not called CC=2 SCAR=17.9
Pod documented
43 0 require RDF::Trine;
44
45 0 my $class = shift;
46 0 my ($fh, $base) = @_;
47 0 ▶ $base //= 'http://localhost/';
Condition0%0/2
$base //= "http://localhost/"
l!l
00
MC/DC0%0/1
$base //= "http://localhost/"
$base
Truth table0%0/2
A
A= $base
Aresult
11
00
48
49 0 my $model = 'RDF::Trine::Model'->new;
50 0 'RDF::Trine::Parser'->parse_file_into_model($base, $fh, $model);
51
52 0 return $class->from_model($model);
53 }
54  
55 sub from_model
56 1 ▶{
Subroutine from_model: called CC=2 SCAR=7.0
Pod documented
57 1 my $class = shift;
58 1 my ($model, $args) = @_;
59
60 # required for coercion to work!
61 1 local $RDF::DOAP::Resource::MODEL = $model;
62
63 $class->new(
64 1 ▶ %{ $args || {} },
Condition50%1/2
$args || {}
l!l
01
MC/DC0%0/1
$args || {}
$args
Truth table50%1/2
A
A= $args
Aresult
11
00
65 rdf_model => $model,
66 _projects => [ $model->subjects($rdf->type, $doap->Project) ],
67 );
68 }
69  
70 sub project
71 1 ▶{
Subroutine project: called CC=4 SCAR=21.1
Pod documented
72 1 my $self = shift;
73
74 1 my @projects = @{$self->projects};
75 1 ▶ return $projects[0] if @projects <= 1;
Branch: 1 branch
BranchTrueFalseTotal
if @projects <= 1 1 0 1
76
77 my @sorted =
78 map $_->[0],
79 0 ▶ sort { $b->[1] <=> $a->[1] }
Branch: 1 branch
BranchTrueFalseTotal
$_->has_rdf_model && $_->has_rdf_about ? : 0 0 0
Condition0%0/3
$_->has_rdf_model and $_->has_rdf_about
!ll&&!rl&&r
000
MC/DC0%0/2
$_->has_rdf_model and $_->has_rdf_about
$_->has_rdf_model $_->has_rdf_about
Truth table0%0/3
A and B
A= $_->has_rdf_modelB= $_->has_rdf_about
ABresult
0X0
100
111
80 map [
81 $_,
82 $_->has_rdf_model && $_->has_rdf_about
83 ? $_->rdf_model->count_statements($_->rdf_about, undef, undef)
84 : 0
85 ], @projects;
86
87 0 return $sorted[0];
88 }
89  
90 2 1;
91  
92 __END__
« DOAP/Change.pm ↑ Summary DOAP/Version.pm »