| 1 | #=============================================== | ||||||||||
| 2 | package Banal::Utils::File; | ||||||||||
| 3 | |||||||||||
| 4 | 2 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | require Exporter; | |||||||||
| 6 | |||||||||||
| 7 | 2 | @ISA = qw(Exporter); | |||||||||
| 8 | 2 | @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 | 0 | ▶ | sub slurp_file { | ||||||||
|
Subroutine
slurp_file: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 20 | 0 | my $file = shift; | |||||||||
| 21 | |||||||||||
| 22 | 0 | local( $/ ) ; | |||||||||
| 23 | 0 | ▶ | open( my $fh, $file ) or die __PACKAGE__ . " : slurp_file : Can't open file $file\n"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 0 | return <$fh>; | |||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | |||||||||||
| 28 | 2 | 1; | |||||||||
| 29 | |||||||||||
| 30 | |||||||||||
| 31 | __END__ | ||||||||||