| 1 | package XML::NewsML_G2::Group; | ||
| 2 | |||
| 3 | 20 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 20 | ▶ | use XML::NewsML_G2::News_Item; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 20 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 20 | has 'role', isa => 'Str', is => 'ro', required => 1; | |
| 8 | 20 | 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 | 1 | ▶ | default => sub { [] }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 17 | 20 | traits => ['Array'], | |
| 18 | handles => { add_item => 'push' }; | ||
| 19 | |||
| 20 | 20 | __PACKAGE__->meta->make_immutable; | |
| 21 | |||
| 22 | 20 | 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. | ||