1 package HTML::Zoom::MaybeDebug;
7 if (my $level = $ENV{'HTML_ZOOM_DEBUG'}) {
8 foreach my $mod (qw(Smart::Comments Data::Dumper::Concise JSON)) {
9 (my $file_stem = $mod) =~ s/::/\//g;
10 die "HTML_ZOOM_DEBUG env var set to ${level} - this requires the ${mod}\n"
11 ."module but it failed to load with error:\n$@"
12 unless eval { require "${file_stem}.pm"; 1 };
14 my @smartness = map '#'x$_, 3 .. $level+2;
15 no warnings 'redefine';
16 *import = sub { Smart::Comments->import(@smartness) };
17 my $j = JSON->new->space_after;
18 my $d = \&Data::Dumper::Concise::Dumper;
19 *Smart::Comments::Dumper = sub {
21 unless (eval { $r = $j->encode($_[0]); 1 }) {