Subject: | Apache2::Status->menu_item fails in TerseSize.pm |
Date: | Fri, 16 Mar 2012 16:06:21 -0500 |
To: | <bug-B-Size [...] rt.cpan.org> |
From: | Troy Engel <troy.engel [...] rackspace.com> |
I borrowed this fix from Apache::DBI code:
--- TerseSize.pm.REAL_0.09 2006-12-02 07:54:36.000000000 -0500
+++ TerseSize.pm 2012-03-16 14:04:35.000000000 -0400
@@ -11,6 +11,20 @@
use constant IS_MODPERL => $ENV{MOD_PERL};
use constant MP2 => $ENV{MOD_PERL_API_VERSION} == 2 ? 1 : 0;
+BEGIN {
+ if (MP2) {
+ require mod_perl2;
+ require Apache2::Module;
+ require Apache2::RequestUtil;
+ require Apache2::ServerUtil;
+ require Apache2::Status;
+ }
+ elsif (defined $modperl::VERSION && $modperl::VERSION > 1 &&
+ $modperl::VERSION < 1.99) {
+ require Apache;
+ }
+}
+
use B ();
use B::Asmdata qw(@specialsv_name);
use B::Size ();
@@ -652,10 +666,12 @@
}
if (MP2) {
- Apache2::Status->menu_item(
- 'status_memory_usage' => "Memory Usage",
- \&status_memory_usage,
- );
+ if (Apache2::Module::loaded('Apache2::Status')) {
+ Apache2::Status::menu_item(
+ 'status_memory_usage' => "Memory Usage",
+ \&status_memory_usage,
+ );
+ }
}
elsif (IS_MODPERL and Apache->module("Apache::Status")) {
Apache::Status->menu_item(
--
Troy Engel, RHCE
Linux Systems Admin IV
Rackspace Enterprise Services