| 1 | package App::PRT::Collector::FileHandle; | ||
| 2 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 3 | ▶ | use File::Temp qw(tempdir tempfile); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 5 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 7 | 5 | my ($class, $input_fh) = @_; | |
| 8 | |||
| 9 | 5 | bless { | |
| 10 | input_fh => $input_fh, | ||
| 11 | }, $class; | ||
| 12 | } | ||
| 13 | |||
| 14 | 3 | ▶ | sub collect { |
|
Subroutine
collect: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 15 | 3 | my ($self) = @_; | |
| 16 | |||
| 17 | 3 | my $input_fh = $self->{input_fh}; | |
| 18 | 3 | my $content = do { local $/; <$input_fh> }; | |
| 19 | |||
| 20 | 3 | my $dir = tempdir( CLEANUP => 1 ); | |
| 21 | |||
| 22 | 3 | my ($fh, $file) = tempfile('prt-XXXX', DIR => $dir, SUFFIX => '.pm'); | |
| 23 | 3 | $self->{dir} = $dir; | |
| 24 | 3 | $self->{file} = $file; | |
| 25 | |||
| 26 | 3 | print $fh $content; | |
| 27 | 3 | close $fh; | |
| 28 | |||
| 29 | 3 | [ $file ]; | |
| 30 | } | ||
| 31 | |||
| 32 | 3 | 1; | |