File Coverage

blib/lib/XML/NewsML_G2.pm
Criterion Covered Total %
statement 162 162 100.0
branch n/a
condition n/a
subroutine 54 54 100.0
pod n/a
total 216 216 100.0


line stmt bran cond sub pod time code
1             package XML::NewsML_G2;
2              
3 18     18   8182337 use XML::NewsML_G2::Audio;
  18         73  
  18         771  
4 18     18   9421 use XML::NewsML_G2::Binary;
  18         60  
  18         594  
5 18     18   8374 use XML::NewsML_G2::Concept;
  18         66  
  18         717  
6 18     18   9171 use XML::NewsML_G2::Concept_Item;
  18         76  
  18         773  
7 18     18   9578 use XML::NewsML_G2::Copyright_Holder;
  18         66  
  18         740  
8 18     18   8528 use XML::NewsML_G2::Creator;
  18         58  
  18         588  
9 18     18   7697 use XML::NewsML_G2::Desk;
  18         58  
  18         605  
10 18     18   8500 use XML::NewsML_G2::ElectionDistrict;
  18         59  
  18         607  
11 18     18   8240 use XML::NewsML_G2::ElectionProvince;
  18         56  
  18         599  
12 18     18   8122 use XML::NewsML_G2::Event_Item;
  18         72  
  18         798  
13 18     18   9304 use XML::NewsML_G2::Event_Ref;
  18         58  
  18         603  
14 18     18   133 use XML::NewsML_G2::Facet;
  18         39  
  18         373  
15 18     18   7960 use XML::NewsML_G2::Genre;
  18         56  
  18         589  
16 18     18   7896 use XML::NewsML_G2::Graphics;
  18         71  
  18         735  
17 18     18   9307 use XML::NewsML_G2::Group;
  18         71  
  18         720  
18 18     18   10258 use XML::NewsML_G2::Icon;
  18         68  
  18         648  
19 18     18   8428 use XML::NewsML_G2::Inline_CData;
  18         69  
  18         634  
20 18     18   137 use XML::NewsML_G2::Inline_Data;
  18         37  
  18         389  
21 18     18   91 use XML::NewsML_G2::Link;
  18         37  
  18         372  
22 18     18   8367 use XML::NewsML_G2::Destination;
  18         59  
  18         599  
23 18     18   7881 use XML::NewsML_G2::Location;
  18         77  
  18         716  
24 18     18   147 use XML::NewsML_G2::Media_Topic;
  18         42  
  18         1674  
25 18     18   107 use XML::NewsML_G2::News_Item;
  18         39  
  18         337  
26 18     18   9408 use XML::NewsML_G2::News_Item_Audio;
  18         68  
  18         780  
27 18     18   9259 use XML::NewsML_G2::News_Item_Graphics;
  18         67  
  18         808  
28 18     18   160 use XML::NewsML_G2::News_Item_Picture;
  18         38  
  18         396  
29 18     18   8830 use XML::NewsML_G2::News_Item_Text;
  18         73  
  18         775  
30 18     18   9952 use XML::NewsML_G2::News_Item_Video;
  18         89  
  18         1082  
31 18     18   9391 use XML::NewsML_G2::News_Message;
  18         78  
  18         745  
32 18     18   9412 use XML::NewsML_G2::Organisation;
  18         76  
  18         805  
33 18     18   9376 use XML::NewsML_G2::Package_Item;
  18         77  
  18         779  
34 18     18   157 use XML::NewsML_G2::Picture;
  18         36  
  18         392  
35 18     18   9810 use XML::NewsML_G2::Product;
  18         68  
  18         662  
36 18     18   8521 use XML::NewsML_G2::Provider;
  18         92  
  18         617  
37 18     18   8572 use XML::NewsML_G2::Remote_Info;
  18         61  
  18         597  
38 18     18   8272 use XML::NewsML_G2::Scheme;
  18         64  
  18         628  
39 18     18   8704 use XML::NewsML_G2::Scheme_Manager;
  18         75  
  18         827  
40 18     18   9469 use XML::NewsML_G2::Service;
  18         61  
  18         613  
41 18     18   7992 use XML::NewsML_G2::SportFacet;
  18         57  
  18         596  
42 18     18   7999 use XML::NewsML_G2::SportFacetValue;
  18         63  
  18         665  
