Branch Coverage

blib/lib/File/Cache.pm
Criterion Covered Total %
branch 196 342 57.3


line true false branch
143 5 8 defined $$options{'auto_remove_stale'} ? :
152 7 6 defined $$options{'username'} ? :
160 5 8 defined $$options{'filemode'} ? :
169 0 13 defined $$options{'expires_in'} ? :
177 13 0 defined $$options{'cache_key'} ? :
185 13 0 defined $$options{'namespace'} ? :
193 7 6 defined $$options{'cache_depth'} ? :
203 5 8 defined $$options{'max_size'} ? :
211 0 13 unless _VERIFY_DIRECTORY($self->_get_namespace_path) == $File::Cache::sSUCCESS
219 0 13 defined $$options{'persistence_mechanism'} ? :
257 0 326 unless defined $cache_key
268 315 11 if (-f $cache_description_path) { }
0 11 elsif (_SUBDIRECTORIES_PRESENT($cache_key) eq $File::Cache::sTRUE) { }
273 0 315 unless (defined $serialized_cache_description_ref and defined $$serialized_cache_description_ref)
312 0 11 unless defined $directory
317 11 0 unless -d $directory
319 0 0 unless opendir DIR, $directory
328 0 0 if -d $dirent
343 0 13 unless defined $cache_key
346 0 13 unless defined $cache_description
349 0 13 unless defined $filemode
397 0 945 unless $key and $value
419 11 2 unless defined $existing_cache_description
422 0 2 if ($$existing_cache_description{'Cache Object Version'} > $File::Cache::CACHE_OBJECT_VERSION)
432 0 2 if ($$existing_cache_description{'Persistence Mechanism'} ne $self->get_persistence_mechanism)
476 0 73 unless defined $identifier
492 9 64 if (defined $expires_in) { }
0 64 elsif ($global_expires_in ne $File::Cache::sEXPIRES_NEVER) { }
493 0 9 $expires_in eq $File::Cache::sEXPIRES_NEVER ? :
516 70 3 if ($max_size != $File::Cache::sNO_MAX_SIZE)
518 0 70 if $new_size < 0
539 13 0 if ($self->get_persistence_mechanism eq 'Storable') { }
0 0 elsif ($self->get_persistence_mechanism eq 'Data::Dumper') { }
568 0 73 unless defined $data_reference
571 0 73 unless defined $persistence_mechanism
574 73 0 if ($persistence_mechanism eq 'Storable') { }
594 0 313 unless defined $data_reference
597 0 313 unless defined $persistence_mechanism
600 313 0 if ($persistence_mechanism eq 'Storable') { }
616 0 0 if ($errors or $@)
636 0 28 unless defined $data_reference
639 0 28 unless defined $persistence_mechanism
644 28 0 if ($persistence_mechanism eq 'Storable') { }
646 5 23 ref $data_reference ? :
651 0 0 if (ref $data_reference) { }
675 0 38 unless defined $identifier
692 0 3 unless defined $identifier
709 0 41 unless defined $identifier
712 0 41 unless defined $freshness
728 34 7 if ($object_data)
736 31 3 if ($freshness eq $File::Cache::sGET_FRESH_ONLY) { }
740 6 25 if (_S_SHOULD_EXPIRE($expires_at)) { }
747 0 6 if ($auto_remove_stale eq $File::Cache::sTRUE)
748 0 0 unless _REMOVE_CACHED_FILE($cached_file_path)
765 3 0 if (_S_SHOULD_EXPIRE($expires_at))
787 0 3 unless defined $identifier
794 0 3 unless _REMOVE_CACHED_FILE($cached_file_path)
808 0 126 unless defined $identifier
811 0 126 unless my $unique_key = md5_hex($identifier)
829 0 13 unless defined $directory
839 0 13 unless defined $directory
841 13 0 if -d $directory and -w $directory
855 0 1975 unless defined $directory
861 0 1975 unless @directories
875 0 86 unless defined $directory
880 86 0 if (defined $mask)
890 0 86 unless -d $directory
893 86 0 if defined $mask
908 0 320 unless defined $cached_file_path
913 313 7 if (-f $cached_file_path) { }
919 0 313 unless ($frozen_object_data)
930 0 313 unless defined $cache_key
935 0 313 unless defined $cache_description
954 0 313 unless defined $directory
964 1869 0 if defined $directory
979 0 18 unless defined $cached_file_path
990 18 0 if (-f $cached_file_path)
1014 0 3 unless -e $namespace_path
1016 0 3 unless _RECURSIVELY_REMOVE_DIRECTORY($namespace_path)
1053 90 300 if (-f $file and $file ne $sCACHE_DESCRIPTION_FILENAME) { }
1069 0 90 unless defined $cached_file_path
1074 90 0 if ($object_data)
1078 3 87 if (_S_SHOULD_EXPIRE($expires_at))
1079 0 3 unless _REMOVE_CACHED_FILE($cached_file_path)
1096 0 124 unless defined $expires_at
1103 0 124 if ($expires_at == $File::Cache::sEXPIRES_NOW) { }
106 18 elsif ($expires_at == $File::Cache::sEXPIRES_NEVER) { }
12 6 elsif ($time >= $expires_at) { }
1124 0 75 unless $new_size >= 0
1133 0 12 unless ($victim_file)
1138 0 12 unless _REMOVE_CACHED_FILE($victim_file)
1154 0 0 unless $new_size >= 0
1163 0 0 unless (defined $victim_file)
1168 0 0 unless _REMOVE_CACHED_FILE($victim_file)
1187 0 12 unless defined $root_directory
1195 6 6 if defined $nearest_expiration_path
1203 6 0 if defined $latest_accessed_path
1218 0 552 unless defined $directory
1227 0 552 unless opendir DIR, $directory
1234 1104 720 if $dirent eq '.' or $dirent eq '..'
1242 540 180 if (-d $path) { }
1263 522 198 unless defined $nearest_expiration_path_candidate
1265 0 198 unless defined $nearest_expiration_time_candidate
1269 174 24 if $nearest_expiration_time_candidate == $File::Cache::sEXPIRES_NEVER
1274 24 0 if (not defined $best_nearest_expiration_time or $best_nearest_expiration_time > $nearest_expiration_time_candidate)
1301 0 180 unless defined $path
1329 0 261 unless defined $directory
1338 0 261 unless opendir DIR, $directory
1345 522 345 if $dirent eq '.' or $dirent eq '..'
1346 0 345 if $dirent eq $sCACHE_DESCRIPTION_FILENAME
1354 255 90 if (-d $path) { }
1370 6 339 unless defined $latest_accessed_path_candidate
1372 0 339 unless defined $latest_accessed_time_candidate
1377 258 81 if (not defined $best_latest_accessed_time or $best_latest_accessed_time > $latest_accessed_time_candidate)
1407 16 125 unless -e $namespace_path
1421 0 126 unless defined $unique_key
1452 0 73 unless defined $unique_key
1473 0 126 unless defined $unique_key
1476 0 126 unless defined $cache_depth
1496 0 9302 if (grep /\.\./, @elements)
1515 0 628 unless defined $filename
1520 0 628 unless open FILE, $filename
1543 0 86 unless defined $filename
1546 0 86 unless defined $data_ref
1549 0 86 unless defined $mode
1558 13 73 if $new_umask
1560 13 73 if $new_umask
1566 0 86 unless open FILE, ">$temp_filename"
1579 0 86 unless rename $temp_filename, $filename
1582 13 73 if $old_umask
1597 3 9 unless (-d $cache_key)
1604 0 9 unless _RECURSIVELY_REMOVE_DIRECTORY($cache_key)
1623 0 3 unless (-d $cache_key)
1642 0 3 unless -e $cache_key
1657 0 3383 unless defined $directory
1664 0 3383 unless opendir DIR, $directory
1671 6766 4382 if $dirent eq '.' or $dirent eq '..'
1675 3255 1127 if (-d $path) { }
1679 1124 3 if $dirent ne $sCACHE_DESCRIPTION_FILENAME
1705 6 0 if ($success and $username) { }
1732 0 5853 unless defined $untainted_regex
1735 0 5853 unless defined $string
1740 0 5853 if (not defined $untainted_string or $untainted_string ne $string)
1754 0 0 unless my $tmpdir = tmpdir()
1772 0 195 unless -d $root
1775 0 195 unless opendir DIR, $root
1780 0 195 unless closedir DIR
1785 390 243 if $dirent eq '.' or $dirent eq '..'
1791 183 60 if (-d $path_to_dirent) { }
1794 0 60 unless unlink $path_to_dirent
1800 0 195 unless rmdir $root
1826 0 13 unless defined $auto_remove_stale
1854 0 13 unless defined $cache_key
1861 0 13 if ((caller 1)[3] ne 'File::Cache::new')
1863 0 0 unless _VERIFY_DIRECTORY($self->_get_namespace_path) == $File::Cache::sSUCCESS
1920 0 13 unless defined $namespace
1927 0 13 if ((caller 1)[3] ne 'File::Cache::new')
1929 0 0 unless _VERIFY_DIRECTORY($self->_get_namespace_path) == $File::Cache::sSUCCESS
1954 0 13 unless $global_expires_in > 0 or $global_expires_in == $File::Cache::sEXPIRES_NEVER or $global_expires_in == $File::Cache::sEXPIRES_NOW
1981 6 0 if ($object_data) { }
2010 3 0 if ($object_data) { }
2040 0 13 unless defined $username
2047 0 13 if ((caller 1)[3] ne 'File::Cache::new')
2049 0 0 unless _VERIFY_DIRECTORY($self->_get_namespace_path) == $File::Cache::sSUCCESS
2074 0 13 unless defined $filemode
2099 0 13 unless $max_size > 0 or $max_size == $File::Cache::sNO_MAX_SIZE
2106 5 8 if ($max_size != $File::Cache::sNO_MAX_SIZE)
2130 0 13 unless $cache_depth >= 0
2155 0 13 unless defined $persistence_mechanism
2160 0 13 if ((caller 1)[3] ne 'File::Cache::new')
2165 0 13 unless $persistence_mechanism eq 'Storable' or $persistence_mechanism eq 'Data::Dumper'