main_script:
============
use strict;
use warnings;
...
...
use lib '/home/hosting/foo.bar/public_html/libs/perl';
use OpenSubtitles::Help;
...
( $i->{FileName} ) = $dbh->selectrow_array(qq{
select SubFileName
from subs_subtitle_file a
left join subs_subtitle b on a.SubtitleID = b.IDSubtitle
where IDSubtitleFile = ?
}, {}, $i->{IDSubtitleFile});
module_script:
==============
package OpenSubtitles::Help;
use strict;
use warnings;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION);
use Exporter;
use DBI;
$VERSION = 1.00;
@ISA = ('Exporter');
@EXPORT = qw( $dbh
get_user
);
#db connect
our $dbh = DBI->connect("DBI:mysql:database=sub;host=localhost;port=3306",
"foo", "bar",
{
AutoCommit => 1,
RaiseError => 1,
}) or die "Can't connect: ", $DBI::errstr;
...
1;
Symptomps: the worst thing on this is, sometimes script works OK, as I
expect. But sometimes I get:
1.error: [Fri Mar 3 19:46:19 2006] -e: DBD::mysql::db selectrow_array failed: MySQL server has gone away at ... 2.error: [Fri Mar 03 19:43:11 2006] [error] Global symbol "$dbh" requires explicit package name at ...I really dont know whats going here. I checked mysql uptime, it is OK, it is not restarting.
Did you try Super Search?
You could have found these nodes:
You may also benefit from reading node 264485.. die "a"; .. die "b"; ...sometimes script dies on die "a" (always should!), and sometimes on die "b". I really dont know whats going on here
perlmonks.org content © perlmonks.org and 2ge, perrin, rnahi
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03