43 18     18   7906 use XML::NewsML_G2::StoryType;
  18         61  
  18         604  
44 18     18   143 use XML::NewsML_G2::Substancial_Item;
  18         40  
  18         486  
45 18     18   8138 use XML::NewsML_G2::Topic;
  18         63  
  18         594  
46 18     18   7946 use XML::NewsML_G2::Translatable_Text;
  18         64  
  18         669  
47 18     18   8566 use XML::NewsML_G2::Video;
  18         99  
  18         726  
48 18     18   9249 use XML::NewsML_G2::Writer::Concept_Item;
  18         72  
  18         767  
49 18     18   10142 use XML::NewsML_G2::Writer::Event_Item;
  18         73  
  18         728  
50 18     18   9828 use XML::NewsML_G2::Writer::News_Item;
  18         68  
  18         751  
51 18     18   9063 use XML::NewsML_G2::Writer::News_Message;
  18         79  
  18         760  
52 18     18   153 use XML::NewsML_G2::Writer::Package_Item;
  18         45  
  18         341  
53 18     18   100 use XML::NewsML_G2::Writer::Substancial_Item;
  18         41  
  18         465  
54              
55 18     18   100 use warnings;
  18         37  
  18         567  
56 18     18   110 use strict;
  18         41  
  18         381  
57              
58 18     18   8455 use version; our $VERSION = qv('0.3.4');
  18         28752  
  18         130  
