File Coverage

lib/Spreadsheet/Reader/ExcelXML/Cell.pm
Criterion Covered Total %
statement 45 45 100.0
branch 10 14 71.4
condition n/a
subroutine 13 13 100.0
pod 1 2 50.0
total 69 74 93.2


line stmt bran cond sub pod time code
1             package Spreadsheet::Reader::ExcelXML::Cell;
2             our $AUTHORITY = 'cpan:JANDREW';
3 19     19   794332 use version; our $VERSION = version->declare('v0.16.8');
  19         30  
  19         103  
4             ###LogSD warn "You uncovered internal logging statements for Spreadsheet::Reader::ExcelXML::Cell-$VERSION";
5              
6             $| = 1;
7 19     19   1775 use 5.010;
  19         88  
8 19     19   69 use Moose;
  19         34  
  19         125  
9 19     19   83267 use MooseX::StrictConstructor;
  19         10570  
  19         144  
10 19     19   44138 use MooseX::HasDefaults::RO;
  19         4717  
  19         141  
11 19         145 use Types::Standard qw(
12             Str InstanceOf HashRef
13             Enum HasMethods ArrayRef
14             Int Maybe CodeRef
15             is_Object
16 19     19   66066 );
  19         47384  
17 19     19   20666 use lib '../../../../lib';
  19         34  
  19         428  
18             ###LogSD use Log::Shiras::Telephone;
19 19     19   2671 use Spreadsheet::Reader::ExcelXML::Types qw( CellID );
  19         32  
  19         145  
