File Coverage

blib/lib/RDF/DOAP/Types.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 22 22 100.0


line stmt bran cond sub pod time code
1             package RDF::DOAP::Types;
2              
3 2     2   15 use strict;
  2         4  
  2         62  
4 2     2   8 use warnings;
  2         4  
  2         106  
5              
6             our $AUTHORITY = 'cpan:TOBYINK';
7             our $VERSION = '0.103';
8              
9 2     2   1168 use Type::Utils -all;
  2         10821  
  2         21  
10 2     2   7014 use Type::Library -base;
  2         5  
  2         12  
11 2     2   426 use Types::TypeTiny qw(StringLike);
  2         3  
  2         9  
12              
13 2     2   432 BEGIN { extends 'Types::Standard' };
14              
15             declare 'Identifier',
16             as InstanceOf["RDF::Trine::Node"];
17              
18             coerce 'Identifier',
19             from Str, q{ /^_:(.+)$/ ? 'RDF::Trine::Node::Blank'->new($1) : 'RDF::Trine::Node::Resource'->new($_) },
20             from HasMethods['rdf_about'], q{ $_->rdf_about },
21             from StringLike, q{ /^_:(.+)$/ ? 'RDF::Trine::Node::Blank'->new("$1") : 'RDF::Trine::Node::Resource'->new("$_") };
22              
23             declare 'String',
24             as Str;
25              
26             coerce 'String',
27             from InstanceOf["RDF::Trine::Node::Literal"], q{ $_->literal_value },
28             from StringLike, q{"$_"};
29              
30             class_type 'Model', { class => 'RDF::Trine::Model' };
31              
32             for my $class (qw/ Project Version Change ChangeSet Person Issue Repository /)
33             {
34             declare $class,
35             as InstanceOf[ "RDF::DOAP::$class" ];
36             coerce $class,
37             from 'Identifier', qq{ "RDF::DOAP::$class"->rdf_load(\$_) };
38             }
39              
40             1;