59              
60             1;
61              
62             __END__
63              
64             =head1 NAME
65              
66             XML::NewsML_G2 - generate NewsML-G2 news items
67              
68              
69             =head1 VERSION
70              
71             0.3.4
72              
73             =begin readme
74              
75             =head1 INSTALLATION
76              
77             To install this module, run the following commands:
78              
79             perl Build.PL
80             ./Build
81             ./Build test
82             ./Build install
83              
84             =end readme
85              
86             =head1 SYNOPSIS
87              
88             use XML::NewsML_G2;
89              
90             my $provider = XML::NewsML_G2::Provider->new
91             (qcode => 'nsa', name => 'News Somewhere Agency');
92              
93             my $ni = XML::NewsML_G2::News_Item_Text->new
94             (title => 'My first NewsML-G2 news item',
95             language => 'en', provider => $provider);
96              
97             my $writer = XML::NewsML_G2::Writer::News_Item->new(news_item => $ni);
98             my $dom = $writer->create_dom();
99             print $dom->serialize(1);
100              
101              
102             =head1 DESCRIPTION
103              
104             This module tries to implement the creation of XML files conforming to
105             the NewsML-G2 specification as published by the IPTC. It does not aim
106             to implement the complete standard, but to cover the most common use
107             cases in a best-practice manner.
108              
109             For the full specification of the format, visit
110             L<http://www.newsml-g2.org/>. For a quick introduction, you might
111             prefer the L<Quick Start
112             Guides|http://www.iptc.org/download?g2quickstartguides>.
113              
114             =head1 GETTING STARTED
115              
116             To start, you need to create an instance of the item class of your
117             choice, e.g. L<XML::NewsML_G2::News_Item_Text> for a text story, or
118             L<XML::NewsML_G2::News_Item_Picture> for an image. Each of these
119             classes might have some required attributes (e.g. C<title>,
120             C<language>, C<provider>), which you will have to provide when
121             creating the instance, as well as a number of optional ones
122             (e.g. C<note>). While for some attributes scalar values will do,
123             others will require further instances of classes, e.g. for C<provider>
124             you will need an instance of L<XML::NewsML_G2::Provider>. Please see
125             each class' documentation for details.
126              
127             Once you're done setting up your data structure, you have to create a
128             writer instance in order to retrieve your DOM. For simple news items
129             like text or picture, L<XML::NewsML_G2::Writer::News_Item> will be the
130             writer class to use.
131              
132             =head1 CURRENT STATUS
133              
134             The implementation currently supports text, picture, video, audio,
135             graphics, as well as multimedia packages and slideshows.
136              
137             Version 2.18 is the latest version of the standard supported by this
138             software, and should be your first choice. Using versions 2.9, 2.12
139             and 2.15 is deprecated, and support for it will beremoved in future
140             releases.
141              
142             =for readme stop
143              
144             =head1 SCHEMES AND CATALOGS
145              
146             Before starting to use schemes or catalogs with this module, read the
147             chapter 13 of the L<NewsML-G2 implementation
148             guide|http://www.iptc.org/std/NewsML-G2/2.17/documentation/IPTC-G2-Implementation_Guide_6.1.pdf>.
149             Go on, do it now. I'll wait.
150              
151             You don't need to use either schemes or catalogs in order to use this
152             module, unless you are required to do so by the NewsML-G2 standard
153             (e.g. the C<service> attribute). If you specify a value for such an
154             attribute and don't add a corresponding scheme, creating the DOM tree
155             will die.
156              
157             For all attributes where a scheme is not required by the standard, you
158             can start without specifying anything. In that case, a C<literal>
159             attribute will be created, with the value you specified in the
160             C<qcode> attribute. For instance:
161              
162             my $org = XML::NewsML_G2::Organisation->new(name => 'Google', qcode => 'gogl');
163             $ni->add_organisation($org);
164              
165             will result in this output:
166              
167             <subject type="cpnat:organisation" literal="org#gogl">
168             <name>Google</name>
169             </subject>
170              
171             If the qcodes used in your organisation instances are part of a
172             controlled vocabulary, you can convey this information by creating a
173             L<XML::NewsML_G2::Scheme> instance, specifying a custom, unique C<uri>
174             for your vocabulary, and registering it with the
175             L<XML::NewsML_G2::Scheme_Manager>:
176              
177             my $os = XML::NewsML_G2::Scheme->new(alias => 'xyzorg',
178             uri => 'http://xyz.org/cv/org');
179             my $sm = XML::NewsML_G2::Scheme_Manager->new(org => $os);
180              
181             The output will now contain an inline catalog with your scheme:
182              
183             <catalog>
184             <scheme alias="xyzorg" uri="http://xyz.org/cv/org"/>
185             </catalog>
186              
187             and the literal will be replaced by a qcode:
188              
189             <subject type="cpnat:organisation" qcode="xyzorg:gogl">
190             <name>Google</name>
191             </subject>
192              
193             If you have multiple schemes, you can package them together into a
194             single catalog, which you publish on your website. Simply specify the
195             URL of the catalog when creating the L<XML::NewsML_G2::Scheme>
196             instance:
197              
198             my $os = XML::NewsML_G2::Scheme->new(alias => 'xyzorg',
199             catalog => 'http://xyz.org/catalog_1.xml');
200              
201             and the inline catalog will be replaced with a link:
202              
203             <catalogRef href="http://xyz.org/catalog_1.xml"/>
204              
205             =head1 API
206              
207             =head2 Main Classes
208              
209             =over 4
210              
211             =item L<XML::NewsML_G2::News_Item>
212              
213             =item L<XML::NewsML_G2::News_Item_Text>
214              
215             =item L<XML::NewsML_G2::News_Item_Audio>
216              
217             =item L<XML::NewsML_G2::News_Item_Picture>
218              
219             =item L<XML::NewsML_G2::News_Item_Video>
220              
221             =item L<XML::NewsML_G2::News_Item_Graphics>
222              
223             =item L<XML::NewsML_G2::News_Message>
224              
225             =item L<XML::NewsML_G2::Package_Item>
226              
227             =item L<XML::NewsML_G2::AnyItem>
228              
229             =back
230              
231              
232             =head2 Scheme Handling
233              
234             =over 4
235              
236             =item L<XML::NewsML_G2::Scheme>
237              
238             =item L<XML::NewsML_G2::Scheme_Manager>
239              
240             =back
241              
242              
243             =head2 Classes for Structured Data Attributes
244              
245             =over 4
246              
247             =item L<XML::NewsML_G2::Service>
248              
249             =item L<XML::NewsML_G2::Video>
250              
251             =item L<XML::NewsML_G2::Media_Topic>
252              
253             =item L<XML::NewsML_G2::Topic>
254              
255             =item L<XML::NewsML_G2::Genre>
256              
257             =item L<XML::NewsML_G2::Provider>
258              
259             =item L<XML::NewsML_G2::Desk>
260              
261             =item L<XML::NewsML_G2::Location>
262              
263             =item L<XML::NewsML_G2::Organisation>
264              
265             =item L<XML::NewsML_G2::Product>
266              
267             =item L<XML::NewsML_G2::Group>
268              
269             =item L<XML::NewsML_G2::Picture>
270              
271             =item L<XML::NewsML_G2::Graphics>
272              
273             =item L<XML::NewsML_G2::Audio>
274              
275             =item L<XML::NewsML_G2::Copyright_Holder>
276              
277             =item L<XML::NewsML_G2::Icon>
278              
279             =item L<XML::NewsML_G2::Link>
280              
281             =back
282              
283              
284             =head2 Writer Classes and Roles
285              
286             =over 4
287              
288             =item L<XML::NewsML_G2::Writer>
289              
290             =item L<XML::NewsML_G2::Writer::News_Item>
291              
292             =item L<XML::NewsML_G2::Writer::News_Message>
293              
294             =item L<XML::NewsML_G2::Writer::Package_Item>
295              
296             =item L<XML::NewsML_G2::Role::Writer>
297              
298             =item L<XML::NewsML_G2::Role::Writer_2_9>
299              
300             =item L<XML::NewsML_G2::Role::Writer_2_12>
301              
302             =item L<XML::NewsML_G2::Role::Writer_2_15>
303              
304             =item L<XML::NewsML_G2::Role::Writer_2_18>
305              
306             =item L<XML::NewsML_G2::Role::Writer::News_Item_Text>
307              
308             =item L<XML::NewsML_G2::Role::Writer::News_Item_Audio>
309              
310             =item L<XML::NewsML_G2::Role::Writer::News_Message>
311              
312             =item L<XML::NewsML_G2::Role::Writer::News_Item_Picture>
313              
314             =item L<XML::NewsML_G2::Role::Writer::Package_Item>
315              
316             =item L<XML::NewsML_G2::Role::Writer::News_Item_Video>
317              
318             =item L<XML::NewsML_G2::Role::Writer::News_Item_Graphics>
319              
320             =back
321              
322              
323             =head2 Type Definitions
324              
325             =over 4
326              
327             =item L<XML::NewsML_G2::Types>
328              
329             =back
330              
331              
332             =head2 Utility Roles
333              
334             =over 4
335              
336             =item L<XML::NewsML_G2::Role::HasQCode>
337              
338             =item L<XML::NewsML_G2::Role::Remote>
339              
340             =item L<XML::NewsML_G2::Role::RemoteVisual>
341              
342             =item L<XML::NewsML_G2::Role::RemoteAudible>
343              
344             =back
345              
346             =for readme continue
347              
348              
349             =head1 DEPENDENCIES
350              
351             Moose, XML::LibXML, DateTime, DateTime::Format::XSD, UUID::Tiny,
352             Module::Runtime
353              
354             =head1 BUGS AND LIMITATIONS
355              
356             No bugs have been reported.
357              
358             Please report any bugs or feature requests at
359             L<https://github.com/apa-it/xml-newsml-g2/issues>.
360              
361             Be aware that the API for this module I<will> change with each
362             upcoming release.
363              
364             =head1 SEE ALSO
365              
366             =over 4
367              
368             =item L<XML::NewsML> - Simple interface for creating NewsML documents
369              
370             =back
371              
372             =head1 AUTHORS
373              
374             =over 4
375              
376             =item Philipp Gortan C<< <philipp.gortan@apa.at> >>
377              
378             =item Mario Paumann C<< <mario.paumann@apa.at> >>
379              
380             =item Christian Eder C<< <christian.eder@apa.at> >>
381              
382             =item Stefan Hrdlicka C<< <stefan.hrdlicka@apa.at> >>
383              
384             =back
385              
386             =head1 LICENCE AND COPYRIGHT
387              
388             Copyright (c) 2013-2015, APA-IT. All rights reserved.
389              
390             This module is free software; you can redistribute it and/or modify it
391             under the terms of the GNU General Public License as published by the
392             Free Software Foundation; either version 2 of the License, or (at your
393             option) any later version.
394              
395             This module is distributed in the hope that it will be useful, but
396             WITHOUT ANY WARRANTY; without even the implied warranty of
397             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
398             General Public License for more details.
399              
400             You should have received a copy of the GNU General Public License
401             along with this module. If not, see L<http://www.gnu.org/licenses/>.