Hi
ich hab es in etwa so
#abc.pm
sub new {
my $self = shift;
return bless {
dbh => (shift || die "bla"),
sessionLength => 48
}, ref $self || $self;
}
sub update {
my $self=shift;
my $sth;
$sth = $self->{db}->prepare('SELECT * FROM abc') || die "cannot prepare query, errmsg = $DBI::errstr"; # <--- Zeile 52
$sth->execute() || die "cannot execute query, errmsg = $DBI::errstr";
$sth->finish();
}
# folgender Code ist in einer anderen Datei
use CGI::Carp qw(fatalsToBrowser);
use CGI ':standard';
use DBI;
use strict;
use abc;
...
$dbh = DBI->connect($DSN, $USER, $PASS) || die "can't connect, errmsg = $DBI::errstr";
my $xyz=abc->new($dbh);
$xyz->update()
# in dieser Datei kann ich auf $dbh zugreifen
Danke!