File Coverage

blib/lib/Win32/Mock/Win32/File.pm
Criterion Covered Total %
statement 21 21 100.0
branch n/a
condition 1 2 50.0
subroutine 7 7 100.0
pod 0 2 0.0
total 29 32 90.6


line stmt bran cond sub pod time code
1             package # hide from PAUSE
2             Win32::File;
3 2     2   2018 use strict;
  2         5  
  2         69  
4 2     2   10 use warnings;
  2         4  
  2         51  
5 2     2   10 use Exporter ();
  2         5  
  2         72  
6              
7             use constant {
8 2         393 READONLY => 0x00000001, # FILE_ATTRIBUTE_READONLY
9             HIDDEN => 0x00000002, # FILE_ATTRIBUTE_HIDDEN
10             #LABEL => 0x00000008, # FILE_ATTRIBUTE_LABEL /* Not in Windows API */
11             SYSTEM => 0x00000004, # FILE_ATTRIBUTE_SYSTEM
12             DIRECTORY => 0x00000010, # FILE_ATTRIBUTE_DIRECTORY
13             ARCHIVE => 0x00000020, # FILE_ATTRIBUTE_ARCHIVE
14             NORMAL => 0x00000080, # FILE_ATTRIBUTE_NORMAL
15             TEMPORARY => 0x00000100, # FILE_ATTRIBUTE_TEMPORARY
16             COMPRESSED => 0x00000800, # FILE_ATTRIBUTE_COMPRESSED
17             #xxxxxxxxxx => 0x00000200, # FILE_ATTRIBUTE_ATOMIC_WRITE
18             #xxxxxxxxxx => 0x00000400, # FILE_ATTRIBUTE_XACTION_WRITE
19             OFFLINE => 0x00001000, # FILE_ATTRIBUTE_OFFLINE
20 2     2   9 };
  2         11  
21              
22             {
23 2     2   11 no strict;
  2         4  
  2         433  
24             $VERSION = '0.01';
25             @ISA = qw(Exporter);
26             @EXPORT = qw(
27             ARCHIVE COMPRESSED DIRECTORY HIDDEN LABEL
28             NORMAL OFFLINE READONLY SYSTEM TEMPORARY
29             );
30             @EXPORT_OK = qw(
31             GetAttributes SetAttributes
32             );
33             }
34              
35             my %file_attrs = ();
36              
37             sub GetAttributes {
38 2     2 0 22 my ($file, $attr) = @_;
39 2   50     14 $_[1] = $file_attrs{$file} ||= NORMAL;
40 2         9 return 1
41             }
42              
43             sub SetAttributes {
44 2     2 0 327 my ($file, $attr) = @_;
45 2         9 $file_attrs{$file} = $attr;
46 2         9 return 1
47             }
48              
49              
50             1
51              
52             __END__