Subject: | $log undefined -- calling _stat incorrectly? |
Date: | Mon, 08 Jul 2013 16:46:09 +0100 |
To: | bug-Apache2-Dispatch [...] rt.cpan.org |
From: | Ian Crowther <ian [...] comtek.co.uk> |
We were getting errors with a clean build of Apache2-Dispatch-0.15:
Can't call method "debug" on an undefined value at
/usr/local/share/perl/5.14.2/Apache/Dispatch/Util.pm line 198
I noticed that _stat/_recurse_stat being called as a method (__PACKAGE__
-> stat(...) ) in Apache/Dispatch.pm and Apache2/Dispatch.pm but being
called directly within Apache/Dispatch/Util.pm. I managed to make the
module work again with the patch below. My knowledge of object oriented
perl is shaky at best so my fix may be inappropriate:
--- lib/Apache/Dispatch/Util.pm.orig 2013-07-08 15:05:29.000000000 +0100
+++ lib/Apache/Dispatch/Util.pm 2013-07-08 15:35:18.000000000 +0100
@@ -233,31 +233,32 @@
}
sub _recurse_stat {
#---------------------------------------------------------------------
# recurse through all the parent classes of the current class
# and call _stat on each
# this method is for internal use only
#---------------------------------------------------------------------
+ my $pkg = shift;
my ($class, $log) = @_;
- my $rc = _stat($class, $log);
+ my $rc = __PACKAGE__->_stat($class, $log);
return unless $rc;
# turn off strict here so we can get at the class @ISA
no strict 'refs';
foreach my $package (@{"${class}::ISA"}) {
- $rc = _recurse_stat($package, $log);
+ $rc = __PACKAGE__->_recurse_stat($package, $log);
last unless $rc;
}
return $rc;
}
sub _set_ISA {
#---------------------------------------------------------------------
# set the ISA array for the class
As an aside, the _stat and _recurse_stat functions are passed an unused
third "$debug" parameter in Apache/Dispatch.pm
Thanks for the module
Ian
--
=======================================================================
Ian Crowther Tel: +44 1244 280390 Unit 108, 10th Avenue,
IT manager , Comtek Fax: +44 1244 280390 Zone 3, Deeside Industrial
Network Systems UK Ltd Park, CH5 2UA, Flintshire
=======================================================================