File Coverage

blib/lib/Business/Edifact/Message/LineItem.pm
Criterion Covered Total %
statement 28 96 29.1
branch 4 26 15.3
condition n/a
subroutine 7 23 30.4
pod 19 19 100.0
total 58 164 35.3


line stmt bran cond sub pod time code
1             package Business::Edifact::Message::LineItem;
2              
3 6     6   150 use warnings;
  6         11  
  6         189  
4 6     6   33 use strict;
  6         10  
  6         159  
5 6     6   180 use 5.010;
  6         21  
  6         226  
6 6     6   34 use Carp;
  6         22  
  6         13818  
7              
8             =head1 NAME
9              
10             Business::Edifact::Message::LineItem - Model an individual Item Line in a message
11              
12             =head1 VERSION
13              
14             Version 0.07
15              
16             =cut
17              
18             our $VERSION = '0.07';
19              
20             =head1 SYNOPSIS
21              
22             An edifact Message can caontain a number of line items
23             This is an instance of one
24              
25             =head1 SUBROUTINES/METHODS
26              
27             =head2 new
28              
29             Called by Business::Edifact::Message to instantiate a new LineItem
30             object. The caller passes the lineitem fields to
31             the constructor
32              
33             =cut
34              
35             sub new {
36 91     91 1 235 my $class = shift;
37 91         96 my $self = shift;
38              
39 91         253 bless $self, $class;
40 91         211 return $self;
41             }
42              
43             =head2 addsegment
44              
45             adds a segment arrayref
46              
47             =cut
48              
49             sub addsegment {
50 719     719 1 856 my $self = shift;
51 719         974 my $datalabel = shift;
52 719         738 my $data_arrref = shift;
53              
54 719 100       5088 if ( !exists $self->{$datalabel} ) {
55 84         200 $self->{$datalabel} = $data_arrref;
56             }
57             else {
58 635 50       1579 if ( ref $self->{$datalabel} eq 'ARRAY' ) {
59 635         594 push @{ $self->{$datalabel} }, $data_arrref;
  635         1336  
60             }
61             }
62 719         1671 return $self;
63             }
64              
65             =head2 order_reference_number
66              
67             =cut
68              
69             sub order_reference_number {
70 0     0 1 0 my $self = shift;
71              
72             }
73              
74             =head2 line_sequence_number
75              
76             =cut
77              
78             sub line_sequence_number {
79 0     0 1 0 my $self = shift;
80 0         0 return $self->{line_number};
81             }
82              
83             =head2 ean
84              
85             Return the lineitem's ean (a 13 digit ISBN)
86              
87             =cut
88              
89             sub ean { #LIN
90 0     0 1 0 my $self = shift;
91             }
92              
93             =head2 author_surname
94              
95             =cut
96              
97             sub author_surname { #010
98 0     0 1 0 my $self = shift;
99 0         0 for my $d ( @{ $self->{item_description} } ) {
  0         0  
100 0 0       0 if ( $d->{code} eq '010' ) {
101 0         0 return $d->{text};
102             }
103             }
104 0         0 return q{};
105             }
106              
107             =head2 author_firstname
108              
109             =cut
110              
111             sub author_firstname { # 011
112 0     0 1 0 my $self = shift;
113 0         0 for my $d ( @{ $self->{item_description} } ) {
  0         0  
114 0 0       0 if ( $d->{code} eq '011' ) {
115 0         0 return $d->{text};
116             }
117             }
118 0         0 return q{};
119             }
120              
121             =head2 author
122              
123             =cut
124              
125             sub author {
126 0     0 1 0 my $self = shift;
127             }
128              
129             =head2 title
130              
131             =cut
132              
133             sub title { #050
134 0     0 1 0 my $self = shift;
135 0         0 for my $d ( @{ $self->{item_description} } ) {
  0         0  
136 0 0       0 if ( $d->{code} eq '050' ) {
137 0         0 return $d->{text};
138             }
139             }
140 0         0 return q{};
141             }
142              
143             =head2 subtitle
144              
145             =cut
146              
147             sub subtitle { #060
148 0     0 1 0 my $self = shift;
149 0         0 for my $d ( @{ $self->{item_description} } ) {
  0         0  
150 0 0       0 if ( $d->{code} eq '060' ) {
151 0         0 return $d->{text};
152             }
153             }
154 0         0 return q{};
155             }
156              
157             =head2 edition
158              
159             =cut
160              
161             sub edition { # IMD 100
162 0     0 1 0 my $self = shift;
163 0         0 for my $d ( @{ $self->{item_description} } ) {
  0         0  
164 0 0       0 if ( $d->{code} eq '100' ) {
165 0         0 return $d->{text};
166             }
167             }
168 0         0 return q{};
169             }
170              
171             =head2 place_of_publication
172              
173             =cut
174              
175             sub place_of_publication { # IMD 110
176 0     0 1 0 my $self = shift;
177 0         0 for my $d ( @{ $self->{item_description} } ) {
  0         0  
178 0 0       0 if ( $d->{code} eq '110' ) {
179 0         0 return $d->{text};
180             }
181             }
182 0         0 return q{};
183             }
184              
185             =head2 publisher
186              
187             =cut
188              
189             sub publisher { # IMD 120
190 0     0 1 0 my $self = shift;
191 0         0 for my $d ( @{ $self->{item_description} } ) {
  0         0  
192 0 0       0 if ( $d->{code} eq '120' ) {
193 0         0 return $d->{text};
194             }
195             }
196 0         0 return q{};
197             }
198              
199             =head2 date_of_publication
200              
201             =cut
202              
203             sub date_of_publication { # IMD 170
204 0     0 1 0 my $self = shift;
205 0         0 for my $d ( @{ $self->{item_description} } ) {
  0         0  
206 0 0       0 if ( $d->{code} eq '170' ) {
207 0         0 return $d->{text};
208             }
209             }
210 0         0 return q{};
211             }
212              
213             =head2 item_format
214              
215             =cut
216              
217             sub item_format { #IMD 220
218 0     0 1 0 my $self = shift;
219 0         0 for my $d ( @{ $self->{item_description} } ) {
  0         0  
220 0 0       0 if ( $d->{code} eq '220' ) {
221 0         0 return $d->{text};
222             }
223             }
224 0         0 return q{};
225             }
226              
227             =head2 shelfmark
228              
229             =cut
230              
231             sub shelfmark { #IMD 230
232 0     0 1 0 my $self = shift;
233 0         0 for my $d ( @{ $self->{item_description} } ) {
  0         0  
234 0 0       0 if ( $d->{code} eq '230' ) {
235 0         0 return $d->{text};
236             }
237             }
238 0         0 return q{};
239             }
240              
241             =head2 quantity
242              
243             =cut
244              
245             sub quantity {
246 0     0 1 0 my $self = shift;
247             }
248              
249             =head2 price
250              
251             =cut
252              
253             sub price {
254 0     0 1 0 my $self = shift;
255             }
256              
257             =head2 related_numbers
258              
259             =cut
260              
261             sub related_numbers {
262 1     1 1 306 my $self = shift;
263 1 50       5 if ( $self->{related_numbers} ) {
264 1         3 return $self->{related_numbers};
265             }
266             else {
267 0           return;
268             }
269             }
270              
271             =head1 AUTHOR
272              
273             Colin Campbell, C<< >>
274              
275             =head1 BUGS
276              
277             Please report any bugs or feature requests to C, or through
278             the web interface at L. I will be notified, and then you'll
279             automatically be notified of progress on your bug as I make changes.
280              
281              
282              
283              
284             =head1 SUPPORT
285              
286             You can find documentation for this module with the perldoc command.
287              
288             perldoc Business::Edifact::Message
289              
290              
291              
292             =head1 ACKNOWLEDGEMENTS
293              
294              
295             =head1 LICENSE AND COPYRIGHT
296              
297             Copyright 2011-2014 Colin Campbell.
298              
299             This program is free software; you can redistribute it and/or modify it
300             under the terms of either: the GNU General Public License as published
301             by the Free Software Foundation; or the Artistic License.
302              
303             See http://dev.perl.org/licenses/ for more information.
304              
305              
306             =cut
307              
308             1; # End of Business::Edifact::Message::LineItem