line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Printer::Filter::VSTRING; |
2
|
34
|
|
|
34
|
|
245
|
use strict; |
|
34
|
|
|
|
|
80
|
|
|
34
|
|
|
|
|
1142
|
|
3
|
34
|
|
|
34
|
|
193
|
use warnings; |
|
34
|
|
|
|
|
67
|
|
|
34
|
|
|
|
|
861
|
|
4
|
34
|
|
|
34
|
|
174
|
use Data::Printer::Filter; |
|
34
|
|
|
|
|
71
|
|
|
34
|
|
|
|
|
264
|
|
5
|
34
|
|
|
34
|
|
223
|
use Data::Printer::Common; |
|
34
|
|
|
|
|
86
|
|
|
34
|
|
|
|
|
6788
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
filter 'VSTRING' => \&parse; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub parse { |
10
|
3
|
|
|
3
|
0
|
10
|
my ($vstring, $ddp) = @_; |
11
|
3
|
|
|
|
|
16
|
my $string = ''; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# The reason we don't simply do: |
14
|
|
|
|
|
|
|
# use version 0.77 (); |
15
|
|
|
|
|
|
|
# is because it was causing some issues with UNIVERSAL on Perl 5.8 and |
16
|
|
|
|
|
|
|
# some versions of version.pm. So now we do it on runtime on the filter. |
17
|
|
|
|
|
|
|
# ->parse() will raise an error unless version.pm >= 0.77. |
18
|
|
|
|
|
|
|
my $error = Data::Printer::Common::_tryme(sub { |
19
|
3
|
|
|
3
|
|
1288
|
require version; |
20
|
3
|
|
|
|
|
3937
|
$string = version->parse($$vstring)->normal; |
21
|
3
|
|
|
|
|
25
|
}); |
22
|
3
|
50
|
|
|
|
17
|
$string = 'VSTRING object (unable to parse)' if $error; |
23
|
|
|
|
|
|
|
|
24
|
3
|
50
|
66
|
|
|
12
|
if ($ddp->show_tied and my $tie = ref tied $$vstring) { |
25
|
0
|
|
|
|
|
0
|
$string .= " (tied to $tie)"; |
26
|
|
|
|
|
|
|
} |
27
|
3
|
|
|
|
|
13
|
return $ddp->maybe_colorize($string, 'vstring'); |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |