Skip to content

Commit

Permalink
Item14152: Don't die if Devel::Leak::Object cannot be loaded.
Browse files Browse the repository at this point in the history
  • Loading branch information
vrurg committed Oct 7, 2016
1 parent 549961c commit 9cca120
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions core/bin/foswiki_debug.psgi
Expand Up @@ -37,22 +37,26 @@ use Foswiki::App;
use Devel::Leak;
use Devel::Leak::Object;

use constant CHECKLEAK => 0;
use constant CHECKLEAK => $ENV{FOSWIKI_CHECKLEAK} // 0;

BEGIN {
if (CHECKLEAK) {
eval "use Devel::Leak::Object qw{ GLOBAL_bless };";
die $@ if $@;
$Devel::Leak::Object::TRACKSOURCELINES = 1;
$Devel::Leak::Object::TRACKSTACK = 1;
if ($@) {
say STDERR "!!! Failed to load Devel::Leak::Object\n", $@;
}
else {
$Devel::Leak::Object::TRACKSOURCELINES = 1;
$Devel::Leak::Object::TRACKSTACK = 1;
}
}
}

my $app = sub {
my $env = shift;

Devel::Leak::Object::checkpoint if CHECKLEAK;

$env->{FOSWIKI_SCRIPTS} = $scriptDir unless $env->{FOSWIKI_SCRIPTS};

my $rc = Foswiki::App->run( env => $env, );
Expand Down

0 comments on commit 9cca120

Please sign in to comment.