File Coverage

blib/lib/XML/NewsML_G2/Group.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package XML::NewsML_G2::Group;
2              
3 18     18   130 use Moose;
  18         41  
  18         143  
4 18     18   122455 use XML::NewsML_G2::News_Item;
  18         68  
  18         811  
5 18     18   157 use namespace::autoclean;
  18         40  
  18         134  
6              
7             has 'role', isa => 'Str', is => 'ro', required => 1;
8             has 'mode',
9             isa => 'XML::NewsML_G2::Types::Group_Mode',
10             is => 'rw',
11             default => 'bag';
12              
13             has 'items',
14             isa => 'ArrayRef[XML::NewsML_G2::News_Item|XML::NewsML_G2::Group]',
15             is => 'ro',
16             default => sub { [] },
17             traits => ['Array'],
18             handles => { add_item => 'push' };
19              
20             __PACKAGE__->meta->make_immutable;
21              
22             1;
23             __END__
24              
25             =head1 NAME
26              
27             XML::NewsML_G2::Group - a group of news items (or other groups)
28              
29             =for test_synopsis
30             my ($news_item, $news_item_for_picture);
31              
32             =head1 SYNOPSIS
33              
34             my $group = XML::NewsML_G2::Group->new(role => 'slide');
35              
36             $group->add_item($news_item);
37             $group->add_item($news_item_for_picture);
38              
39             =head1 DESCRIPTION
40              
41             This module is used to group news items within a package item. A group
42             can contain any number of news items, as well as other groups. The
43             role is used to inform the receiver of the package item which kind of
44             content the group contains - the main content of a story, a sidebar, a
45             slideshow, ...
46              
47             =head1 ATTRIBUTES
48              
49             =over 4
50              
51             =item role
52              
53             The role of this group, within the package item. The attribute is
54             required by the NewsML-G2 specification, but currently, IPTC does not
55             provide a CV for it, so you will have to define a
56             L<XML::NewsML_G2::Scheme> for yourself and register it with the
57             L<XML::NewsML_G2::Scheme_Manager>.
58              
59             =item items
60              
61             Reference to an array of items contained in this group. Each item must
62             be a L<XML::NewsML_G2::News_Item> or a L<XML::NewsML_G2::Group>.
63              
64             =item mode
65              
66             A group can have one of the following modes: bag, sequential,
67             alternative. Defaulto to "bag".
68              
69             =back
70              
71             =head1 METHODS
72              
73             =over 4
74              
75             =item add_item
76              
77             Takes one or more items to be added to this group.
78              
79             =back
80              
81             =head1 AUTHOR
82              
83             Philipp Gortan C<< <philipp.gortan@apa.at> >>
84              
85             =head1 LICENCE AND COPYRIGHT
86              
87             Copyright (c) 2014, APA-IT. All rights reserved.
88              
89             See L<XML::NewsML_G2> for the license.