line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Snippet::TabStop; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
9
|
|
|
9
|
|
58335
|
$Text::Snippet::TabStop::VERSION = '0.04'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Abstract class for other tab stop classes |
7
|
|
|
|
|
|
|
|
8
|
9
|
|
|
9
|
|
56
|
use strict; |
|
9
|
|
|
|
|
34
|
|
|
9
|
|
|
|
|
235
|
|
9
|
9
|
|
|
9
|
|
46
|
use warnings; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
248
|
|
10
|
9
|
|
|
9
|
|
43
|
use Carp qw(croak); |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
710
|
|
11
|
9
|
|
|
9
|
|
2666
|
use overload '""' => sub { shift->to_string }; |
|
9
|
|
|
65
|
|
7885
|
|
|
9
|
|
|
|
|
108
|
|
|
65
|
|
|
|
|
192
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub parse { |
15
|
1
|
50
|
|
1
|
1
|
901
|
croak "must be implemented in sub class" if(shift eq __PACKAGE__); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _new { |
19
|
70
|
|
|
70
|
|
96
|
my $class = shift; |
20
|
70
|
50
|
|
|
|
159
|
croak "this is an abstract class - please instantiate a sub-class of " . __PACKAGE__ if($class eq __PACKAGE__); |
21
|
|
|
|
|
|
|
|
22
|
70
|
|
|
|
|
288
|
my %args = @_; |
23
|
70
|
|
|
|
|
115
|
for my $k(qw(src index)){ |
24
|
140
|
50
|
|
|
|
666
|
croak "$k is required" unless defined $args{$k}; |
25
|
|
|
|
|
|
|
} |
26
|
70
|
|
|
|
|
362
|
return bless \%args, $class; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
use Class::XSAccessor |
31
|
9
|
|
|
|
|
182
|
getters => { src => 'src', index => 'index', replacement => 'replacement' }, |
32
|
|
|
|
|
|
|
setters => { replace => 'replacement' }, |
33
|
|
|
|
|
|
|
accessors => { parent => 'parent' }, |
34
|
9
|
|
|
9
|
|
29103
|
predicates => { has_parent => 'parent', has_replacement => 'replacement' }; |
|
9
|
|
|
|
|
45730
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub to_string { |
38
|
133
|
|
|
133
|
1
|
163
|
my $self = shift; |
39
|
133
|
100
|
|
|
|
412
|
return $self->parent->to_string if($self->has_parent); |
40
|
103
|
|
|
|
|
237
|
my $replacement = $self->replacement; |
41
|
103
|
100
|
|
|
|
797
|
return defined($replacement) ? $replacement : ''; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |