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.35_01';
7              
8 4     4   1435 use parent File::Temp;
  4         948  
  4         17  
9 4     4   50363 use parent Fh;
  4         7  
  4         14  
10              
11             my $appease_cpants_kwalitee = q/
12             use strict;
13             use warnings;
14             #/;
15              
16             use overload
17 4         25 '""' => \&asString,
18             'cmp' => \&compare,
19 4     4   224 'fallback'=>1;
  4         5  
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 389 sub handle { return shift; };
25              
26             sub compare {
27 26     26 0 861 my ( $self,$value ) = @_;
28 26         28 return "$self" cmp $value;
29             }
30              
31             sub _mp_filename {
32 97     97   92 my ( $self,$filename ) = @_;
33 97 100       148 ${*$self}->{ _mp_filename } = $filename
  18         66  
34             if $filename;
35 97         72 return ${*$self}->{_mp_filename};
  97         500  
36             }
37              
38             sub asString {
39 79     79 0 300 my ( $self ) = @_;
40 79         93 return $self->_mp_filename;
41             }
42              
43             1;
44