Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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/ 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

In reply to DBIx::Dump error - can't use string as subroutine ref by sparkylu

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • 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.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2023-10-03 01:21 GMT
Find Nodes?
    Voting Booth?

    No recent polls found