line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package String::Indent; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2014-12-10'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.01'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
22402
|
use 5.010001; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
51
|
|
7
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
49
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
57
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use Exporter; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
254
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
12
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
13
|
|
|
|
|
|
|
indent |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub indent { |
17
|
2
|
|
|
2
|
1
|
10
|
my ($indent, $str, $opts) = @_; |
18
|
2
|
|
100
|
|
|
11
|
$opts //= {}; |
19
|
|
|
|
|
|
|
|
20
|
2
|
100
|
100
|
|
|
10
|
if ($opts->{indent_blank_lines} // 1) { |
21
|
1
|
|
|
|
|
13
|
$str =~ s/^/$indent/mg; |
22
|
|
|
|
|
|
|
} else { |
23
|
1
|
|
|
|
|
11
|
$str =~ s/^([^\r\n]*\S[^\r\n]*)/$indent$1/mg; |
24
|
|
|
|
|
|
|
} |
25
|
2
|
|
|
|
|
12
|
$str; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
# ABSTRACT: String indenting routines |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |