line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IO::Capture::Extended; |
2
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
75
|
|
3
|
2
|
|
|
2
|
|
15
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
748
|
|
4
|
|
|
|
|
|
|
our $VERSION = 0.13; |
5
|
|
|
|
|
|
|
require Exporter; |
6
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
7
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
8
|
|
|
|
|
|
|
grep_print_statements |
9
|
|
|
|
|
|
|
statements |
10
|
|
|
|
|
|
|
matches |
11
|
|
|
|
|
|
|
matches_ref |
12
|
|
|
|
|
|
|
all_screen_lines |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( all => [ @EXPORT_OK ] ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub grep_print_statements { |
18
|
10
|
|
|
10
|
0
|
2489
|
my $self = shift; |
19
|
10
|
|
|
|
|
12
|
my $string = shift; |
20
|
10
|
|
|
|
|
8
|
my @found_statements; |
21
|
|
|
|
|
|
|
|
22
|
10
|
|
|
|
|
25
|
for my $statement (@{$self->{'IO::Capture::messages'}}) { |
|
10
|
|
|
|
|
16
|
|
23
|
40
|
100
|
|
|
|
110
|
push @found_statements, $statement if $statement =~ /$string/; |
24
|
|
|
|
|
|
|
} |
25
|
10
|
100
|
|
|
|
39
|
return wantarray ? @found_statements : scalar(@found_statements); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub statements { |
29
|
12
|
|
|
12
|
0
|
4530
|
my $self = shift; |
30
|
12
|
|
|
|
|
12
|
return scalar(@{$self->{'IO::Capture::messages'}}); |
|
12
|
|
|
|
|
497
|
|
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub matches { |
34
|
8
|
|
|
8
|
0
|
3415
|
my @matches = _matches_engine(@_); |
35
|
6
|
100
|
|
|
|
37
|
return wantarray ? @matches : scalar(@matches); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub matches_ref { |
39
|
2
|
|
|
2
|
0
|
1136
|
my @matches = _matches_engine(@_); |
40
|
2
|
|
|
|
|
7
|
return \@matches; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub _matches_engine { |
44
|
10
|
|
|
10
|
|
14
|
my ($self, $regex) = @_; |
45
|
10
|
100
|
|
|
|
42
|
die "Not enough arguments: $!" |
46
|
|
|
|
|
|
|
if (! defined $regex); |
47
|
8
|
|
|
|
|
11
|
my $str = join('', @{$self->{'IO::Capture::messages'}}); |
|
8
|
|
|
|
|
34
|
|
48
|
8
|
|
|
|
|
121
|
my @matches = $str =~ m/$regex/g; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub all_screen_lines { |
52
|
26
|
|
|
26
|
0
|
6963
|
my $self = shift; |
53
|
26
|
|
|
|
|
27
|
my @screen_lines; |
54
|
26
|
|
|
|
|
28
|
@screen_lines = split(/\n/, join('', @{$self->{'IO::Capture::messages'}})); |
|
26
|
|
|
|
|
113
|
|
55
|
26
|
100
|
|
|
|
91
|
return wantarray ? @screen_lines : scalar(@screen_lines); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
########## DOCUMENTATION ########## |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 NAME |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
IO::Capture::Extended - Extend functionality of IO::Capture |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 SYNOPSIS |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
All documentation is contained in IO::Capture::Extended::Overview. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
perldoc IO::Capture::Extended::Overview |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|