System error

error:  Can't call method "prepare" on an undefined value at /var/www/html/middleaging/addweb.mhtml line 38.
context: 
... 
34:  my $dbh = DBI->connect('DBI:mysql:web','web','web');
35:  my $sth;
36:  my $p=0;
37: 
38:  $sth = $dbh->prepare('select key_data from exchange_tiaojian where main_url=?');
39:  $sth->execute($portalname);
40:  while($ref = $sth->fetchrow_arrayref()){
41:  @cate_data = split(/ /,$ref->[0]);
42:  }
... 
code stack:  /var/www/html/middleaging/addweb.mhtml:38
raw error






























Can't call method "prepare" on an undefined value at /var/www/html/middleaging/addweb.mhtml line 38.


Trace begun at /usr/lib/perl5/site_perl/5.8.3/HTML/Mason/Exceptions.pm line 131
HTML::Mason::Exceptions::rethrow_exception('Can\'t call method "prepare" on an undefined value at /var/www/html/middleaging/addweb.mhtml line 38.^J') called at /var/www/html/middleaging/addweb.mhtml line 38
HTML::Mason::Commands::__ANON__('g_id', 39) called at /usr/lib/perl5/site_perl/5.8.3/HTML/Mason/Component.pm line 136
HTML::Mason::Component::run('HTML::Mason::Component::FileBased=HASH(0xac1a1e4)', 'g_id', 39) called at /usr/lib/perl5/site_perl/5.8.3/HTML/Mason/Request.pm line 1069
eval {...} at /usr/lib/perl5/site_perl/5.8.3/HTML/Mason/Request.pm line 1068
HTML::Mason::Request::comp(undef, undef, undef, 'g_id', 39) called at /usr/lib/perl5/site_perl/5.8.3/HTML/Mason/Request.pm line 338
eval {...} at /usr/lib/perl5/site_perl/5.8.3/HTML/Mason/Request.pm line 338
eval {...} at /usr/lib/perl5/site_perl/5.8.3/HTML/Mason/Request.pm line 297
HTML::Mason::Request::exec('HTML::Mason::Request::ApacheHandler=HASH(0xac04030)') called at /usr/lib/perl5/site_perl/5.8.3/HTML/Mason/ApacheHandler.pm line 134
eval {...} at /usr/lib/perl5/site_perl/5.8.3/HTML/Mason/ApacheHandler.pm line 134
HTML::Mason::Request::ApacheHandler::exec('HTML::Mason::Request::ApacheHandler=HASH(0xac04030)') called at /usr/lib/perl5/site_perl/5.8.3/HTML/Mason/ApacheHandler.pm line 827
HTML::Mason::ApacheHandler::handle_request('HTML::Mason::ApacheHandler=HASH(0xa7eabc0)', 'Apache=SCALAR(0xaba530c)') called at (eval 33) line 8
HTML::Mason::ApacheHandler::handler('HTML::Mason::ApacheHandler', 'Apache=SCALAR(0xaba530c)') called at /dev/null line 0
eval {...} at /dev/null line 0