CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
"Use of uninitialized value $source in -e at C:/Perl/site/lib/Spreadsheet/ParseExcel.pm line 636."

 



dipankar
New User

Sep 9, 2011, 12:54 AM

Post #1 of 2 (726 views)
"Use of uninitialized value $source in -e at C:/Perl/site/lib/Spreadsheet/ParseExcel.pm line 636." Can't Post

m new to Perl,

i am getting an error like
"Use of uninitialized value $source in -e at C:/Perl/site/lib/Spreadsheet/ParseExcel.pm line 636."

can you help what could be this error:

Code is as follows:
use DBI;
use CGI;
use Spreadsheet::ParseExcel;
use DBD::ODBC;

$cgi = new CGI;
my $dbh = DBI->connect("dbi:ODBC:Driver={SQL Server};Server=10.11.150.186;UID=$user;PWD=$password")
or die "Can't connect to database.\n";

$file = $cgi->param("cage.xls");

$workbook = Spreadsheet::ParseExcel::Workbook->Parse($cgi->param("cage.xls"));

foreach $sheet (@{$workbook->{Worksheet}})
{

foreach $col ($sheet->{MinCol} .. $sheet->{MaxCol})
{
if ($sheet->{Cells}[0][$col]->{Val} eq "TenderId")
{
$TenderId = $col;
}

if ($sheet->{Cells}[0][$col]->{Val} eq "Tender")
{
$Tender = $col;
}
$dbh->do("insert into tempdips (TenderId,Tender) values
(\'$TenderId\', \'$Tender\')");
}
}

any help will be much appreciated


rovf
Veteran

Sep 9, 2011, 1:11 AM

Post #2 of 2 (724 views)
Re: [dipankar] "Use of uninitialized value $source in -e at C:/Perl/site/lib/Spreadsheet/ParseExcel.pm line 636." [In reply to] Can't Post

- You forgot to check whether $cgi->param("cage.xls") is defined

- You should use strict and warnings

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives