} else {
$fh = IO::File->new('>&STDERR');
}
- $new->debugobj->debugfh($fh);
+ $new->debugfh($fh);
$new->debug(1) if $ENV{DBIX_CLASS_STORAGE_DBI_DEBUG};
return $new;
}
set to be STDERR - although see information on the
L<DBIX_CLASS_STORAGE_DBI_DEBUG> environment variable.
+=cut
+
+sub debugfh {
+ my $self = shift;
+
+ if ($self->debugobj->can('debugfh')) {
+ return $self->debugobj->debugfh(@_);
+ }
+}
+
=head2 debugobj
Sets or retrieves the object used for metric collection. Defaults to an instance
See L<debugobj> for a better way.
=cut
+
sub debugcb {
- my $self = shift();
+ my $self = shift;
- if($self->debugobj()->can('callback')) {
- $self->debugobj()->callback(shift());
+ if ($self->debugobj->can('callback')) {
+ return $self->debugobj->callback(@_);
}
}
--- /dev/null
+use strict;
+use warnings;
+
+use Test::More;
+use lib qw(t/lib);
+use DBICTest;
+
+my $schema = DBICTest->init_schema();
+
+plan tests => 2;
+
+ok ( $schema->storage->debug(1), 'debug' );
+ok ( defined(
+ $schema->storage->debugfh(
+ IO::File->new('t/var/sql.log', 'w')
+ )
+ ),
+ 'debugfh'
+ );
+
+1;