« lib/Spreadsheet/Reader/ExcelXML/XMLReader.pm
↑ Summary
lib/Spreadsheet/Reader/ExcelXML/Workbook.pm »
| 1 | package Spreadsheet::Reader::ExcelXML::CellToColumnRow; | ||||||||||||||||||||||||||||||||||||
| 2 | 21 | our $AUTHORITY = 'cpan:JANDREW'; | |||||||||||||||||||||||||||||||||||
| 3 | 21 | ▶ | use version; our $VERSION = version->declare('v0.16.8'); | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 4 | ###LogSD warn "You uncovered internal logging statements for Spreadsheet::Reader::ExcelXML::CellToColumnRow-$VERSION"; | ||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||
| 6 | 21 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 7 | 21 | requires | |||||||||||||||||||||||||||||||||||
| 8 | 'set_error', 'counting_from_zero', | ||||||||||||||||||||||||||||||||||||
| 9 | ###LogSD 'get_all_space' | ||||||||||||||||||||||||||||||||||||
| 10 | ; | ||||||||||||||||||||||||||||||||||||
| 11 | 21 | ▶ | use Types::Standard qw( Bool ); | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 12 | ###LogSD use Log::Shiras::Telephone; | ||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||
| 14 | #########1 Dispatch Tables 3#########4#########5#########6#########7#########8#########9 | ||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||
| 16 | 21 | my $lookup_ref ={ | |||||||||||||||||||||||||||||||||||
| 17 | A => 1, B => 2, C => 3, D => 4, E => 5, F => 6, G => 7, H => 8, I => 9, J => 10, | ||||||||||||||||||||||||||||||||||||
| 18 | K => 11, L => 12, M => 13, N => 14, O => 15, P => 16, Q => 17, R => 18, S => 19, | ||||||||||||||||||||||||||||||||||||
| 19 | T => 20, U => 21, V => 22, W => 23, X => 24, Y => 25, Z => 26, | ||||||||||||||||||||||||||||||||||||
| 20 | }; | ||||||||||||||||||||||||||||||||||||
| 21 | 21 | my $lookup_list =[ qw( A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ) ]; | |||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||
| 23 | #########1 Public Attributes 3#########4#########5#########6#########7#########8#########9 | ||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||
| 27 | #########1 Public Methods 3#########4#########5#########6#########7#########8#########9 | ||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||
| 29 | 42 | ▶ | sub parse_column_row{#? add the manual conversion to used vs excel on the next two | ||||||||||||||||||||||||||||||||||
|
Subroutine
parse_column_row: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 30 | 42 | my ( $self, $cell ) = @_; | |||||||||||||||||||||||||||||||||||
| 31 | ###LogSD my $phone = Log::Shiras::Telephone->new( name_space => | ||||||||||||||||||||||||||||||||||||
| 32 | ###LogSD $self->get_all_space . '::parse_column_row', ); | ||||||||||||||||||||||||||||||||||||
| 33 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 34 | ###LogSD "Parsing file row number and file column number from: $cell" ] ); | ||||||||||||||||||||||||||||||||||||
| 35 | 42 | my ( $column, $row ) = $self->_parse_column_row( $cell ); | |||||||||||||||||||||||||||||||||||
| 36 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 37 | ###LogSD 'File Column: ' . ($column//''), 'File Row: ' . ($row//'') ] ); | ||||||||||||||||||||||||||||||||||||
| 38 | ###LogSD use warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||
| 40 | # Convert to user numbers | ||||||||||||||||||||||||||||||||||||
| 41 | 42 | my $user_row = $self->get_used_position( $row ); | |||||||||||||||||||||||||||||||||||
| 42 | ###LogSD no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||
| 43 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 44 | ###LogSD "Returning -$user_row- for row: $row" ] ); | ||||||||||||||||||||||||||||||||||||
| 45 | 42 | my $user_column = $self->get_used_position( $column ); | |||||||||||||||||||||||||||||||||||
| 46 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 47 | ###LogSD "Returning -$user_column- for column: $column" ] ); | ||||||||||||||||||||||||||||||||||||
| 48 | ###LogSD use warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||
| 49 | 42 | return( $user_column, $user_row ); | |||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||
| 52 | 32 | ▶ | sub build_cell_label{ | ||||||||||||||||||||||||||||||||||
|
Subroutine
build_cell_label: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 53 | 32 | my ( $self, $column, $row ) = @_; | |||||||||||||||||||||||||||||||||||
| 54 | ###LogSD my $phone = Log::Shiras::Telephone->new( name_space => | ||||||||||||||||||||||||||||||||||||
| 55 | ###LogSD ($self->get_log_space . '::build_cell_label' ), ); | ||||||||||||||||||||||||||||||||||||
| 56 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 57 | ###LogSD "Converting file column -$column- and file row -$row- to a cell ID" ] ); | ||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||
| 59 | # Convert to code numbers | ||||||||||||||||||||||||||||||||||||
| 60 | 32 | my $code_row = $self->get_excel_position( $row ); | |||||||||||||||||||||||||||||||||||
| 61 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 62 | ###LogSD "Parsing -$code_row- for row: $row" ] ); | ||||||||||||||||||||||||||||||||||||
| 63 | 32 | my $code_column = $self->get_excel_position( $column ); | |||||||||||||||||||||||||||||||||||
| 64 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 65 | ###LogSD "Parsing -$code_column- for column: $column" ] ); | ||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||
| 67 | 32 | my $cell_label = $self->_build_cell_label( $code_column, $code_row ); | |||||||||||||||||||||||||||||||||||
| 68 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 69 | ###LogSD "Cell label is: $cell_label" ] ); | ||||||||||||||||||||||||||||||||||||
| 70 | 32 | return $cell_label; | |||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||
| 73 | 808 | ▶ | sub get_excel_position{ | ||||||||||||||||||||||||||||||||||
|
Subroutine
get_excel_position: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 74 | 808 | my ( $self, $used_int ) = @_; | |||||||||||||||||||||||||||||||||||
| 75 | 808 | ▶ | return undef if !defined $used_int; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 76 | ###LogSD my $phone = Log::Shiras::Telephone->new( name_space => | ||||||||||||||||||||||||||||||||||||
| 77 | ###LogSD $self->get_all_space . '::get_excel_position', ); | ||||||||||||||||||||||||||||||||||||
| 78 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 79 | ###LogSD "Converting used number -$used_int- to Excel" ] ); | ||||||||||||||||||||||||||||||||||||
| 80 | 808 | my $excel_position = $used_int; | |||||||||||||||||||||||||||||||||||
| 81 | 808 | ▶ | if( $self->counting_from_zero ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 82 | 742 | $excel_position += 1 ; | |||||||||||||||||||||||||||||||||||
| 83 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 84 | ###LogSD "New position is: $excel_position" ] ); | ||||||||||||||||||||||||||||||||||||
| 85 | }else{ | ||||||||||||||||||||||||||||||||||||
| 86 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 87 | ###LogSD "Not counting from zero now" ] ); | ||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||
| 89 | 808 | return $excel_position; | |||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||
| 92 | 1339 | ▶ | sub get_used_position{ | ||||||||||||||||||||||||||||||||||
|
Subroutine
get_used_position: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 93 | 1339 | my ( $self, $excel_int ) = @_; | |||||||||||||||||||||||||||||||||||
| 94 | 1339 | ▶ | return undef if !defined $excel_int; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 95 | ###LogSD my $phone = Log::Shiras::Telephone->new( name_space => | ||||||||||||||||||||||||||||||||||||
| 96 | ###LogSD $self->get_all_space . '::get_used_position', ); | ||||||||||||||||||||||||||||||||||||
| 97 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 98 | ###LogSD "Converting the Excel number -$excel_int- to the used number" ] ); | ||||||||||||||||||||||||||||||||||||
| 99 | 1332 | my $used_position = $excel_int; | |||||||||||||||||||||||||||||||||||
| 100 | 1332 | ▶ | $used_position -= 1 if $self->counting_from_zero; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 101 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 102 | ###LogSD "The used position is: $used_position" ] ); | ||||||||||||||||||||||||||||||||||||
| 103 | 1332 | return $used_position; | |||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||
| 106 | #########1 Private Attributes 3#########4#########5#########6#########7#########8#########9 | ||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||
| 110 | #########1 Private Methods 3#########4#########5#########6#########7#########8#########9 | ||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||
| 112 | 606 | ▶ | sub _parse_column_row{ | ||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_column_row: called CC=12 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||
| 113 | 606 | my ( $self, $cell ) = @_; | |||||||||||||||||||||||||||||||||||
| 114 | 606 | my ( $column, $error_list_ref ); | |||||||||||||||||||||||||||||||||||
| 115 | ###LogSD my $phone = Log::Shiras::Telephone->new( name_space => | ||||||||||||||||||||||||||||||||||||
| 116 | ###LogSD $self->get_all_space . '::_parse_column_row', ); | ||||||||||||||||||||||||||||||||||||
| 117 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 118 | ###LogSD "Parsing excel row and column number from: $cell" ] ); | ||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||
| 120 | # Split the digits | ||||||||||||||||||||||||||||||||||||
| 121 | 606 | my $regex = qr/^([A-Z])?([A-Z])?([A-Z])?([0-9]*)$/; | |||||||||||||||||||||||||||||||||||
| 122 | 606 | my ( $one_column, $two_column, $three_column, $row ) = $cell =~ $regex; | |||||||||||||||||||||||||||||||||||
| 123 | 21 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 124 | 606 | my $column_text = $one_column . $two_column . $three_column; | |||||||||||||||||||||||||||||||||||
| 125 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 126 | ###LogSD "Regex result is: ( $one_column, $two_column, $three_column, $row )" ] ); | ||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||
| 128 | # Calculate the column value | ||||||||||||||||||||||||||||||||||||
| 129 | 606 | ▶ | if( !defined $one_column ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||
| 130 | 2 | push @$error_list_ref, "Could not parse the column component from -$cell-"; | |||||||||||||||||||||||||||||||||||
| 131 | }elsif( !defined $two_column ){ | ||||||||||||||||||||||||||||||||||||
| 132 | 596 | $column = $lookup_ref->{$one_column}; | |||||||||||||||||||||||||||||||||||
| 133 | }elsif( !defined $three_column ){ | ||||||||||||||||||||||||||||||||||||
| 134 | 6 | $column = $lookup_ref->{$two_column} + 26 * $lookup_ref->{$one_column}; | |||||||||||||||||||||||||||||||||||
| 135 | }else{ | ||||||||||||||||||||||||||||||||||||
| 136 | 2 | $column = $lookup_ref->{$three_column} + 26 * $lookup_ref->{$two_column} + 26 * 26 * $lookup_ref->{$one_column}; | |||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||
| 138 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 139 | ###LogSD "Result of initial parse is column text: $column_text", | ||||||||||||||||||||||||||||||||||||
| 140 | ###LogSD "Column number: $column", "Row number: $row" ] ); | ||||||||||||||||||||||||||||||||||||
| 141 | 606 | ▶ | if( $column_text and $column > 16384 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$column_text and $column > 16384
MC/DC100%2/2
$column_text and $column > 16384
$column_text
$column > 16384
Truth table100%3/3
A and B
A= $column_textB= $column > 16384
| |||||||||||||||||||||||||||||||||||||
| 142 | 1 | push @$error_list_ref, "The column text -$column_text- points to a position at " . | |||||||||||||||||||||||||||||||||||
| 143 | "-$column- past the excel limit of: 16,384"; | ||||||||||||||||||||||||||||||||||||
| 144 | 1 | $column = undef; | |||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||
| 147 | # Manage row out of bounds states | ||||||||||||||||||||||||||||||||||||
| 148 | 606 | ▶ | if( !defined $row or $row eq '' ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%3/3
not defined $row or $row eq ""
MC/DC100%2/2
not defined $row or $row eq ""
not defined $row
$row eq ""
Truth table100%3/3
not(A) or B
A= not defined $rowB= $row eq ""
| |||||||||||||||||||||||||||||||||||||
| 149 | 8 | push @$error_list_ref, "Could not parse the row component from -$cell-"; | |||||||||||||||||||||||||||||||||||
| 150 | 8 | $row = undef; | |||||||||||||||||||||||||||||||||||
| 151 | }elsif( $row < 1 ){ | ||||||||||||||||||||||||||||||||||||
| 152 | 1 | push @$error_list_ref, "The requested row cannot be less than one - you requested: $row"; | |||||||||||||||||||||||||||||||||||
| 153 | 1 | $row = undef; | |||||||||||||||||||||||||||||||||||
| 154 | }elsif( $row > 1048576 ){ | ||||||||||||||||||||||||||||||||||||
| 155 | 1 | push @$error_list_ref, "The requested row cannot be greater than 1,048,576 " . | |||||||||||||||||||||||||||||||||||
| 156 | "- you requested: $row"; | ||||||||||||||||||||||||||||||||||||
| 157 | 1 | $row = undef; | |||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||
| 160 | # Handle collected errors | ||||||||||||||||||||||||||||||||||||
| 161 | 606 | ▶ | if( $error_list_ref ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 162 | 12 | ▶ | if( scalar( @$error_list_ref ) > 1 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 163 | 1 | $self->set_error( "The regex $regex could not match -$cell-" ); | |||||||||||||||||||||||||||||||||||
| 164 | }else{ | ||||||||||||||||||||||||||||||||||||
| 165 | 11 | $self->set_error( $error_list_ref->[0] ); | |||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||
| 168 | ###LogSD no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||
| 169 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 170 | ###LogSD "Column: $column", "Row: $row" ] ); | ||||||||||||||||||||||||||||||||||||
| 171 | ###LogSD use warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||
| 172 | 606 | return( $column, $row ); | |||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||
| 175 | 228 | ▶ | sub _build_cell_label{ | ||||||||||||||||||||||||||||||||||
|
Subroutine
_build_cell_label: called CC=11 SCAR=29.3
| |||||||||||||||||||||||||||||||||||||
| 176 | 228 | my ( $self, $column, $row ) = @_; | |||||||||||||||||||||||||||||||||||
| 177 | ###LogSD my $phone = Log::Shiras::Telephone->new( name_space => | ||||||||||||||||||||||||||||||||||||
| 178 | ###LogSD $self->get_all_space . '::build_cell_label', ); | ||||||||||||||||||||||||||||||||||||
| 179 | ###LogSD no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||
| 180 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 181 | ###LogSD "Converting column -$column- and row -$row- to a cell ID" ] ); | ||||||||||||||||||||||||||||||||||||
| 182 | ###LogSD use warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||
| 183 | 228 | my $error_list; | |||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||
| 185 | # Parse column | ||||||||||||||||||||||||||||||||||||
| 186 | 228 | ▶ | if( !defined $column ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 187 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 188 | ###LogSD "The column is not defined" ] ); | ||||||||||||||||||||||||||||||||||||
| 189 | 0 | $column = ''; | |||||||||||||||||||||||||||||||||||
| 190 | 0 | push @$error_list, 'missing column'; | |||||||||||||||||||||||||||||||||||
| 191 | }else{ | ||||||||||||||||||||||||||||||||||||
| 192 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 193 | ###LogSD "Excel column: $column" ] ); | ||||||||||||||||||||||||||||||||||||
| 194 | 228 | $column -= 1; | |||||||||||||||||||||||||||||||||||
| 195 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 196 | ###LogSD "From zero: $column" ] ); | ||||||||||||||||||||||||||||||||||||
| 197 | 228 | ▶ | if( $column > 16383 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||
| 198 | 0 | push @$error_list, 'column too large'; | |||||||||||||||||||||||||||||||||||
| 199 | 0 | $column = ''; | |||||||||||||||||||||||||||||||||||
| 200 | }elsif( $column < 0 ){ | ||||||||||||||||||||||||||||||||||||
| 201 | 0 | push @$error_list, 'column too small'; | |||||||||||||||||||||||||||||||||||
| 202 | 0 | $column = ''; | |||||||||||||||||||||||||||||||||||
| 203 | }else{ | ||||||||||||||||||||||||||||||||||||
| 204 | 228 | my $first_letter = int( $column / (26 * 26) ); | |||||||||||||||||||||||||||||||||||
| 205 | 228 | $column = $column - $first_letter * (26 * 26); | |||||||||||||||||||||||||||||||||||
| 206 | 228 | ▶ | $first_letter = ( $first_letter ) ? $lookup_list->[$first_letter - 1] : ''; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 207 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 208 | ###LogSD "First letter is: $first_letter", "New column is: $column" ] ); | ||||||||||||||||||||||||||||||||||||
| 209 | 228 | my $second_letter = int( $column / 26 ); | |||||||||||||||||||||||||||||||||||
| 210 | 228 | $column = $column - $second_letter * 26; | |||||||||||||||||||||||||||||||||||
| 211 | 228 | ▶ | $second_letter = | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||
| 212 | ( $second_letter ) ? $lookup_list->[$second_letter - 1] : | ||||||||||||||||||||||||||||||||||||
| 213 | ( $first_letter ne '' ) ? 'A' : '' ; | ||||||||||||||||||||||||||||||||||||
| 214 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 215 | ###LogSD "Second letter is: $second_letter", "New column is: $column" ] ); | ||||||||||||||||||||||||||||||||||||
| 216 | 228 | my $third_letter = $lookup_list->[$column]; | |||||||||||||||||||||||||||||||||||
| 217 | 228 | $column = $first_letter . $second_letter . $third_letter; | |||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||
| 220 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 221 | ###LogSD "Column letters are: $column" ] ); | ||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||
| 223 | # Parse row | ||||||||||||||||||||||||||||||||||||
| 224 | 228 | ▶ | if( !defined $row ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 225 | 0 | $row = ''; | |||||||||||||||||||||||||||||||||||
| 226 | 0 | push @$error_list, 'missing row'; | |||||||||||||||||||||||||||||||||||
| 227 | }else{ | ||||||||||||||||||||||||||||||||||||
| 228 | 228 | ▶ | if( $row > 1048576 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||
| 229 | 0 | push @$error_list, 'row too large'; | |||||||||||||||||||||||||||||||||||
| 230 | 0 | $row = ''; | |||||||||||||||||||||||||||||||||||
| 231 | }elsif( $row < 1 ){ | ||||||||||||||||||||||||||||||||||||
| 232 | 0 | push @$error_list, 'row too small'; | |||||||||||||||||||||||||||||||||||
| 233 | 0 | $row = ''; | |||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||
| 236 | 228 | ▶ | $self->set_error( | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 237 | "Failures in build_cell_label include: " . join( ' - ', @$error_list ) | ||||||||||||||||||||||||||||||||||||
| 238 | ) if $error_list; | ||||||||||||||||||||||||||||||||||||
| 239 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 240 | ###LogSD "Row is: $row" ] ); | ||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||
| 242 | # Concatenate column and row | ||||||||||||||||||||||||||||||||||||
| 243 | 228 | my $cell_label = "$column$row"; | |||||||||||||||||||||||||||||||||||
| 244 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||
| 245 | ###LogSD "Cell label is: $cell_label" ] ); | ||||||||||||||||||||||||||||||||||||
| 246 | 228 | return $cell_label; | |||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||
| 249 | #########1 Phinish 3#########4#########5#########6#########7#########8#########9 | ||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||
| 251 | 21 | ▶ | no Moose::Role; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 252 | 21 | 1; | |||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||
| 254 | #########1 Documentation 3#########4#########5#########6#########7#########8#########9 | ||||||||||||||||||||||||||||||||||||
| 255 | __END__ | ||||||||||||||||||||||||||||||||||||