ORE/Agent.pm

filter: Statementstmt 100% 21 / 21 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 78.0% 32 / 41 CC 4 SCAR 7.3
CC
4
Cov
83%
real_uri
3.5
new
2.1
BEGIN
1.0
CRAP 2.1
« ORE/N3.pm ↑ Summary ORE/Constant.pm »
1 package SemanticWeb::OAI::ORE::Agent;
2 #$Id: Agent.pm,v 1.4 2010-12-06 14:44:15 simeon Exp $
3  
4 =head1 NAME
5  
6 SemanticWeb::OAI::ORE::Agent - Module to represent http://purl.org/dc/terms/Agent
7  
8 =head1 SYNPOSIS
9  
10 my $agent=SemanticWeb::OAI::ORE::Agent->new;
11 $agent->name("A Person");
12 $agent->mbox("person\@example.org");
13 print "Agent = ".$agent->name." <".$agent->mbox.">\n";
14  
15 =head1 DESCRIPTION
16  
17 Within OAI-ORE an agent, typically but not necessarily a person,
18 may have a name, an email address and a URI.
19  
20 =cut
21  
22 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 9 ▶use Class::Accessor;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 9 ▶use base qw(Class::Accessor);
Subroutine BEGIN: called CC=1 SCAR=0.0
28 9 SemanticWeb::OAI::ORE::Agent->mk_accessors(qw(uri name mbox));
29  
30 =head1 METHODS
31  
32 =head2 Creator
33  
34 =head3 new()
35  
36 Create SemanticWeb::OAI::ORE::Agent, may set uri, name and mbox via
37 hash arguments.
38  
39 =cut
40  
41 2 ▶sub new {
Subroutine new: called CC=2 SCAR=7.4
Pod documented
42 2 my $class=shift;
43 2 my $self={@_};
44 2 ▶ bless $self, (ref($class) || $class);
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
020
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
45 2 return($self);
46 }
47  
48 =head2 Accessors
49  
50 =head3 uri
51  
52 URI of the Agent. This may be a blank node id. Use instead
53 L<real_uri> if you want only globally meaningful URI.
54  
55 =head3 real_uri
56  
57 Wrapper around L<uri> which returns either a globally meaningful
58 URI or undef if not set or a blank node. Cannot be used to set
59 L<uriXX>.
60  
61 =cut
62  
63 1 ▶sub real_uri {
Subroutine real_uri: called CC=3 SCAR=12.5
Pod documented
64 1 my $self=shift;
65 1 my $uri=$self->uri(@_);
66 1 ▶ return( $uri && $uri!~/^_/ ? $uri : undef );
Branch: 1 branch
BranchTrueFalseTotal
$uri && !($uri =~ /^_/) ? : 0 1 1
Condition33%1/3
$uri and not $uri =~ /^_/
!ll&&!rl&&r
010
MC/DC0%0/2
$uri and not $uri =~ /^_/
$uri not $uri =~ /^_/
Truth table33%1/3
A and not(B)
A= $uriB= not $uri =~ /^_/
ABresult
0X0
100
111
67 }
68  
69 =head3 name
70  
71 Accessor for foaf:name of this Agent
72  
73 =head3 mbox
74  
75 Accessor for foaf:mbox of this Agent
76  
77 =cut
78  
79 9 1;
« ORE/N3.pm ↑ Summary ORE/Constant.pm »