20             ###LogSD with 'Log::Shiras::LogSpace';
21              
22             #########1 Public Attributes 3#########4#########5#########6#########7#########8#########9
23              
24             has error_inst =>(
25             isa => InstanceOf[ 'Spreadsheet::Reader::ExcelXML::Error' ],
26             clearer => '_clear_error_inst',
27             reader => '_get_error_inst',
28             required => 1,
29             handles =>[ qw(
30             error set_error clear_error set_warnings if_warn
31             ) ],
32             );
33              
34             has cell_xml_value =>(
35             isa => Maybe[Str],
36             reader => 'xml_value',
37             predicate => 'has_xml_value',
38             );
39              
40             has cell_unformatted =>(
41             isa => Maybe[Str],
42             reader => 'unformatted',
43             predicate => 'has_unformatted',
44             );
45              
46             has rich_text =>(
47             isa => ArrayRef,
48             reader => 'get_rich_text',
49             predicate => 'has_rich_text',
50             );
51              
52             has cell_font =>(
53             isa => HashRef,
54             reader => 'get_font',
55             predicate => 'has_font',
56             );
57              
58             has cell_border =>(
59             isa => HashRef,
60             reader => 'get_border',
61             predicate => 'has_border',
62             );
63              
64             has cell_style =>(
65             isa => Str,
66             reader => 'get_style',
67             predicate => 'has_style',
68             );
69              
70             has cell_fill =>(
71             isa => HashRef,
72             reader => 'get_fill',
73             predicate => 'has_fill',
74             );
75              
76             has cell_alignment =>(
77             isa => HashRef,
78             reader => 'get_alignment',
79             predicate => 'has_alignment',
80             );
81              
82             has cell_type =>(
83             isa => Enum[qw( Text Numeric Date Custom )],
84             reader => 'type',
85             writer => '_set_cell_type',
86             predicate => 'has_type',
87             );
88              
89             has cell_encoding =>(
90             isa => Str,
91             reader => 'encoding',
92             predicate => 'has_encoding',
93             );
94              
95             has cell_merge =>(
96             isa => Str,
97             reader => 'merge_range',
98             predicate => 'is_merged',
99             );
100              
101             has cell_formula =>(
102             isa => Str,
103             reader => 'formula',
104             predicate => 'has_formula',
105             );
106              
107             has cell_row =>(
108             isa => Int,
109             reader => 'row',
110             predicate => 'has_row',
111             );
112              
113             has cell_col =>(
114             isa => Int,
115             reader => 'col',
116             predicate => 'has_col',
117             );
118              
119             has r =>(
120             isa => CellID,
121             reader => 'cell_id',
122             predicate => 'has_cell_id',
123             );
124              
125             has cell_hyperlink =>(
126             isa => ArrayRef,
127             reader => 'get_hyperlink',
128             predicate => 'has_hyperlink',
129             );
130              
131             has cell_hidden =>(
132             isa => Enum[qw( sheet column row 0 )],
133             reader => 'is_hidden',
134             default => 0,
135             );
136              
137             has cell_coercion =>(
138             isa => HasMethods[ 'assert_coerce', 'display_name' ],
139             reader => 'get_coercion',
140             writer => 'set_coercion',
141             predicate => 'has_coercion',
142             clearer => 'clear_coercion',
143             handles =>{
144             coercion_name => 'display_name',#
145             },
146             );
147              
148             #########1 Public Methods 3#########4#########5#########6#########7#########8#########9
149              
150             ###LogSD sub get_class_space{ 'Cell' }
151              
152             sub value{
153 210     210 1 51718 my( $self, ) = @_;
154             ###LogSD my $phone = Log::Shiras::Telephone->new( name_space =>
155             ###LogSD $self->get_all_space . '::value', );
156             ###LogSD $phone->talk( level => 'debug', message => [
157             ###LogSD 'Reached the -value- function' ] );
158             ###LogSD $phone->talk( level => 'trace', message => [ "Cell:", $self ] );
159 210 0       6699 my $unformatted =
    50          
160             defined $self->has_xml_value ? $self->xml_value :
161             defined $self->has_unformatted ? $self->_unformatted : undef;
162 210         4907 return $self->_return_value_only(
163             $unformatted,
164             $self->get_coercion,
165             $self->_get_error_inst,
166             );
167             }
168              
169             #########1 Private Attributes 3#########4#########5#########6#########7#########8#########9
170              
171              
172              
173             #########1 Private Methods 3#########4#########5#########6#########7#########8#########9
174              
175             after 'set_coercion' => sub{
176             my ( $self, ) = @_;
177             ###LogSD my $phone = Log::Shiras::Telephone->new( name_space =>
178             ###LogSD $self->get_all_space . '::set_coercion', );
179             ###LogSD $phone->talk( level => 'debug', message =>[
180             ###LogSD "Setting 'cell_type' to custom since the coercion has been set" ] );
181             $self->_set_cell_type( 'Custom' );
182             };
183              
184             sub _return_value_only{
185 526     526   1495 my ( $self, $unformatted, $coercion, $error_inst
186             ###LogSD , $alt_log_space
187             ) = @_;# To be used by GetCell too
188             ###LogSD $alt_log_space //= $self->get_all_space;
189             ###LogSD my $phone = Log::Shiras::Telephone->new( name_space =>
190             ###LogSD $alt_log_space . '::_hidden::_return_value_only', );
191             ###LogSD $phone->talk( level => 'debug', message =>[
192             ###LogSD "Returning the coerced value of -" . ( defined $unformatted ? $unformatted : '') . '-', ] );
193             ###LogSD $phone->talk( level => 'trace', message =>[
194             ###LogSD '..using coercion:' , $coercion ] ) if $coercion;
195 526         527 my $formatted = $unformatted;
196 526 100       1220 if( !$coercion ){
    100          
    100          
197             ###LogSD $phone->talk( level => 'debug', message => [
198             ###LogSD "No coercion passed" ] );
199 236         1463 return $unformatted;
200             }elsif( !defined $unformatted ){
201 21         589 $error_inst->set_error( "The cell does not have a value" );
202             }elsif( $unformatted eq '' ){
203 6         171 $error_inst->set_error( "The cell has the empty string for a value" );
204             }else{
205             ###LogSD $phone->talk( level => 'debug', message => [
206             ###LogSD "Attempting to return the value of the cell formatted to " .
207             ###LogSD (($coercion) ? $coercion->display_name : 'No conversion available' ) ] );
208 263         1602 my $sig_warn = $SIG{__WARN__};
209 263     24   1191 $SIG{__WARN__} = sub{};
210 263         14497 eval '$formatted = $coercion->assert_coerce( $unformatted )';
211 263 50       227739 $error_inst->set_error( $@ ) if( $@ );
212 263         721 $SIG{__WARN__} = $sig_warn;
213             }
214 290 100       1093 $formatted =~ s/\\//g if $formatted;
215             ###LogSD $phone->talk( level => 'debug', message => [
216             ###LogSD "Format is:", $coercion->display_name,
217             ###LogSD "Returning the formated value: " .
218             ###LogSD ( $formatted ? $formatted : '' ), ] );
219 290         1718 return $formatted;
220             }
221              
222             #########1 Private Methods 3#########4#########5#########6#########7#########8#########9
223              
224             sub DEMOLISH{
225 249     249 0 303 my ( $self ) = @_;
226             ###LogSD my $phone = Log::Shiras::Telephone->new( name_space =>
227             ###LogSD $self->get_all_space . '::hidden::DEMOLISH', );
228             ###LogSD $phone->talk( level => 'debug', message => [
229             ###LogSD "clearing the cell for cell-ID:" . $self->cell_id, ] );
230             #~ print "Clearing coercion\n";
231 249         5973 $self->clear_coercion;
232             #~ print "Clearing error instance\n";
233 249         25680 $self->_clear_error_inst;
234             #~ print "Cell closed\n";
235             }
236              
237             #########1 Phinish 3#########4#########5#########6#########7#########8#########9
238              
239 19     19   22126 no Moose;
  19         30  
  19         105  
