MashMashy has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl require "common_function.pl"; use DBI; use Digest::MD5 qw(md5 md5_hex md5_base64); ############# this is here to check their authentication - that line + removed from this code, and the load still happens without it here print "Content-type: text/html \n\n"; $dbh = DBI->connect('DBI:mysql:name-of-db', 'NOT COPIED INTO HERE', ' +NOT COPIED INTO HERE'); ######### this is the subroutine called from that common block, copied + into here for clarity ########## $query = 'SELECT flag_value FROM server_flags WHERE flag_name = ?' +; $sthcf2 = $dbh->prepare($query); $result=$sthcf2->execute("announcements_today"); ($currentnews) = $sthcf2->fetchrow(); $sthcf2->finish(); ################## if ($currentnews ne ""){ $currentnews=<<_MOOSE_; <table style="border-color:black;border-width:1px;border-style:solid;f +ont-size:14px" bgcolor=FFFFFF><tr><td align=center width=100> $currentnews </td></tr></table> _MOOSE_ $dbh->disconnect(); } print $currentnews; $dbh->disconnect();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: huge CPU load on simple DBI function - reason?
by shmem (Chancellor) on Feb 01, 2009 at 17:34 UTC | |
by MashMashy (Sexton) on Feb 01, 2009 at 17:53 UTC |