blib/lib/XML/NewsML_G2.pm

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