line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package LEOCHARRE::Strings; |
2
|
1
|
|
|
1
|
|
155832
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
97
|
|
3
|
1
|
|
|
1
|
|
7
|
use vars qw(@EXPORT_OK %EXPORT_TAGS @ISA); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
90
|
|
4
|
1
|
|
|
1
|
|
6
|
use Exporter; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
59
|
|
5
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
615
|
|
6
|
1
|
|
|
1
|
|
2453
|
use String::Prettify; |
|
1
|
|
|
|
|
2812
|
|
|
1
|
|
|
|
|
79
|
|
7
|
1
|
|
|
1
|
|
4119
|
use String::ShellQuote; |
|
1
|
|
|
|
|
1717
|
|
|
1
|
|
|
|
|
388
|
|
8
|
|
|
|
|
|
|
our $VERSION = sprintf "%d.%02d", q$Revision: 1.2 $ =~ /(\d+)/g; |
9
|
|
|
|
|
|
|
@ISA = qw/Exporter/; |
10
|
|
|
|
|
|
|
@EXPORT_OK = qw/sq pretty shomp is_blank_or_comment boc is_blank is_comment/; |
11
|
|
|
|
|
|
|
%EXPORT_TAGS = ( all => \@EXPORT_OK ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
*pretty = \&String::Prettify::prettify; |
14
|
|
|
|
|
|
|
*sq = \&String::ShellQuote::shell_quote; |
15
|
|
|
|
|
|
|
*is_blank_or_comment = \&boc; |
16
|
|
|
|
|
|
|
sub shomp; |
17
|
|
|
|
|
|
|
sub shomp { |
18
|
3
|
|
|
3
|
1
|
1065
|
my $a = \shift; |
19
|
|
|
|
|
|
|
# DONE need this to somhow reference to what's in front like with chomp |
20
|
|
|
|
|
|
|
# (the \shift does that) |
21
|
|
|
|
|
|
|
#printf STDERR "# shomp() got: '%s' %s\n", $a, (ref $a); |
22
|
3
|
50
|
|
|
|
143
|
$$a=~s/^\s+|\s+$//g ? 1 : 0; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub is_blank { |
27
|
7
|
|
|
7
|
1
|
9
|
my $a = shift; |
28
|
7
|
100
|
66
|
|
|
43
|
((defined $a) and length($a))or return 1; # if nothing, then is blank |
29
|
|
|
|
|
|
|
|
30
|
5
|
100
|
|
|
|
29
|
($a=~/\S/ ) ? 0 : 1; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub is_comment { |
34
|
5
|
|
|
5
|
1
|
1966
|
my $a = shift; |
35
|
5
|
100
|
|
|
|
39
|
$a=~/^\s*#/ ? 1 : 0; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub boc { |
39
|
4
|
|
|
4
|
1
|
6
|
my $a = shift; |
40
|
4
|
100
|
|
|
|
7
|
is_blank($a) and return 1; |
41
|
2
|
100
|
|
|
|
5
|
is_comment($a) and return 1; |
42
|
1
|
|
|
|
|
4
|
return 0; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |