File Coverage

blib/lib/SemanticWeb/OAI/ORE/Agent.pm
Criterion Covered Total %
statement 19 19 100.0
branch 1 2 50.0
condition 2 6 33.3
subroutine 6 6 100.0
pod 2 2 100.0
total 30 35 85.7


line stmt bran cond sub pod time code
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 8     8   1182 use strict;
  8         16  
  8         262  
23 8     8   39 use warnings;
  8         15  
  8         184  
24              
25 8     8   8114 use Class::Accessor;
  8         17840  
  8         61  
26              
27 8     8   300 use base qw(Class::Accessor);
  8         15  
  8         2086  
28             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             sub new {
42 2     2 1 1050 my $class=shift;
43 2         5 my $self={@_};
44 2   33     13 bless $self, (ref($class) || $class);
45 2         5 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 if you want only globally meaningful URI.
54              
55             =head3 real_uri
56              
57             Wrapper around L which returns either a globally meaningful
58             URI or undef if not set or a blank node. Cannot be used to set
59             L.
60              
61             =cut
62              
63             sub real_uri {
64 1     1 1 339 my $self=shift;
65 1         3 my $uri=$self->uri(@_);
66 1 50 33     20 return( $uri && $uri!~/^_/ ? $uri : undef );
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             1;