| 1 | package Data::Printer::Filter::VSTRING; | ||||||||||||||||||||||||||||
| 2 | 35 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 35 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 35 | ▶ | use Data::Printer::Filter; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 35 | ▶ | use Data::Printer::Common; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 35 | filter 'VSTRING' => \&parse; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 3 | ▶ | sub parse { | ||||||||||||||||||||||||||
|
Subroutine
parse: called CC=4 SCAR=14.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 10 | 3 | my ($vstring, $ddp) = @_; | |||||||||||||||||||||||||||
| 11 | 3 | 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 | 3 | ▶ | my $error = Data::Printer::Common::_tryme(sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 3 | require version; | |||||||||||||||||||||||||||
| 20 | 3 | $string = version->parse($$vstring)->normal; | |||||||||||||||||||||||||||
| 21 | 3 | }); | |||||||||||||||||||||||||||
| 22 | 3 | ▶ | $string = 'VSTRING object (unable to parse)' if $error; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 3 | ▶ | if ($ddp->show_tied and my $tie = ref tied $$vstring) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$ddp->show_tied and my $tie = ref tied $$vstring
MC/DC0%0/2
$ddp->show_tied and my $tie = ref tied $$vstring
$ddp->show_tied
my $tie = ref tied $$vstring
Truth table66%2/3
A and B
A= $ddp->show_tiedB= my $tie = ref tied $$vstring
| |||||||||||||||||||||||||||||
| 25 | 0 | $string .= " (tied to $tie)"; | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | 3 | return $ddp->maybe_colorize($string, 'vstring'); | |||||||||||||||||||||||||||
| 28 | }; | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 35 | 1; | |||||||||||||||||||||||||||