use strict; use warnings; use DBI; my $dsn = "DBI:mysql:database=testdb;host=localhost;port=3306"; my $dbh; eval{ $dbh = DBI->connect_cached( $dsn, "root", "", {RaiseError => 1, PrintError => 0} ); }; eval{ my $sth = $dbh->prepare_cached("SELECT * FROM testtable"); $self->{SCALAR} = $sth->execute; # --> ? $self->{CB} = $ref->{CB}; # --> ? $self->{STH} = $sth; # --> ? }; return if $@;