Subject: | wrong test for devpopup support |
This plugin includes CAP::DevPopup support like this:
if (UNIVERSAL::can($self, 'devpopup')) {
# Register our report with DevPopup
$self->add_callback( 'devpopup_report', \&_devpopup_report
);
# Create logger to capture all log entries
However it is possible to have the DevPopup plugin loaded but not
enabled (If you are using Titanium for instance.) In this case you
will get an error like this:
Can't locate object method "new" via package "Log::Dispatch::File"
(perhaps you forgot to load "Log::Dispatch::File"?) at
/usr/share/perl5/CGI/Application/Plugin/LogDispatch.pm line 97.
unless you have Log::Dispatch::File loaded which you might not.
I suggest
1. The test be changed to if ( defined $ENV{CAP_DEVPOPUP_EXEC} )
so support is only added if DevPopup is enabled.
2. Log::Dispatch::File is require'd before the logger is attempted to
be created.
I have enclosed a patch that does this.
Subject: | patch.txt |
--- LogDispatch.pm.orig 2009-06-15 15:37:18.000000000 -0400
+++ LogDispatch.pm 2009-06-15 15:39:20.000000000 -0400
@@ -80,10 +80,12 @@
_set_object($frompkg||$self, $log);
# CAP::DevPopup support
- if (UNIVERSAL::can($self, 'devpopup')) {
+ if (defined $ENV{'CAP_DEVPOPUP_EXEC'}) {
# Register our report with DevPopup
$self->add_callback( 'devpopup_report', \&_devpopup_report );
+ require Log::Dispatch::File;
+
# Create logger to capture all log entries
my %options = (
'name' => 'DevPopup',