DBI-Log
view release on metacpan or search on metacpan
lib/DBI/Log.pm view on Meta::CPAN
my ($package, %args) = @_;
for my $key (keys %args) {
$opts{$key} = $args{$key};
}
if (!$opts{file}) {
$opts{fh} = \*STDERR;
}
else {
my $file2 = $opts{file};
if ($file2 =~ m{^~/}) {
my $home = $ENV{HOME} || (getpwuid($<))[7];
$file2 =~ s{^~/}{$home/};
}
open $opts{fh}, ">>", $file2 or die "Can't open $opts{file}: $!\n";
# autoflush so that tailing to watch queries being performed works
# as you'd expect
$opts{fh}->autoflush(1);
}
}
sub pre_query {
( run in 0.230 second using v1.01-cache-2.11-cpan-8d75d55dd25 )