line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#=============================================== |
2
|
|
|
|
|
|
|
package Banal::Utils::File; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
1016
|
use utf8; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
5
|
|
|
|
|
|
|
require Exporter; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
8
|
|
|
|
|
|
|
@EXPORT_OK = qw(slurp_file); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
##############################################################################" |
13
|
|
|
|
|
|
|
# Utility functions |
14
|
|
|
|
|
|
|
##############################################################################" |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#------------------------------------------------------------ |
17
|
|
|
|
|
|
|
# Slurps an entire file into memory and returns the resulting string |
18
|
|
|
|
|
|
|
#------------------------------------------------------------- |
19
|
|
|
|
|
|
|
sub slurp_file { |
20
|
0
|
|
|
0
|
1
|
|
my $file = shift; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
local( $/ ) ; |
23
|
0
|
0
|
|
|
|
|
open( my $fh, $file ) or die __PACKAGE__ . " : slurp_file : Can't open file $file\n"; |
24
|
0
|
|
|
|
|
|
return <$fh>; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |