| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package CPAN::Packager::FileUtil; |
|
2
|
3
|
|
|
3
|
|
17
|
use strict; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
126
|
|
|
3
|
3
|
|
|
3
|
|
20
|
use warnings; |
|
|
3
|
|
|
|
|
10
|
|
|
|
3
|
|
|
|
|
107
|
|
|
4
|
3
|
|
|
3
|
|
19
|
use base qw(Exporter); |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
378
|
|
|
5
|
3
|
|
|
3
|
|
20
|
use File::Spec; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
73
|
|
|
6
|
3
|
|
|
3
|
|
1045
|
use IO::File (); |
|
|
3
|
|
|
|
|
10807
|
|
|
|
3
|
|
|
|
|
1067
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT = qw(file dir openw slurp openr); |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub file { |
|
11
|
0
|
|
|
0
|
0
|
|
File::Spec->catfile(@_); |
|
12
|
|
|
|
|
|
|
} |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub dir { |
|
15
|
0
|
|
|
0
|
0
|
|
File::Spec->catfile(@_); |
|
16
|
|
|
|
|
|
|
} |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub openw { |
|
19
|
0
|
|
|
0
|
0
|
|
my $file = shift; |
|
20
|
0
|
|
|
|
|
|
my $io = IO::File->new; |
|
21
|
0
|
0
|
|
|
|
|
$io->open($file, 'w') or die "Can't write $file: $!"; |
|
22
|
0
|
|
|
|
|
|
return $io; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub openr { |
|
26
|
0
|
|
|
0
|
0
|
|
my $file = shift; |
|
27
|
0
|
|
|
|
|
|
my $io = IO::File->new; |
|
28
|
0
|
0
|
|
|
|
|
$io->open($file, 'r') or die "Can't read $file: $!"; |
|
29
|
0
|
|
|
|
|
|
return $io; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub slurp { |
|
34
|
0
|
|
|
0
|
0
|
|
my ($file, $args) = @_; |
|
35
|
0
|
|
|
|
|
|
my $fh = openr($file); |
|
36
|
0
|
0
|
|
|
|
|
if ($args->{chomp}) { |
|
37
|
0
|
|
|
|
|
|
chomp( my @data = <$fh> ); |
|
38
|
0
|
0
|
|
|
|
|
return wantarray ? @data : join '', @data; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
|
local $/ unless wantarray; |
|
42
|
0
|
|
|
|
|
|
return <$fh>; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
|
46
|
|
|
|
|
|
|
__END__ |