File Coverage

blib/lib/XML/NewsML_G2/Role/HasTranslations.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package XML::NewsML_G2::Role::HasTranslations;
2              
3 18     18   8590 use Moose::Role;
  18         45  
  18         99  
4 18     18   84637 use namespace::autoclean;
  18         42  
  18         132  
5              
6             has 'translations',
7             isa => 'HashRef',
8             is => 'rw',
9             default => sub { {} },
10             traits => ['Hash'],
11             handles => {
12             add_translation => 'set',
13             has_translations => 'count',
14             get_translation => 'get',
15             languages => 'keys'
16             };
17              
18             1;
19             __END__
20              
21             =head1 NAME
22              
23             XML::NewsML_G2::Role::HasTranslations - Role for item types that have translations
24              
25             =head1 SYNOPSIS
26              
27             my $media_topic = XML::NewsML_G2::Media_Topic->new
28             (name => 'alpine skiing',
29             qcode => 20001057);
30             $media_topic->add_translation('de', 'alpiner Skilauf')
31              
32             =head1 DESCRIPTION
33              
34             This module serves as a role for all NewsML-G2 item type classes which have
35             translations
36              
37             =head1 ATTRIBUTES
38              
39             =over 4
40              
41             =item translations
42              
43             Hash mapping from language to according translation
44              
45             =back
46              
47             =head1 AUTHOR
48              
49             Christian Eder C<< <christian.eder@apa.at> >>
50              
51             =head1 LICENCE AND COPYRIGHT
52              
53             Copyright (c) 2019, APA-IT. All rights reserved.
54              
55             See L<XML::NewsML_G2> for the license.