line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Snippet::TabStop::WithDefault; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
8
|
|
|
8
|
|
196
|
$Text::Snippet::TabStop::WithDefault::VERSION = '0.04'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Tab stop that specifies a default value for the user |
7
|
|
|
|
|
|
|
|
8
|
8
|
|
|
8
|
|
50
|
use strict; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
277
|
|
9
|
8
|
|
|
8
|
|
44
|
use warnings; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
253
|
|
10
|
8
|
|
|
8
|
|
43
|
use base qw(Text::Snippet::TabStop); |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
680
|
|
11
|
8
|
|
|
8
|
|
49
|
use Carp qw(croak); |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
557
|
|
12
|
8
|
|
|
8
|
|
140
|
use Class::XSAccessor getters => { default => 'default' }; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
102
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub replacement { |
16
|
11
|
|
|
11
|
1
|
16
|
my $self = shift; |
17
|
11
|
100
|
|
|
|
123
|
return $self->has_replacement ? $self->SUPER::replacement : $self->default; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub parse { |
21
|
16
|
|
|
16
|
1
|
25
|
my $class = shift; |
22
|
16
|
|
|
|
|
27
|
my $src = shift; |
23
|
16
|
100
|
|
|
|
72
|
if($src =~ m/\$\{(\d+):(.*)\}/){ |
24
|
10
|
|
100
|
|
|
93
|
return $class->_new( index => $1, src => $src, default => $2 || '' ); |
25
|
|
|
|
|
|
|
} |
26
|
6
|
|
|
|
|
12
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |