File Coverage

blib/lib/Business/cXML/Description.pm
Criterion Covered Total %
statement 23 23 100.0
branch 2 2 100.0
condition n/a
subroutine 8 8 100.0
pod 2 2 100.0
total 35 35 100.0


line stmt bran cond sub pod time code
1             =encoding utf-8
2              
3             =head1 NAME
4              
5             Business::cXML::Description - cXML description content
6              
7             =head1 SYNOPSIS
8              
9             use Business::cXML::Description;
10              
11             =head1 DESCRIPTION
12              
13             Object representation of a cXML C<Description>.
14              
15             =head1 METHODS
16              
17             See L<Business::cXML::Object/COMMON METHODS>.
18              
19             =head1 PROPERTY METHODS
20              
21             See L<Business::cXML::Object/PROPERTY METHODS> for how the following operate.
22              
23             =over
24              
25             =cut
26              
27 9     9   151213 use 5.014;
  9         38  
28 9     9   46 use strict;
  9         19  
  9         320  
29              
30             use base qw(Business::cXML::Object);
31 9     9   44  
  9         16  
  9         1020  
32             use constant NODENAME => 'Description';
33 9     9   63 use constant PROPERTIES => (
  9         29  
  9         621  
34 9         518 lang => 'en-US',
35             short => undef,
36             full => '',
37             );
38 9     9   61  
  9         17  
39             use XML::LibXML::Ferry;
40 9     9   49  
  9         42  
  9         1362  
41             my ($self, $el) = @_;
42              
43 27     27 1 68 $el->ferry($self, {
44             'xml:lang' => 'lang',
45 27         129 ShortName => 'short',
46             __text => 'full',
47             });
48             }
49              
50             my ($self, $doc) = @_;
51             my $node = $doc->create($self->{_nodeName}, $self->{full}, 'xml:lang' => $self->lang);
52             $node->add('ShortName', $self->{short}) if defined $self->{short};
53 30     30 1 1705 return $node;
54 30         198 }
55 30 100       1026  
56 30         425 =item C<B<lang>>
57              
58             Mandatory, language used, default C<en-US>
59              
60             =item C<B<short>>
61              
62             Optional, shorter version of the full description
63              
64             =item C<B<full>>
65              
66             Mandatory, full description text
67              
68             =back
69              
70             =head1 AUTHOR
71              
72             Stéphane Lavergne L<https://github.com/vphantom>
73              
74             =head1 ACKNOWLEDGEMENTS
75              
76             Graph X Design Inc. L<https://www.gxd.ca/> sponsored this project.
77              
78             =head1 COPYRIGHT & LICENSE
79              
80             Copyright (c) 2017-2018 Stéphane Lavergne L<https://github.com/vphantom>
81              
82             Permission is hereby granted, free of charge, to any person obtaining a copy
83             of this software and associated documentation files (the "Software"), to deal
84             in the Software without restriction, including without limitation the rights
85             to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
86             copies of the Software, and to permit persons to whom the Software is
87             furnished to do so, subject to the following conditions:
88              
89             The above copyright notice and this permission notice shall be included in all
90             copies or substantial portions of the Software.
91              
92             THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
93             IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
94             FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
95             AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
96             LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
97             OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
98             SOFTWARE.
99              
100             =cut
101              
102             1;