line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IRC::Indexer::Output; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
27
|
use 5.10.1; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
97
|
|
4
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
66
|
|
5
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
206
|
|
6
|
2
|
|
|
2
|
|
13
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
162
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
13
|
use Scalar::Util qw/openhandle/; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
823
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
5
|
|
|
5
|
1
|
3029
|
my $class = shift; |
12
|
5
|
|
|
|
|
11
|
my $self = {}; |
13
|
5
|
|
|
|
|
13
|
bless $self, $class; |
14
|
|
|
|
|
|
|
|
15
|
5
|
|
|
|
|
47
|
my %args = @_; |
16
|
|
|
|
|
|
|
|
17
|
5
|
|
|
|
|
34
|
$args{lc $_} = delete $args{$_} for keys %args; |
18
|
|
|
|
|
|
|
|
19
|
5
|
|
33
|
|
|
47
|
$self->{Input} = delete $args{input} |
20
|
|
|
|
|
|
|
|| croak "No input specified in new" ; |
21
|
|
|
|
|
|
|
|
22
|
5
|
|
|
|
|
44
|
return $self |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub dump { |
26
|
2
|
|
|
2
|
1
|
4
|
my ($self) = @_; |
27
|
2
|
|
|
|
|
6
|
my $output = $self->{Output}; |
28
|
2
|
|
|
|
|
14
|
return $output |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub write { |
32
|
0
|
|
|
0
|
1
|
|
my ($self, $path) = @_; |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
unless ($path) { |
35
|
0
|
|
|
|
|
|
croak "write() called but no path specified" ; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $out; |
39
|
0
|
0
|
|
|
|
|
unless ($out = $self->{Output}) { |
40
|
0
|
|
|
|
|
|
croak "write() called but no Output to write" ; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
0
|
0
|
|
|
|
|
if ( openhandle($path) ) { |
44
|
0
|
|
|
|
|
|
print $path $out; |
45
|
|
|
|
|
|
|
} else { |
46
|
0
|
0
|
|
|
|
|
open my $fh, '>:encoding(utf8)', $path |
47
|
|
|
|
|
|
|
or croak "open failed in write(): $!"; |
48
|
0
|
|
|
|
|
|
print $fh $out; |
49
|
0
|
|
|
|
|
|
close $fh; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
__END__ |