| 1 | package XML::NewsML_G2::News_Message; | ||
| 2 | |||
| 3 | 19 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 19 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | # header elements | ||
| 7 | 19 | has 'sent', | |
| 8 | isa => 'DateTime', | ||
| 9 | is => 'ro', | ||
| 10 | lazy => 1, | ||
| 11 | builder => '_build_sent'; | ||
| 12 | |||
| 13 | has 'destination', | ||
| 14 | isa => 'ArrayRef[XML::NewsML_G2::Destination]', | ||
| 15 | is => 'ro', | ||
| 16 | 1 | ▶ | default => sub { [] }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 17 | 19 | traits => ['Array'], | |
| 18 | handles => { add_destination => 'push' }; | ||
| 19 | |||
| 20 | #news/package items | ||
| 21 | has 'items', | ||
| 22 | isa => 'ArrayRef[XML::NewsML_G2::AnyItem]', | ||
| 23 | is => 'rw', | ||
| 24 | 1 | ▶ | default => sub { [] }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 25 | 19 | traits => ['Array'], | |
| 26 | handles => { add_item => 'push' }; | ||
| 27 | |||
| 28 | sub _build_sent { | ||
| 29 | 1 | ▶ | return DateTime->now( time_zone => 'local' ); |
|
Subroutine
_build_sent: called CC=1 SCAR=0.0
| |||
| 30 | } | ||
| 31 | |||
| 32 | 19 | __PACKAGE__->meta->make_immutable; | |
| 33 | |||
| 34 | 19 | 1; | |
| 35 | __END__ | ||
| 36 | |||
| 37 | =head1 NAME | ||
| 38 | |||
| 39 | XML::NewsML_G2::News_Message - a container that can hold multiple News | ||
| 40 | or Package Items | ||
| 41 | |||
| 42 | =for test_synopsis | ||
| 43 | my (%text_params, %pic_params); | ||
| 44 | |||
| 45 | =head1 SYNOPSIS | ||
| 46 | |||
| 47 | my $nm = XML::NewsML_G2::News_Message->new(); | ||
| 48 | my $ni_text = XML::NewsML_G2::News_Item_Text->new(%text_params); | ||
| 49 | my $ni_picture = XML::NewsML_G2::News_Item_Picture->new(%pic_params); | ||
| 50 | $nm->add_item($ni_text); | ||
| 51 | $nm->add_item($ni_picture); | ||
| 52 | |||
| 53 | =head1 ATTRIBUTES | ||
| 54 | |||
| 55 | =over 4 | ||
| 56 | |||
| 57 | =item sent | ||
| 58 | |||
| 59 | Timestemp generated automatically | ||
| 60 | |||
| 61 | =item destination | ||
| 62 | |||
| 63 | Intended target for news message | ||
| 64 | |||
| 65 | =item items | ||
| 66 | |||
| 67 | A collection of news and/or package items | ||
| 68 | |||
| 69 | =back | ||
| 70 | |||
| 71 | =head1 AUTHOR | ||
| 72 | |||
| 73 | Stefan Hrdlicka C<< <stefan.hrdlicka@apa.at> >> | ||
| 74 | |||
| 75 | =head1 LICENCE AND COPYRIGHT | ||
| 76 | |||
| 77 | Copyright (c) 2013, APA-IT. All rights reserved. | ||
| 78 | |||
| 79 | See L<XML::NewsML_G2> for the license. | ||