Subject: | Interoperability problem with Catalyst::Log::Log4perl |
Catalyst::Plugin::dumper cannot co-exist with Catalyst::Log::Log4perl or
Catalyst::Plugin::Log::Dispatch, because Catalyst::Log::dumper was
hard-coded.
If I use both together, Catalyst die with the following message.
Show quoted text
> Caught exception in Calendar::Controller::Member->main "Can't locate
> object method "dumper" via package "Catalyst::Log::Log4perl"
I think that a patch attached can solve this problem.
Subject: | Dumper.pm.patch |
*** Dumper.pm 2006-01-16 20:46:36.000000000 +0900
--- Dumper.pm.new 2007-04-10 23:54:52.000000000 +0900
***************
*** 10,26 ****
use Data::Dumper;
$Data::Dumper::Sortkeys = 1;
! sub Catalyst::Log::dumper {
! my ($self, $var, $label) = @_;
! if (defined $label) {
! # temporarily change the Varname that D::D uses
! local $Data::Dumper::Varname = $label;
! $self->debug( Dumper($var) );
! }
! else {
! $self->debug( Dumper($var) );
! }
}
1; # Magic true value required at end of module
--- 10,34 ----
use Data::Dumper;
$Data::Dumper::Sortkeys = 1;
! sub setup {
! my $class = shift;
! $class->NEXT::setup();
! eval( sprintf( <<' EOL', ref $class->log ) );
! sub %s::dumper {
! my ( $self, $var, $label ) = @_;
!
! if ( defined $label ) {
!
! # temporarily change the Varname that D::D uses
! local $Data::Dumper::Varname = $label;
! $self->debug( Dumper($var) );
! }
! else {
! $self->debug( Dumper($var) );
! }
! }
! EOL
}
1; # Magic true value required at end of module