Salutations Monks!
I am running the following code on WIN 2000 server to connect to a DB that's running locally, however, i get the following error :
Software error:
Can't use string ("") as a subroutine ref while "strict refs" in use at F:/Perl/site/lib/DBIx/Dump.pm line 149
Any help will be much appreciated ....
#!f:/Perl/bin/perl.exe
use DBI;
use CGI::Lite;
use CGI::Carp qw(fatalsToBrowser);
use DBIx::Dump;
my %data = $cgi->parse_form_data;
##read values that are passed
#print distinct values of values of a db.
#if values are not passed end... else call the subroutine -> display_d
+ata()
sub display_data
{
##Write to Excel ##
my $sth = $dbh->prepare("SELECT devicename,cadb,substatus,dns,ping,snm
+p,dsiname,ovpi_st,sat,nnm,fqdn FROM consolidated_data where cadb like
+ '$cadb_pass' and substatus like '$substatus_pass' and dns like '$dn
+s_pass' and ping like '$ping_pass' and snmp like '$snmp_pass' and ovp
+i_st like '$ovpi_st_pass' and sat like '$sat_pass' and nnm like '$nnm
+_pass' ORDER BY rowid");
$sth->execute() or die "Cannot execute sth: $DBI::errstr";
my $out = DBIx::Dump->new('format' => $format_pass,
'output' => $filename_pass,
'sth' => $sth);
$out->dump( );
$sth->finish();
###This above code works when used as stand alone code###
#run the same query
{
print the results
}
$sth->finish();
$dbh->disconnect();
}
Update: changed the title
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|