Revision 0bf192cd
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/LXDebug.pm | ||
---|---|---|
16 | 16 |
use constant FILE_TARGET => 0; |
17 | 17 |
use constant STDERR_TARGET => 1; |
18 | 18 |
|
19 |
use Data::Dumper; |
|
19 | 20 |
use POSIX qw(strftime getppid); |
20 | 21 |
use Time::HiRes qw(gettimeofday tv_interval); |
21 | 22 |
use YAML; |
22 | 23 |
|
23 | 24 |
use strict; |
24 | 25 |
|
25 |
my ($data_dumper_available, $text_diff_available);
|
|
26 |
my ($text_diff_available); |
|
26 | 27 |
|
27 |
our $global_level; |
|
28 |
our $watch_form; |
|
28 |
our $global_level = NONE();
|
|
29 |
our $watch_form = 0;
|
|
29 | 30 |
our $file_name; |
30 | 31 |
|
31 |
BEGIN { |
|
32 |
eval("use Data::Dumper"); |
|
33 |
$data_dumper_available = $@ ? 0 : 1; |
|
34 |
|
|
35 |
$global_level = NONE; |
|
36 |
$watch_form = 0; |
|
37 |
} |
|
38 |
|
|
39 | 32 |
sub new { |
40 | 33 |
my $type = shift; |
41 | 34 |
my $self = {}; |
... | ... | |
159 | 152 |
sub dump { |
160 | 153 |
my ($self, $level, $name, $variable, %options) = @_; |
161 | 154 |
|
162 |
if ($data_dumper_available) { |
|
163 | 155 |
my $password; |
164 | 156 |
if ($variable && ('Form' eq ref $variable) && defined $variable->{password}) { |
165 | 157 |
$password = $variable->{password}; |
... | ... | |
183 | 175 |
} |
184 | 176 |
|
185 | 177 |
return $output; |
186 |
|
|
187 |
} else { |
|
188 |
$self->message($level, |
|
189 |
"dumping ${name}: Data::Dumper not available; " |
|
190 |
. "variable cannot be dumped"); |
|
191 |
|
|
192 |
return undef; |
|
193 |
} |
|
194 | 178 |
} |
195 | 179 |
|
196 | 180 |
sub dump_yaml { |
SL/Template/Plugin/L.pm | ||
---|---|---|
2 | 2 |
|
3 | 3 |
use base qw( Template::Plugin ); |
4 | 4 |
use Template::Plugin; |
5 |
use Data::Dumper; |
|
5 | 6 |
use List::MoreUtils qw(apply); |
6 | 7 |
use List::Util qw(max); |
7 | 8 |
use Scalar::Util qw(blessed); |
... | ... | |
439 | 440 |
|
440 | 441 |
sub dump { |
441 | 442 |
my $self = shift; |
442 |
require Data::Dumper; |
|
443 | 443 |
return '<pre>' . Data::Dumper::Dumper(@_) . '</pre>'; |
444 | 444 |
} |
445 | 445 |
|
Auch abrufbar als: Unified diff
Data::Dumper immer via 'use' und nicht 'require' einbinden
Ist schließlich ein Core-Modul.