240             __PACKAGE__->meta->make_immutable;
241              
242             1;
243              
244             #########1 Documentation 3#########4#########5#########6#########7#########8#########9
245             __END__
246              
247             =head1 NAME
248              
249             Spreadsheet::Reader::ExcelXML::Cell - ExcelXML Cell data class
250              
251             =head1 SYNOPSIS
252              
253             #!/usr/bin/env perl
254             use Spreadsheet::Reader::ExcelXML::Cell;
255             use Spreadsheet::Reader::ExcelXML::Error;
256              
257             my $cell_inputs = {
258             'cell_hidden' => 0,
259             'r' => 'A2',
260             'cell_row' => 1,
261             'cell_unformatted' => 'Hello',
262             'cell_col' => 0,
263             'cell_xml_value' => 'Hello',
264             'cell_type' => 'Text',
265             'error_inst' => Spreadsheet::Reader::ExcelXML::Error->new,
266             };
267             my $cell_instance = Spreadsheet::Reader::ExcelXML::Cell->new( $cell_inputs );
268             print "Cell value is: " . $cell_instance->value . "\n";
269              
270             ###########################
271             # SYNOPSIS Output
272             # Cell value is: Hello
273             ###########################
274              
275             =head1 DESCRIPTION
276              
277             This is the class that contains cell data. There are no XML parsing actions taken in the
278             background of this class. All data has been pre-coalated/built from the L<Worksheet
279             |Spreadsheet::Reader::ExcelXML::Worksheet> class. In general the Worksheet class
280             will populate the attributes of this class when it is generated. If you want to use it
281             as a standalone class just fill in the L<Attributes|/Attributes> below. It should be
282             noted that the Formatter class also L<pre-converts
283             |Spreadsheet::Reader::Format/change_output_encoding( $string )> the
284             unformatted value. Not much goes on here but access or excesize of code provided from
285             other places.
286              
287             =head2 Primary Methods
288              
289             This is the method used to transform data stored in the L<Attributes|/Attributes>
290             (not just return it directly). The method is an object method and should be implemented
291             on the instance.
292              
293             B<Example:>
294              
295             my $value = $cell_intance->value;
296              
297             =head3 value
298              
299             =over
300              
301             B<Definition:> Returns the formatted value of the cell transformed from the
302             L<base xml|/cell_xml_value> string if it is available. In the weird case where the
303             cell_xml_value is not available but the L<unformatted|/cell_unformatted> value is
304             then this method will use the unformatted value. This method then applies any
305             conversion stored in the L<cell_coercion|/cell_coercion> attribute. If there is
306             no format/conversion set then this will return the selected value. Any failures
307             to process this value can be retrieved with L<$self-E<gt>error|/error>.
308              
309             B<Accepts:>Nothing
310              
311             B<Returns:> the cell 'value' processed by the set conversion
312              
313             =back
314              
315             =head2 Attributes
316              
317             This class is just a storage of coallated information about the requested cell stored
318             in the following attributes. For more information on attributes see
319             L<Moose::Manual::Attributes>. Data about the cell can be retrieved from each
320             attribute using the 'attribute methods'. 'Delegated methods' are methods
321             available at the class or instance level directly delegated from that
322             specific attribute.
323              
324             =head3 error_inst
325              
326             =over
327              
328             B<Definition:> This attribute holds an 'error' object instance. In general
329             the package will share a reference for this instance accross the workbook with all
330             worksheets and all cells so any 'set' or 'get' action should be available at all
331             touch points for this error object. If you wish to have a unique error instance
332             you can set it here.
333              
334             B<Default:> a L<Spreadsheet::Reader::ExcelXML::Error> instance with the
335             attributes set as;
336              
337             ( should_warn => 0 )
338              
339             B<Range:> a 'Spreadsheet::Reader::ExcelXML::Error' instance. To roll this on your
340             own, the minimum list of methods to implement for your own instance is;
341              
342             error set_error clear_error set_warnings if_warn
343              
344             B<Delegated methods> Links to default implementation and method name conversions
345             (if any) delegated from this attribute to the package.
346              
347             =over
348              
349             L<Spreadsheet::Reader::ExcelXML::Error/error>
350              
351             L<Spreadsheet::Reader::ExcelXML::Error/set_error>
352              
353             L<Spreadsheet::Reader::ExcelXML::Error/clear_error>
354              
355             L<Spreadsheet::Reader::ExcelXML::Error/set_warnings>
356              
357             L<Spreadsheet::Reader::ExcelXML::Error/if_warn>
358              
359             =back
360              
361             =back
362              
363             =head3 cell_xml_value
364              
365             =over
366              
367             B<Definition:> This contains the raw value stored in xml for this cell. This
368             can be different than the 'cell_unformatted' value based on archane rules set
369             by Microsoft.
370              
371             B<Range:>Any string or nothing
372              
373             B<attribute methods> Methods provided to adjust this attribute
374              
375             =over
376              
377             B<xml_value>
378              
379             =over
380              
381             B<Definition:> returns the attribute value
382              
383             =back
384              
385             B<has_xml_value>
386              
387             =over
388              
389             B<Definition:> predicate for this attribute
390              
391             =back
392              
393             =back
394              
395             =back
396              
397             =head3 cell_unformatted
398              
399             =over
400              
401             B<Definition:> This holds the unformatted value of the cell. The unformatted
402             value of the cell as defined by this package is the value displayed in the
403             formula bar when selecting the cell. This can be a bit squidgy where the cell
404             is actually populated with a formula. In that case this should contain the
405             implied value based on my (or your) visibility to the excel value that would
406             normally be there.
407              
408             B<Range:> a string
409              
410             B<attribute methods> Methods provided to adjust this attribute
411              
412             =over
413              
414             B<unformatted>
415              
416             =over
417              
418             B<Definition:> returns the attribute value
419              
420             =back
421              
422             B<has_unformatted>
423              
424             =over
425              
426             B<Definition:> a predicate method for the attribute
427              
428             =back
429              
430             =back
431              
432             =back
433              
434             =head3 rich_text
435              
436             =over
437              
438             B<Definition:> This attribute holds a rich text data structure like
439             L<Spreadsheet::ParseExcel::Cell/get_rich_text()> with the exception that it
440             doesn't bless each hashref into an object. The hashref's are also organized
441             per the Excel xlsx information in the the sharedStrings.xml file. In general
442             this is an arrayref of arrayrefs where the second level contains two positions.
443             The first position is the place (from zero) where the formatting is implemented.
444             The second position is a hashref of the formatting values. The format is in
445             force until the next start place is identified.
446              
447             =over
448              
449             B<note:> It is important to understand that Excel can store two formats for the
450             same cell and often they don't agree. For example using the attribute L<cell_font
451             |/cell_font> will not always contain the same value as specific fonts (or any font)
452             listed in the rich text array.
453              
454             =back
455              
456             B<Default:> undef = no rich text defined for this cell
457              
458             B<Range:> an array ref of rich_text positions and definitions
459              
460             B<attribute methods> Methods provided to adjust this attribute
461              
462             =over
463              
464             B<get_rich_text>
465              
466             =over
467              
468             B<Definition:> returns the attribute value
469              
470             =back
471              
472             B<has_rich_text>
473              
474             =over
475              
476             B<Definition:> Indicates if the attribute has anything stored
477              
478             =back
479              
480             =back
481              
482             =back
483              
484             =head3 cell_font
485              
486             =over
487              
488             B<Definition:> This holds the font assigned to the cell
489              
490             B<Range:> a hashref of definitions for the font
491              
492             B<attribute methods> Methods provided to adjust this attribute
493              
494             =over
495              
496             B<get_font>
497              
498             =over
499              
500             B<Definition:> returns the attribute contents
501              
502             =back
503              
504             B<has_font>
505              
506             =over
507              
508             B<Definition:> Predicate for the attribute contentss
509              
510             =back
511              
512             =back
513              
514             =back
515              
516             =head3 cell_border
517              
518             =over
519              
520             B<Definition:> This holds the border settings assigned to the cell
521              
522             B<Range:> a hashref of border definitions
523              
524             B<attribute methods> Methods provided to adjust this attribute
525              
526             =over
527              
528             B<get_border>
529              
530             =over
531              
532             B<Definition:> returns the attribute contents
533              
534             =back
535              
536             B<has_border>
537              
538             =over
539              
540             B<Definition:> Indicates if the attribute has any contents
541              
542             =back
543              
544             =back
545              
546             =back
547              
548             =head3 cell_style
549              
550             =over
551              
552             B<Definition:> This holds the style settings assigned to the cell
553              
554             B<Range:> a hashref of style definitions
555              
556             B<attribute methods> Methods provided to adjust this attribute
557              
558             =over
559              
560             B<get_style>
561              
562             =over
563              
564             B<Definition:> returns the attribute contents
565              
566             =back
567              
568             B<has_style>
569              
570             =over
571              
572             B<Definition:> Indicates if the attribute has anything stored
573              
574             =back
575              
576             =back
577              
578             =back
579              
580             =head3 cell_fill
581              
582             =over
583              
584             B<Definition:> This holds the fill settings assigned to the cell
585              
586             B<Range:> a hashref of style definitions
587              
588             B<attribute methods> Methods provided to adjust this attribute
589              
590             =over
591              
592             B<get_fill>
593              
594             =over
595              
596             B<Definition:> returns the attribute value
597              
598             =back
599              
600             B<has_fill>
601              
602             =over
603              
604             B<Definition:> Indicates if the attribute has anything stored
605              
606             =back
607              
608             =back
609              
610             =back
611              
612             =head3 cell_alignment
613              
614             =over
615              
616             B<Definition:> This holds the alignment settings assigned to the cell
617              
618             B<Range:> The alignment definition
619              
620             B<attribute methods> Methods provided to adjust this attribute
621              
622             =over
623              
624             B<get_alignment>
625              
626             =over
627              
628             B<Definition:> returns the attribute value
629              
630             =back
631              
632             B<has_alignment>
633              
634             =over
635              
636             B<Definition:> Indicates if the attribute has anything stored
637              
638             =back
639              
640             =back
641              
642             =back
643              
644             =head3 cell_type
645              
646             =over
647              
648             B<Definition:> This holds the type of data stored in the cell. In general it
649             follows the convention of L<ParseExcel
650             |Spreadsheet::ParseExcel/ChkType($self, $is_numeric, $format_index)> (Date, Numeric,
651             or Text) however, since custom coercions will change data to some possible non excel
652             standard state this also allows a 'Custom' type representing any cell with a custom
653             conversion assigned to it (by you either at the worksheet level or here).
654              
655             B<Range:> Text = Strings, Numeric = Real Numbers, Date = Real Numbers with an
656             assigned Date conversion or ISO dates, Custom = any stored value with a custom
657             conversion
658              
659             B<attribute methods> Methods provided to adjust this attribute
660              
661             =over
662              
663             B<type>
664              
665             =over
666              
667             B<Definition:> returns the attribute value
668              
669             =back
670              
671             B<has_type>
672              
673             =over
674              
675             B<Definition:> Indicates if the attribute has anything stored
676              
677             =back
678              
679             =back
680              
681             =back
682              
683             =head3 cell_encoding
684              
685             =over
686              
687             B<Definition:> This holds the byte encodeing of the data stored in the cell
688              
689             B<Default:> Unicode
690              
691             B<Range:> Traditional encoding options
692              
693             B<attribute methods> Methods provided to adjust this attribute
694              
695             =over
696              
697             B<encoding>
698              
699             =over
700              
701             B<Definition:> returns the attribute value
702              
703             =back
704              
705             B<has_encoding>
706              
707             =over
708              
709             B<Definition:> Indicates if the attribute has anything stored
710              
711             =back
712              
713             =back
714              
715             =back
716              
717             =head3 cell_merge
718              
719             =over
720              
721             B<Definition:> if the cell is part of a group of merged cells this will
722             store the upper left and lower right cell ID's in a string concatenated
723             with a ':'
724              
725             B<Default:> undef
726              
727             B<Range:> two cell ID's
728              
729             B<attribute methods> Methods provided to adjust this attribute
730              
731             =over
732              
733             B<merge_range>
734              
735             =over
736              
737             B<Definition:> returns the attribute value
738              
739             =back
740              
741             B<is_merged>
742              
743             =over
744              
745             B<Definition:> Indicates if the attribute has anything stored
746              
747             =back
748              
749             =back
750              
751             =back
752              
753             =head3 cell_formula
754              
755             =over
756              
757             B<Definition:> if the cell value (raw xml) is calculated based on a
758             formula the Excel formula string is stored in this attribute.
759              
760             B<Default:> undef
761              
762             B<Range:> Excel formula string
763              
764             B<attribute methods> Methods provided to adjust this attribute
765              
766             =over
767              
768             B<formula>
769              
770             =over
771              
772             B<Definition:> returns the attribute value
773              
774             =back
775              
776             B<has_formula>
777              
778             =over
779              
780             B<Definition:> Indicates if the attribute has anything stored
781              
782             =back
783              
784             =back
785              
786             =back
787              
788             =head3 cell_row
789              
790             =over
791              
792             B<Definition:> This is the sheet row that the cell was read from.
793             The value is stored in the user context ( either count from zero
794             or count from one).
795              
796             B<Range:> the minimum row to the maximum row
797              
798             B<attribute methods> Methods provided to adjust this attribute
799              
800             =over
801              
802             B<row>
803              
804             =over
805              
806             B<Definition:> returns the attribute value
807              
808             =back
809              
810             B<has_row>
811              
812             =over
813              
814             B<Definition:> Indicates if the attribute has anything stored
815              
816             =back
817              
818             =back
819              
820             =back
821              
822             =head3 cell_col
823              
824             =over
825              
826             B<Definition:> This is the sheet column that the cell was read from.
827             The value is stored in the user context ( either count from zero
828             or count from one).
829              
830             B<Range:> the minimum column to the maximum column
831              
832             B<attribute methods> Methods provided to adjust this attribute
833              
834             =over
835              
836             B<col>
837              
838             =over
839              
840             B<Definition:> returns the attribute value
841              
842             =back
843              
844             B<has_col>
845              
846             =over
847              
848             B<Definition:> Indicates if the attribute has anything stored
849              
850             =back
851              
852             =back
853              
854             =back
855              
856             =head3 r
857              
858             =over
859              
860             B<Definition:> This is the cell ID of the cell
861              
862             B<attribute methods> Methods provided to adjust this attribute
863              
864             =over
865              
866             B<cell_id>
867              
868             =over
869              
870             B<Definition:> returns the attribute value
871              
872             =back
873              
874             B<has_cell_id>
875              
876             =over
877              
878             B<Definition:> Indicates if the attribute has anything stored
879              
880             =back
881              
882             =back
883              
884             =back
885              
886             =head3 cell_hyperlink
887              
888             =over
889              
890             B<Definition:> This stores an arraryref of hyperlinks from the cell
891              
892             B<attribute methods> Methods provided to adjust this attribute
893              
894             =over
895              
896             B<get_hyperlink>
897              
898             =over
899              
900             B<Definition:> returns the attribute value
901              
902             =back
903              
904             B<has_hyperlink>
905              
906             =over
907              
908             B<Definition:> Indicates if the attribute has anything stored
909              
910             =back
911              
912             =back
913              
914             =back
915              
916             =head3 cell_hidden
917              
918             =over
919              
920             B<Definition:> This stores the hidden state of the cell. The stored
921             value indicates which entity is controlling hiddeness.
922              
923             B<Range:> (sheet|column|row|0)
924              
925             B<attribute methods> Methods provided to adjust this attribute
926              
927             =over
928              
929             B<is_hidden>
930              
931             =over
932              
933             B<Definition:> returns the attribute value
934              
935             =back
936              
937             =back
938              
939             =back
940              
941             has cell_coercion =>(
942             isa => HasMethods[ 'assert_coerce', 'display_name' ],
943             reader => 'get_coercion',
944             writer => 'set_coercion',
945             predicate => 'has_coercion',
946             clearer => 'clear_coercion',
947             handles =>{
948             coercion_name => 'display_name',#
949             },
950             );
951              
952             =head3 cell_coercion
953              
954             =over
955              
956             B<Definition:> This attribute holds the tranformation code to turn an
957             unformatted value into a formatted value.
958              
959             B<Default:> a L<Type::Tiny> instance with sub types set to assign different
960             inbound data types to different coercions for the target outcome of formatted
961             data.
962              
963             B<Range:> If you wish to set this with your own code it must have two
964             methods. First, 'assert_coerce' which will be applied when transforming
965             the unformatted value. Second, 'display_name' which will be used to self
966             identify. For an example of how to build a custom format see
967             L<Spreadsheet::Reader::ExcelXML::Worksheet/custom_formats>.
968              
969             B<attribute methods> Methods provided to adjust this attribute
970              
971             =over
972              
973             B<get_coercion>
974              
975             =over
976              
977             B<Definition:> returns the contents of the attribute
978              
979             =back
980              
981             B<clear_coercion>
982              
983             =over
984              
985             B<Definition:> used to clear this attribute
986              
987             =back
988              
989             B<set_coercion>
990              
991             =over
992              
993             B<Definition:> used to set a new coercion instance. Implementation
994             of this method will also switch the cell type to 'Custom'.
995              
996             =back
997              
998             B<has_coercion>
999              
1000             =over
1001              
1002             B<Definition:> Indicate if any coecion code is applied
1003              
1004             =back
1005              
1006             B<Delegated method:> Methods delegated from the instance for conversion
1007             type checking. The name delegated to is listed next to a link for the
1008             default method delegated from.
1009              
1010             =over
1011              
1012             B<coercion_name> => L<Type::Tiny/display_name>
1013              
1014             =back
1015              
1016             =back
1017              
1018             =back
1019              
1020             =head1 SUPPORT
1021              
1022             =over
1023              
1024             L<github Spreadsheet::Reader::ExcelXML/issues
1025             |https://github.com/jandrew/p5-spreadsheet-reader-excelxml/issues>
1026              
1027             =back
1028              
1029             =head1 TODO
1030              
1031             =over
1032              
1033             B<1.> Return the merge range in array and hash formats
1034              
1035             B<2.> Add calc chain values
1036              
1037             =back
1038              
1039             =head1 AUTHOR
1040              
1041             =over
1042              
1043             Jed Lund
1044              
1045             jandrew@cpan.org
1046              
1047             =back
1048              
1049             =head1 COPYRIGHT
1050              
1051             This program is free software; you can redistribute
1052             it and/or modify it under the same terms as Perl itself.
1053              
1054             The full text of the license can be found in the
1055             LICENSE file included with this module.
1056              
1057             This software is copyrighted (c) 2016 by Jed
1058              
1059             =head1 DEPENDENCIES
1060              
1061             =over
1062              
1063             L<Spreadsheet::Reader::ExcelXML> - the package
1064              
1065             =back
1066              
1067             =head1 SEE ALSO
1068              
1069             =over
1070              
1071             L<Spreadsheet::Read> - generic Spreadsheet reader
1072              
1073             L<Spreadsheet::ParseExcel> - Excel binary version 2003 and earlier (.xls files)
1074              
1075             L<Spreadsheet::XLSX> - Excel version 2007 and later
1076              
1077             L<Spreadsheet::ParseXLSX> - Excel version 2007 and later
1078              
1079             L<Log::Shiras|https://github.com/jandrew/Log-Shiras>
1080              
1081             =over
1082              
1083             All lines in this package that use Log::Shiras are commented out
1084              
1085             =back
1086              
1087             =back
1088              
1089             =cut
1090              
1091             #########1#########2 main pod documentation end 5#########6#########7#########8#########9