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.37';
7              
8 4     4   1120 use parent File::Temp;
  4         1132  
  4         21  
9 4     4   61915 use parent Fh;
  4         10  
  4         25  
10              
11             my $appease_cpants_kwalitee = q/
12             use strict;
13             use warnings;
14             #/;
15              
16             use overload
17 4         40 '""' => \&asString,
18             'cmp' => \&compare,
19 4     4   326 'fallback'=>1;
  4         10  
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 865 sub handle { return shift; };
25              
26             sub compare {
27 26     26 0 2476 my ( $self,$value ) = @_;
28 26         72 return "$self" cmp $value;
29             }
30              
31             sub _mp_filename {
32 97     97   236 my ( $self,$filename ) = @_;
33 97 100       250 ${*$self}->{ _mp_filename } = $filename
  18         117  
34             if $filename;
35 97         283 return ${*$self}->{_mp_filename};
  97         997  
36             }
37              
38             sub asString {
39 79     79 0 547 my ( $self ) = @_;
40 79         226 return $self->_mp_filename;
41             }
42              
43             1;
44