my $sth = $dbh->prepare("SELECT ... WHERE ... ? ..."); $sth = Statement->wrap($sth, "Label"); ... $sth->execute(@args); #### package Statement; sub wrap { my($pkg, $sth, $label) = @_; bless [ $sth, $label ], $pkg; } sub execute { my $self = shift; # tracing, timing code here. E.g., log($self->[1] . " is about to execute"); my $rv = $self->[0]->execute(@args); # timing, logging code here } sub finish { my $self = shift; $self->[0]->finish(); } 1;