blib/lib/XML/NewsML_G2.pm

filter: Statementstmt 100% 56 / 56 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 18 / 18 Podpod n/a totaltotal 100% 74 / 74 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/News_Item.pm ↑ Summary blib/lib/XML/NewsML_G2/Desk.pm »
1 package XML::NewsML_G2;
2  
3 # $Id: NewsML_G2.pm 47100 2013-07-04 16:30:19Z apatecgortan $
4  
5 9 ▶use XML::NewsML_G2::News_Item;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 9 ▶use XML::NewsML_G2::Provider;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 9 ▶use XML::NewsML_G2::Service;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 9 ▶use XML::NewsML_G2::Genre;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 9 ▶use XML::NewsML_G2::Desk;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 9 ▶use XML::NewsML_G2::Media_Topic;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 9 ▶use XML::NewsML_G2::Location;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 9 ▶use XML::NewsML_G2::Organisation;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 9 ▶use XML::NewsML_G2::Topic;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 9 ▶use XML::NewsML_G2::Product;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 9 ▶use XML::NewsML_G2::Scheme_Manager;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 9 ▶use XML::NewsML_G2::Scheme;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 9 ▶use XML::NewsML_G2::Writer;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 9 ▶use XML::NewsML_G2::Writer_2_9;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 9 ▶use XML::NewsML_G2::Writer_2_12;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 9 ▶use version; our $VERSION = qv('v0.1.2');
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 9 1;
27  
28 __END__
29  
30 =head1 NAME
31  
32 XML::NewsML_G2 - generate NewsML-G2 news items
33  
34  
35 =head1 VERSION
36  
37 v0.1.2
38  
39 =begin readme
40  
41 =head1 INSTALLATION
42  
43 To install this module, run the following commands:
44  
45 perl Build.PL
46 ./Build
47 ./Build test
48 ./Build install
49  
50 =end readme
51  
52 =for test_synopsis
53 my %args;
54  
55 =head1 SYNOPSIS
56  
57 use XML::NewsML_G2;
58 my $ni = XML::NewsML_G2::News_Item->new(%args);
59 my $writer = XML::NewsML_G2::Writer_2_12(news_item => $ni);
60 my $dom = $writer->create_dom();
61  
62  
63 =head1 DESCRIPTION
64  
65 This module tries to implement the creation of XML files conforming to
66 the NewsML-G2 specification as published by the IPTC. It does not aim
67 in implementing the complete standard, but in covering the most common
68 use cases.
69  
70 For the full specification of the format, visit
71 L<http://www.iptc.org/site/News_Exchange_Formats/NewsML-G2/>
72  
73 =head1 CURRENT STATUS
74  
75 The implementation currently support text items only - no support for
76 images, videos, graphics or multimedia packages yet.
77  
78 Version 2.9 of the standard is frozen, so the output should not change
79 when you update this distribution. Version 2.12 however is not yet
80 frozen, changes in the output are to be expected.
81  
82 =head1 SCHEMES AND CATALOGS
83  
84 Before starting to use schemes or catalogs with this module, read the
85 chapter 13 of the
86 L<NewsML-G2 implementation guide|http://www.iptc.org/std/NewsML-G2/2.12/documentation/IPTC-G2-Implementation_Guide_5.0.pdf>.
87 Go on, do it now. I'll wait.
88  
89 You don't need to use either schemes or catalogs in order to use this
90 module, unless you are required to do so by the NewsML-G2 standard
91 (e.g. the C<service> attribute). If you specify a value for such an
92 attribute and don't add a corresponding scheme, creating the DOM tree
93 will die.
94  
95 For all attributes where a scheme is not required by the standard, you
96 can start without specifying anything. In that case, a C<literal>
97 attribute will be created, with the value you specified in the
98 C<qcode> attribute. For instance:
99  
100 my $org = XML::NewsML_G2::Organisation->new(name => 'Google', qcode => 'gogl');
101 $ni->add_organisation($org);
102  
103 will result in this output:
104  
105 <subject type="cpnat:organisation" literal="org#gogl">
106 <name>Google</name>
107 </subject>
108  
109 If the qcodes used in your organisation instances are part of a
110 controlled vocabulary, you can convey this information by creating a
111 L<XML::NewsML_G2::Scheme> instance, specifying a custom, unique C<uri>
112 for your vocabulary, and registering it with the
113 L<XML::NewsML_G2::Scheme_Manager>:
114  
115 my $os = XML::NewsML_G2::Scheme->new(alias => 'xyzorg',
116 uri => 'http://xyz.org/cv/org');
117 my $sm = XML::NewsML_G2::Scheme_Manager->new(org => $os);
118  
119 The output will now contain an inline catalog with your scheme:
120  
121 <catalog>
122 <scheme alias="xyzorg" uri="http://xyz.org/cv/org"/>
123 </catalog>
124  
125 and the literal will be replaced by a qcode:
126  
127 <subject type="cpnat:organisation" qcode="xyzorg:gogl">
128 <name>Google</name>
129 </subject>
130  
131 If you have multiple schemes, you can package them together into a
132 single catalog, which you publish on your website. Simply specify the
133 URL of the catalog when creating the L<XML::NewsML_G2::Scheme>
134 instance:
135  
136 my $os = XML::NewsML_G2::Scheme->new(alias => 'xyzorg',
137 catalog => 'http://xyz.org/catalog_1.xml');
138  
139 and the inline catalog will be replaced with a link:
140  
141 <catalogRef href="http://xyz.org/catalog_1.xml"/>
142  
143 =head1 API
144  
145 =over 4
146  
147 =item L<XML::NewsML_G2::News_Item>
148  
149 =item L<XML::NewsML_G2::Desk>
150  
151 =item L<XML::NewsML_G2::Genre>
152  
153 =item L<XML::NewsML_G2::Location>
154  
155 =item L<XML::NewsML_G2::Media_Topic>
156  
157 =item L<XML::NewsML_G2::Organisation>
158  
159 =item L<XML::NewsML_G2::Product>
160  
161 =item L<XML::NewsML_G2::Provider>
162  
163 =item L<XML::NewsML_G2::Service>
164  
165 =item L<XML::NewsML_G2::Topic>
166  
167 =item L<XML::NewsML_G2::Scheme>
168  
169 =item L<XML::NewsML_G2::Scheme_Manager>
170  
171 =item L<XML::NewsML_G2::Writer>
172  
173 =item L<XML::NewsML_G2::Writer_2_9>
174  
175 =item L<XML::NewsML_G2::Writer_2_12>
176  
177 =back
178  
179 =head1 DEPENDENCIES
180  
181 Moose, XML::LibXML, DateTime, DateTime::Format::XSD, UUID::Tiny
182  
183 =head1 BUGS AND LIMITATIONS
184  
185 No bugs have been reported.
186  
187 Please report any bugs or feature requests to
188 C<bug-xml-newsml_g2@rt.cpan.org>, or through the web interface at
189 L<http://rt.cpan.org>.
190  
191 Be aware that the API for this module I<will> change with each
192 upcoming release.
193  
194 =head1 SEE ALSO
195  
196 =over 4
197  
198 =item L<XML::NewsML> - Simple interface for creating NewsML documents
199  
200 =back
201  
202 =head1 AUTHOR
203  
204 Philipp Gortan C<< <philipp.gortan@apa.at> >>
205  
206  
207 =head1 LICENCE AND COPYRIGHT
208  
209 Copyright (c) 2013, APA-IT. All rights reserved.
210  
211 This module is free software; you can redistribute it and/or modify it
212 under the terms of the GNU General Public License as published by the
213 Free Software Foundation; either version 2 of the License, or (at your
214 option) any later version.
215  
216 This module is distributed in the hope that it will be useful, but
217 WITHOUT ANY WARRANTY; without even the implied warranty of
218 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
219 General Public License for more details.
220  
221 You should have received a copy of the GNU General Public License
222 along with this module. If not, see L<http://www.gnu.org/licenses/>.
« blib/lib/XML/NewsML_G2/News_Item.pm ↑ Summary blib/lib/XML/NewsML_G2/Desk.pm »