File Coverage

blib/lib/Dist/Inkt/Role/WriteDOAP.pm
Criterion Covered Total %
statement 9 16 56.2
branch 0 4 0.0
condition 0 5 0.0
subroutine 3 4 75.0
pod 0 1 0.0
total 12 30 40.0


line stmt bran cond sub pod time code
1             package Dist::Inkt::Role::WriteDOAP;
2              
3             our $AUTHORITY = 'cpan:TOBYINK';
4             our $VERSION = '0.022';
5              
6 1     1   1456 use Moose::Role;
  1         2  
  1         9  
7 1     1   5451 use RDF::TrineX::Functions 'serialize';
  1         2  
  1         7  
8 1     1   221 use namespace::autoclean;
  1         2  
  1         8  
9              
10             with 'Dist::Inkt::Role::RDFModel';
11              
12             after BUILD => sub {
13             my $self = shift;
14             unshift @{ $self->targets }, 'DOAP';
15             };
16              
17             sub Build_DOAP
18             {
19 0     0 0   my $self = shift;
20 0           my $file = $self->targetfile('doap.ttl');
21 0 0         $file->exists and return $self->log('Skipping %s; it already exists', $file);
22 0           $self->log('Writing %s', $file);
23            
24 0 0 0       $self->rights_for_generated_files->{'doap.ttl'} ||= [
25             $self->_inherited_rights
26             ] if $self->DOES('Dist::Inkt::Role::WriteCOPYRIGHT');
27            
28 0   0       my $serializer = eval {
29             require RDF::TrineX::Serializer::MockTurtleSoup;
30             'RDF::TrineX::Serializer::MockTurtleSoup'->new;
31             } || 'RDF::Trine::Serializer::Turtle'->new;
32            
33 0           serialize(
34             $self->model,
35             to => $file->openw,
36             using => $serializer,
37             );
38             }
39              
40             1;