http://www.perlmonks.org?node_id=940598


in reply to Re: how organize code in callback mode
in thread how organize code in callback mode

Thanks for your reply. this version of code looks better, but now, I suspect i am on the right way. In order to avoid exposing variables in global, I have to pass 5 paras to cell_work function. and as a module, $callback_data does confuse end user.

to my primitive intention, I just want to separate code into subs and modules for managing. But it now seems to raise complexity of code. do I have to come back to below tedious code?

# main, use below to substitute cell_walk and callback routine for ( my $row = 1 ; $row <= $LastRow ; $row++ ) { for ( my $col = 1 ; $col <= $LastCol ; $col++ ) { next if !defined $Sheet->Cells( $row, $col )->{Value}; if ( $Sheet->Cells( $row, $col )->{Value} =~ /^~~~/ ) { my @a = split( /__/, substr( $Sheet->Cells( $row, $col )->{Value +}, 3 ) ); #grab useful string if( scalar @a == 3){ $Sheet->Cells( $row, $col )->{Value} = $hl->get_single_LP( 'ADAS_VAL_RAW', @a ); } if( scalar @a == 4){ $Sheet->Cells( $row, $col )->{Value} = $hl->accu_LP( 'ADAS_VAL_NORM', @a ); } } } }




I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction