>>>>> "CY" == Chaitanya Yanamadala <dr.virus.in...@gmail.com> writes:

i don't know the excell stuff but your code needs to be improved a bit.


  CY> my $oExcel = new Spreadsheet::ParseExcel;

don't use camelcase names. if the leading 'o' is for object, don't do
that. hungarian notation is also a bad idea.


  CY> die "You must provide a filename to $0 to be parsed as an Excel file" 
unless
  CY> @ARGV;
  CY> $filename = $ARGV[0];

this isn't clean under strict

        my $filename = $ARGV[0];


  CY>  if(!-e $filename){
  CY>      $log_data .= $filename." ==> The File Does not exist at that
  CY> location\n";
  CY>      &file_write($log_file,$log_data);

don't use & to call subs. it is perl4 and not needed. also it can lead
to bugs.

  CY> my $oBook = $oExcel->Parse($ARGV[0]);

you have that arg in $filename already so use it.

  CY> my($iR, $iC, $oWkS, $oWkC);

don't declare vars before you use them. and use better names. short
abbreviations like that are not readable by other coders.

  CY> for(my $iSheet=0; $iSheet < $oBook->{SheetCount} ; $iSheet++)

don't use c style for loops unless needed. that is better as this:

        for my $sheet ( 0 .. oBook->{SheetCount} ) {

  CY> {
  CY>  $oWkS = $oBook->{Worksheet}[$iSheet];

  CY>  for(my $iR = $oWkS->{MinRow} ;
  CY>      defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ;
  CY>      $iR++)

could $oWkS->{MaxRow} be undef? if it is, this loop will never
run. again, use a perl foreach loop:

        foreach my $row ( $oWkS->{MinRow} .. $oWkS->{MaxRow} ) {


  CY>  {
  CY>   for(my $iC = $oWkS->{MinCol} ;
  CY>       defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ;
  CY>       $iC++)

ditto!

        foreach my $col ( $oWkS->{MinCol} .. $oWkS->{MaxCol} ) {

  CY> On Thu, Nov 11, 2010 at 8:39 PM, Anush <anushajl...@gmail.com> wrote:

and don't quote entire posts below yours. quote and edit the post and
add your code and comments below the relevant parts.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to