File Coverage

blib/lib/CGI/File/Temp.pm
Criterion Covered Total %
statement 19 19 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 0 3 0.0
total 28 31 90.3


line stmt bran cond sub pod time code
1             # this is a back compatibility wrapper around File::Temp. DO NOT
2             # use this package outside of CGI, i won't provide any help if
3             # you use it directly and your code breaks horribly.
4             package CGI::File::Temp;
5              
6             $CGI::File::Temp::VERSION = '4.36';
7              
8 4     4   1550 use parent File::Temp;
  4         1025  
  4         16  
9 4     4   51975 use parent Fh;
  4         6  
  4         18  
10              
11             my $appease_cpants_kwalitee = q/
12             use strict;
13             use warnings;
14             #/;
15              
16             use overload
17 4         26 '""' => \&asString,
18             'cmp' => \&compare,
19 4     4   226 'fallback'=>1;
  4         4  
20              
21             # back compatibility method since we now return a File::Temp object
22             # as the filehandle (which isa IO::Handle) so calling ->handle on
23             # it will fail. FIXME: deprecate this method in v5+
24 2     2 0 447 sub handle { return shift; };
25              
26             sub compare {
27 26     26 0 943 my ( $self,$value ) = @_;
28 26         28 return "$self" cmp $value;
29             }
30              
31             sub _mp_filename {
32 97     97   100 my ( $self,$filename ) = @_;
33 97 100       145 ${*$self}->{ _mp_filename } = $filename
  18         67  
34             if $filename;
35 97         67 return ${*$self}->{_mp_filename};
  97         616  
36             }
37              
38             sub asString {
39 79     79 0 405 my ( $self ) = @_;
40 79         109 return $self->_mp_filename;
41             }
42              
43             1;
44