blib/lib/XML/Grammar/Vered.pm

filter: Statementstmt 90.0% 18 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 92.5% 25 / 27 CC 1 SCAR 0.4
CC
1
Cov
90%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Build ↑ Summary
1 package XML::Grammar::Vered;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use autodie;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶use MooX qw/late/;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 ▶use XML::GrammarBase::Role::RelaxNG v0.2.2;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use XML::GrammarBase::Role::XSLT v0.2.2;
Subroutine BEGIN: called CC=1 SCAR=2.6
14  
15 our $VERSION = 'v0.0.9';
16  
17 with('XML::GrammarBase::Role::RelaxNG');
18 with XSLT( output_format => 'docbook' );
19  
20 has '+module_base' => ( default => 'XML-Grammar-Vered' );
21 has '+rng_schema_basename' => ( default => 'vered-xml.rng' );
22  
23 has '+to_docbook_xslt_transform_basename' =>
24 ( default => 'vered-xml-to-docbook.xslt' );
25  
26 has '_mode' => ( is => 'rw', init_arg => 'mode' );
27 has '_output_mode' => ( is => 'rw', init_arg => 'output_mode', );
28  
29 1;
30  
31 __END__
32  
33 =pod
34  
35 =encoding UTF-8
36  
37 =head1 NAME
38  
39 XML::Grammar::Vered - a vered by any other name will translate as sweet.
40  
41 =head1 VERSION
42  
43 version 0.0.10
44  
45 =head1 SYNOPSIS
46  
47 my $xslt = XML::Grammar::Vered->new(
48 data_dir => "/path/to/data-dir",
49 );
50  
51 my $input_filename = '/path/to/my-file-in-vered-format.xml';
52 # Throws an exception on failure.
53 my $as_docbook = $xslt->perform_xslt_translation(
54 {
55 output_format => 'docbook'
56 source => {file => $input_filename, },
57 output => "string",
58 }
59 );
60  
61 =head1 DESCRIPTION
62  
63 Vered-XML is a custom (and incredibly ad-hoc) XML grammar, which was created
64 for the ability to more easily write and maintain the “Perl Elements to
65 Avoid” page over at L<http://perl-begin.org/tutorials/bad-elements/> . You
66 may find it suitable, but chances are you won't. If you find it lacking in
67 a certain respect, you can either send me a diff to the RNG and XSLT (and
68 hopefully automated tests as well), or file a bug report and I'll see what
69 I can do.
70  
71 Vered gets translated to DocBook 5/XML, and from there to other formats.
72  
73 “Vered” is the Hebrew word for “a rose”, and I came up with the name because
74 I did not know what to call this format, and thought of “a rose by any other
75 name will smell as sweet”.
76  
77 =head1 VERSION
78  
79 version 0.0.10
80  
81 =head1 EXAMPLE
82  
83 <?xml version="1.0" encoding="utf-8"?>
84 <document xmlns="http://www.shlomifish.org/open-source/projects/XML-Grammar/Vered/" xmlns:xlink="http://www.w3.org/1999/xlink" version="0.2.0" xml:lang="en-GB" xml:id="index">
85 <info>
86 <title>Perl Elements to Avoid</title>
87 </info>
88 <body>
89 <preface xml:id="intro">
90 <info>
91 <title>Introduction</title>
92 </info>
93  
94 <p>
95 Often when people ask for help with Perl code, they show
96 Perl code that
97 suffers from many bad or outdated <b>elements</b>.
98 </p>
99  
100 <p>
101 <strong>Note:</strong> Please don't think this advice is
102 meant as gospel. I tried to avoid
103 <a xlink:href="http://bikeshed.com/">colour of
104 the bike shed arguments</a>), but some of the advice here
105 may still be controversial.
106 </p>
107 </preface>
108 <section xml:id="bad-elements">
109 <info>
110 <title>The List of Bad Elements</title>
111 </info>
112 <item xml:id="no-indentation">
113 <info>
114 <title>No Indentation</title>
115 </info>
116 <p>
117 <a
118 xlink:href="http://en.wikipedia.org/wiki/Indent_style">Indentation</a>
119 means that the contents of every block are promoted from their
120 containing environment by using a shift of some space. This
121 makes the code easier to read and follow.
122 </p>
123  
124 <p>
125 You can look into <cpan_self_dist d="Perl-Tidy" /> from
126 CPAN for more information.
127 </p>
128 </section>
129 <section xml:id="sources_of_advice">
130 <info>
131 <title>Sources of This Advice</title>
132 </info>
133  
134 <p>
135 This is a short list of the sources from which this advice was
136 taken which
137 also contains material for further reading:
138 </p>
139  
140 <ol>
141  
142 <li>
143 <p>
144 <a xlink:href="$(ROOT)/books/advanced/#pbp">The
145 Book "Perl Best Practices"</a> by Damian Conway - contains a lot of good
146 advice and food for thought, but sometimes should be deviated from.
147 Also see the
148 <a xlink:href="https://www.socialtext.net/perl5/index.cgi?pbp_module_recommendation_commentary">"PBP
149 Module Recommendation Commentary"</a> on the Perl 5 Wiki.
150 </p>
151 </li>
152  
153 <li>
154 <p>
155 <a xlink:href="https://www.socialtext.net/perl5/index.cgi?ancient_perl">"Ancient
156 Perl"</a> on the Perl 5 Wiki.
157 </p>
158 </li>
159  
160 <li>
161 <p>
162 <a xlink:href="http://modernperlbooks.com/">chromatic's "Modern Perl" Book and
163 Blog</a>
164 </p>
165 </li>
166  
167 <li>
168 <p>
169 The book <a xlink:href="http://www.refactoring.com/"><i>Refactoring</i> by Martin
170 Fowler</a> - not particularly about Perl, but still useful.
171 </p>
172 </li>
173  
174 <li>
175 <p>
176 The book
177 <a xlink:href="http://pragprog.com/book/tpp/the-pragmatic-programmer"><i>The Pragmatic
178 Programmer: From Journeyman to Master</i></a> - also not particularly about
179 Perl, and I found it somewhat disappointing, but it is an informative book.
180 </p>
181 </li>
182  
183 <li>
184 <p>
185 Advice given by people on <a xlink:href="$(ROOT)/irc/#freenode">Freenode's #perl
186 channel</a>, on the Perl Beginners mailing list, and on other Perl forums.
187 </p>
188 </li>
189  
190 </ol>
191  
192 </section>
193 </body>
194 </document>
195  
196 =head1 AUTHOR
197  
198 Shlomi Fish <shlomif@cpan.org>
199  
200 =head1 COPYRIGHT AND LICENSE
201  
202 This software is Copyright (c) 2013 by Shlomi Fish.
203  
204 This is free software, licensed under:
205  
206 The MIT (X11) License
207  
208 =head1 BUGS
209  
210 Please report any bugs or feature requests on the bugtracker website
211 L<https://github.com/shlomif/XML-Grammar-Vered/issues>
212  
213 When submitting a bug or request, please include a test-file or a
214 patch to an existing test-file that illustrates the bug or desired
215 feature.
216  
217 =for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
218  
219 =head1 SUPPORT
220  
221 =head2 Perldoc
222  
223 You can find documentation for this module with the perldoc command.
224  
225 perldoc XML::Grammar::Vered
226  
227 =head2 Websites
228  
229 The following websites have more information about this module, and may be of help to you. As always,
230 in addition to those websites please use your favorite search engine to discover more resources.
231  
232 =over 4
233  
234 =item *
235  
236 MetaCPAN
237  
238 A modern, open-source CPAN search engine, useful to view POD in HTML format.
239  
240 L<https://metacpan.org/release/XML-Grammar-Vered>
241  
242 =item *
243  
244 Search CPAN
245  
246 The default CPAN search engine, useful to view POD in HTML format.
247  
248 L<http://search.cpan.org/dist/XML-Grammar-Vered>
249  
250 =item *
251  
252 RT: CPAN's Bug Tracker
253  
254 The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
255  
256 L<https://rt.cpan.org/Public/Dist/Display.html?Name=XML-Grammar-Vered>
257  
258 =item *
259  
260 AnnoCPAN
261  
262 The AnnoCPAN is a website that allows community annotations of Perl module documentation.
263  
264 L<http://annocpan.org/dist/XML-Grammar-Vered>
265  
266 =item *
267  
268 CPAN Ratings
269  
270 The CPAN Ratings is a website that allows community ratings and reviews of Perl modules.
271  
272 L<http://cpanratings.perl.org/d/XML-Grammar-Vered>
273  
274 =item *
275  
276 CPANTS
277  
278 The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
279  
280 L<http://cpants.cpanauthors.org/dist/XML-Grammar-Vered>
281  
282 =item *
283  
284 CPAN Testers
285  
286 The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
287  
288 L<http://www.cpantesters.org/distro/X/XML-Grammar-Vered>
289  
290 =item *
291  
292 CPAN Testers Matrix
293  
294 The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
295  
296 L<http://matrix.cpantesters.org/?dist=XML-Grammar-Vered>
297  
298 =item *
299  
300 CPAN Testers Dependencies
301  
302 The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
303  
304 L<http://deps.cpantesters.org/?module=XML::Grammar::Vered>
305  
306 =back
307  
308 =head2 Bugs / Feature Requests
309  
310 Please report any bugs or feature requests by email to C<bug-xml-grammar-vered at rt.cpan.org>, or through
311 the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=XML-Grammar-Vered>. You will be automatically notified of any
312 progress on the request by the system.
313  
314 =head2 Source Code
315  
316 The code is open to the world, and available for you to hack on. Please feel free to browse it and play
317 with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
318 from your repository :)
319  
320 L<https://github.com/shlomif/XML-Grammar-Vered>
321  
322 git clone git://github.com/shlomif/XML-Grammar-Vered.git
323  
324 =cut
« Build ↑ Summary