so, i'm guessing that i have to mess with ARGV when i use -T on my code? i'm
getting this error:
Insecure dependency in open while running with -T switch at
/usr/lib/perl/5.10/IO/File.pm line 66
now, i didn't get this before spreadsheet::writeexcel. so i'm thinking that
i can't use ARGV when i define a 'new' package? here's my code:
#!/usr/bin/perl -T
use strict;
use warnings;
use DBI;
use Spreadsheet::ParseExcel;
use Spreadsheet::WriteExcel;
use Carp::Assert;
my ( @xldata, $i );
my $parser = Spreadsheet::ParseExcel->new();
my $workbookin = $parser->parse($ARGV[ 0 ]);
my $workbookout = Spreadsheet::WriteExcel->new( $ARGV[ 1 ]);
my $dbh = DBI->connect('DBI:mysql:ais;host=localhost', 'shawn', 'Pa55W0rd')
or die "Database connection: $!";
if ( !defined $workbookin ) {
die "Can\'t read spreadsheet: ", $parser->error(), ".\n";
}
if ( !defined $workbookout ) {
die "Can\'t write spreadsheet: $!\n"
}
my $worksheetin = $workbookin->worksheet(0);
my ( $row_min, $row_max ) = $worksheetin->row_range();
my ( $col_min, $col_max ) = $worksheetin->col_range();
for my $row ( $row_min .. $row_max ) {
for my $col ( $col_min .. $col_max ) {
my $cell = $worksheetin->get_cell( $row, $col );
next unless $cell;
$xldata[ $row ][ $col ] = $cell->unformatted() ;
}
}
my $worksheetout = $workbookout->add_worksheet( 'Data' );
$worksheetout->write_row( 'A1', \...@xldata );
#for my $row ( 0 .. $#xldata ) {
# print "ROW $row :\t";
# for my $col ( 0 .. $#{ $xldata[ $row ] } ) {
# print "$xldata[ $row ][ 13 ]," if defined( $xldata[ $row ][
13 ] );
# }
# print "\n";
#}