1 package SQL::Translator::Role::Debug;
6 accessor => 'debugging',
7 init_arg => 'debugging',
8 coerce => sub { $_[0] ? 1 : 0 },
15 my $class = ref $self;
17 return ${"${class}::DEBUG"};
20 around debugging => sub {
21 my ($orig, $self) = (shift, shift);
23 # Emulate horrible Class::Base API
25 my $dbgref = do { no strict 'refs'; \${"${self}::DEBUG"} };
26 $$dbgref = $_[0] if @_;
29 return $self->$orig(@_);
35 return unless $self->debugging;
37 print STDERR '[', (ref $self || $self), '] ', @_, "\n";