Branch Coverage

blib/lib/App/Fetchware.pm
Criterion Covered Total %
branch 202 468 43.1


line true false branch
307 0 1276 unless defined $name
312 0 287 unless ($one_or_many_values eq 'ONE' or $one_or_many_values eq 'ONEARRREF' or $one_or_many_values eq 'MANY' or $one_or_many_values eq 'BOOLEAN')
324 724 552 if ($one_or_many_values eq 'ONE') { }
265 287 elsif ($one_or_many_values eq 'ONEARRREF') { }
68 219 elsif ($one_or_many_values eq 'MANY') { }
219 0 elsif ($one_or_many_values eq 'BOOLEAN') { }
353 0 724 unless eval $eval
0 2 if defined config('fetchware_db_path')
1 1 if (not @_) { }
0 171 if defined config('filter')
170 1 if (not @_) { }
0 2 if defined config('gpg_keys_url')
1 1 if (not @_) { }
0 2 if defined config('gpg_sig_url')
1 1 if (not @_) { }
0 2 if defined config('lookup_method')
1 1 if (not @_) { }
0 171 if defined config('lookup_url')
170 1 if (not @_) { }
0 2 if defined config('md5_url')
1 1 if (not @_) { }
0 2 if defined config('prefix')
1 1 if (not @_) { }
0 171 if defined config('program')
170 1 if (not @_) { }
0 2 if defined config('sha1_url')
1 1 if (not @_) { }
0 5 if defined config('temp_dir')
4 1 if (not @_) { }
0 2 if defined config('user')
1 1 if (not @_) { }
0 0 if defined config('user_agent')
0 0 if (not @_) { }
0 171 if defined config('verify_method')
170 1 if (not @_) { }
0 0 if defined config('a')
0 0 if (not @_) { }
0 0 if defined config('a')
0 0 if (not @_) { }
0 0 if defined config('a')
0 0 if (not @_) { }
0 0 if defined config('b')
0 0 if (not @_) { }
0 0 if defined config('b')
0 0 if (not @_) { }
0 0 if defined config('b')
0 0 if (not @_) { }
0 0 if defined config('c')
0 0 if (not @_) { }
0 0 if defined config('c')
0 0 if (not @_) { }
0 0 if defined config('c')
0 0 if (not @_) { }
0 1 if defined config('conf_sub0')
1 0 if (not @_) { }
0 1 if defined config('conf_sub0')
1 0 if (not @_) { }
0 1 if defined config('conf_sub0')
1 0 if (not @_) { }
0 1 if defined config('conf_sub1')
1 0 if (not @_) { }
0 1 if defined config('conf_sub1')
1 0 if (not @_) { }
0 1 if defined config('conf_sub1')
1 0 if (not @_) { }
0 1 if defined config('conf_sub2')
1 0 if (not @_) { }
0 1 if defined config('conf_sub2')
1 0 if (not @_) { }
0 1 if defined config('conf_sub2')
1 0 if (not @_) { }
380 0 265 unless eval $eval
0 2 if defined config('build_commands')
1 1 if (not @_) { }
0 2 if defined config('configure_options')
1 1 if (not @_) { }
0 2 if defined config('install_commands')
1 1 if (not @_) { }
0 2 if defined config('make_options')
1 1 if (not @_) { }
0 2 if defined config('uninstall_commands')
1 1 if (not @_) { }
403 0 68 unless eval $eval
174 2 if (not @_) { }
444 0 219 unless eval $eval
1 6 if defined config('no_install')
0 7 if ($value =~ /false/i) { }
1 6 elsif ($value =~ /off/i) { }
5 2 if (not @_) { }
1 3 if defined config('stay_root')
0 4 if ($value =~ /false/i) { }
1 3 elsif ($value =~ /off/i) { }
2 2 if (not @_) { }
2 3 if defined config('user_keyring')
1 3 if ($value =~ /false/i) { }
1 3 elsif ($value =~ /off/i) { }
3 1 if (not @_) { }
1 3 if defined config('verify_failure_ok')
1 3 if ($value =~ /false/i) { }
1 3 elsif ($value =~ /off/i) { }
3 1 if (not @_) { }
897 1 1 if (&blessed($edited_fetchwarefile) and $edited_fetchwarefile->isa('App::Fetchware::Fetchwarefile')) { }
927 1 4 if (not defined $extension_name) { }
1 3 elsif (defined $extension_name and defined shift()) { }
965 1 0 unless defined $fetchwarefile_name
971 0 1 unless (defined $fetchwarefile_name_value)
978 0 1 defined shift @_ ? :
1046 1 0 unless (eval { do { my $directory_listing = no_mirror_download_dirlist($lookup_url); config('lookup_url', $lookup_url); $filename_listing = parse_directory_listing($directory_listing); __clear_CONFIG(); 1 } })
1072 0 1 unless (eval { do { my $dir_list = no_mirror_download_dirlist($lookup_url); config('lookup_url', $lookup_url); $filename_listing = parse_directory_listing($dir_list); __clear_CONFIG(); 1 } })
1116 0 1 if ($term->ask_yn('print_me', "In addition to the one required mirror that you must define in order for\nfetchware to function properly, you may specify additonal mirros that fetchware\nwill use if the mirror you've already specified is unreachable or download\nattempts using that mirror fail.\n", 'prompt', 'Would you like to add any additional mirrors? ', 'default', 'n'))
1144 0 1 if ($mirror_or_done eq 'done') { }
1166 0 1 if ($file_and_timestamp->[0] =~ /\.(asc|sig|sign)$/) { }
1 0 elsif ($file_and_timestamp->[0] =~ /\.sha1?$/) { }
0 1 elsif ($file_and_timestamp->[0] =~ /\.md5$/) { }
1177 1 0 if (exists $available_verify_methods{'gpg'} and defined $available_verify_methods{'gpg'} and $available_verify_methods{'gpg'} > 0)
1187 0 1 if (grep {$_->[0] eq 'KEYS';} @$filename_listing) { }
1206 0 1 if ($term->ask_yn('prompt', q[Would you like to import the author's key yourself after fetchware completes? ], 'default', 'n', 'print_me', "Automatic KEYS file discovery failed. Fetchware needs the author's keys to\ndownload and import into its own keyring, or you may specify the option\nuser_keyring, which if true will cause fetchware to use the user who runs\nfetchware's keyring instead of fetchware's own keyring. But you, the user, needs\nto import the author's keys into your own gpg keyring. You can do this now in a\nseparate shell, or after you finish configuring this Fetchwarefile. Just run the\ncommand [gpg --import ].\n"))
1233 1 0 unless ($verify_configed_flag == 1)
1234 0 1 if (exists $available_verify_methods{'sha1'} and defined $available_verify_methods{'sha1'} and $available_verify_methods{'sha1'} > 0) { }
0 1 elsif (exists $available_verify_methods{'md5'} and defined $available_verify_methods{'md5'} and $available_verify_methods{'md5'} > 0) { }
1257 0 1 if ($term->ask_yn('prompt', "Would you like fetchware to ignore the fact that it is unable to verify the\nauthenticity of any downloads it makes? Are you ok with possibly downloading\nviruses, worms, rootkits, or any other malware, and installing it possibly even\nas root? \n", 'default', 'n', 'print_me', "Automatic verification of your fetchware package has failed! Fetchware is\ncapable of ignoring the error, and installing software packages anyway using its\nverify_failure_ok configuration option. However, installing software packages\nwithout verifying that they have not been tampered with could allow hackers to\npotentially install malware onto your computer. Don't think this is *not*\npossible or do you think its extremely unlikely? Well, it's actually\nsurprisingly common:\n 1. http://arstechnica.com/security/2012/09/questions-abound-as-malicious-phpmyadmin-backdoor-found-on-sourceforge-site/\n Discusses how a mirror for sourceforge was hacked, and the phpMyAdmin\n software package on that mirror was modified to spread malware.\n 2. http://www.geek.com/news/major-open-source-code-repository-hacked-for-months-says-fsf-551344/\n Discusses how FSF's gnu.org ftp download site was hacked.\n 3. http://arstechnica.com/security/2012/11/malicious-code-added-to-open-source-piwik-following-website-compromise/\n Discusses how Piwiki's wordpress software was hacked, and downloads of\n Piwiki had malicious code inserted into them.\n 4. http://www.theregister.co.uk/2011/03/21/php_server_hacked/\n Discusses how php's wiki.php.org server was hacked yielding credentials to\n php's source code repository.\nDownload mirrors *do* get hacked. Do not make the mistake, and think that it is\nnot possible. It is possible, and it does happen, so please properly configure\nyour Fetchwarefile to enable fetchware to verify that the downloaded software is\nthe same what the author uploaded.\n")) { }
1324 0 0 if (grep {$_->[0] =~ /^(CURRENT|LATEST)[_-]IS[_-].+/;} @$filename_listing) { }
1403 0 0 if ($term->ask_yn('prompt', 'Would you like to add extra configuration options to your fetchwarefile?', 'default', 'n', 'print_me', "Fetchware has many different configuration options that allow you to control its\nbehavior, and even change its behavior if needed to customize fetchware for any\npossible source code distribution.\n\nIf you think you need to add configuration options please check out perldoc\nfetchware for more details on fetchware and its Fetchwarefile configuration\noptions.\n\nIf this is your first package your creating with Fetchware or you're creating a\npackage for a new program for the first time, you should skip messing with\nfetchware's more flexible options, and just give the defaults a chance.\n"))
1451 0 0 if ($term->ask_yn('print_me', "Fetchware has now asked you all of the needed questions to determine what it\nthinks your new program's Fetchwarefile should look like. But it's not perfect,\nand perhaps you would like to tweak it manually. If you would like to edit it\nmanually in your favorite editor, answer 'yes', and if you want to skip this just\nanswer 'no', or just press .\n\nIf you would like to cancel any edits you have made, and use the automagically\ngenerated Fetchwarefile, just delete the entire contents of the file, and save\nan empty file.\n", 'prompt', 'Would you like to edit your automagically generated Fetchwarefile manually? ', 'default', 'n'))
1493 0 0 if (not -z $fetchwarefile_filename) { }
1544 0 0 if ($term->ask_yn('print_me', "It is recommended that fetchware go ahead and install the package based on the\nFetchwarefile that fetchware has created for you. If you don't want to install\nit now, then enter 'no', but if you want to test your Fetchwarefile now, and\ninstall it, then please enter 'yes' or just press .\n", 'prompt', 'Would you like to install the package you just created a Fetchwarefile for? ', 'default', 'y')) { }
1590 0 0 if (-e $fetchwarefile_filename)
1603 0 0 unless -e $fetchwarefile_filename
1638 0 173 if (config('temp_dir'))
1645 1 172 if (config('no_install'))
1702 0 0 if (config('lookup_url') =~ m[^ftp://]) { }
0 0 elsif (config('lookup_url') =~ m[^http://]) { }
0 0 elsif (config('lookup_url') =~ m[^file://]) { }
1721 0 0 if (defined config('lookup_method') and config('lookup_method') eq 'timestamp') { }
0 0 elsif (defined config('lookup_method') and config('lookup_method') eq 'versionstring') { }
1797 0 0 if ($year_or_time =~ /\d\d:\d\d/) { }
0 0 elsif ($year_or_time =~ /\d\d\d\d/) { }
1836 0 0 if ($link =~ /(\.(tar\.(gz|bz2|xz)|(tgz|tbz2|txz))|(asc|md5|sha.?))|KEYS$/)
1842 0 0 if (my $rh = $h->right) { }
1844 0 0 if (&blessed($rh)) { }
1859 0 0 if (&looks_like_number($month)) { }
1913 0 45 unless my($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat $file
1965 10 66 if (@iversionstring == 0)
1988 0 9 if @versionstrings == 0
2007 56 104 if ($#{$b;} > $#{$a;}) { }
2022 9 386 if $x > $#{$b;}
2023 34 352 if $x > $#{$a;}
2029 87 265 if $spaceship_result != 0
2064 0 0 if (defined config('filter'))
2072 0 0 if ($^O ne 'MSWin32')
2082 0 0 if defined $latest_version
2090 0 0 if ($fl->[0] =~ /\.tar\.xz$/) { }
0 0 elsif ($fl->[0] =~ /\.txz$/) { }
0 0 elsif ($fl->[0] =~ /\.tar\.bz2$/) { }
0 0 elsif ($fl->[0] =~ /\.tbz$/) { }
0 0 elsif ($fl->[0] =~ /\.tar\.gz$/) { }
0 0 elsif ($fl->[0] =~ /\.tgz$/) { }
0 0 elsif ($fl->[0] =~ /\.zip$/) { }
0 0 elsif ($fl->[0] =~ /\.fpkg$/) { }
2135 0 1 if $download_path =~ m[(?:http|ftp|file)://]
2181 0 0 if (not defined config('verify_method')) { }
0 0 elsif (config('verify_method') =~ /gpg/i) { }
0 0 elsif (config('verify_method') =~ /sha1?/i) { }
0 0 elsif (config('verify_method') =~ /md5/i) { }
2189 0 0 if ($gpg_err)
2198 0 0 if (not $retval or $gpg_err)
2204 0 0 if ($sha_err)
2213 0 0 if (not $retval or $sha_err)
2219 0 0 if ($md5_err)
2229 0 0 if (not $retval or $md5_err)
2230 0 0 unless config('verify_failure_ok')
2237 0 0 if (config('verify_failure_ok'))
2259 0 0 unless config('verify_failure_ok')
2269 0 0 unless config('verify_failure_ok')
2279 0 0 unless config('verify_failure_ok')
2317 0 0 unless (config('user_keyring') or -e './pubring.gpg' and -e './secring.gpg')
2320 0 0 if (defined config('gpg_keys_url')) { }
2326 0 0 if $@
2339 0 0 unless eval { do { if (config('user_keyring')) { run_prog('gpg', '--import', $keys_file); } else { run_prog('gpg', '--homedir', '.', '--import', $keys_file); } ; 1 } }
2341 0 0 if (config('user_keyring')) { }
2368 0 0 if defined $sig_file
2370 0 0 unless defined $sig_file
2436 0 0 if (config('user_keyring')) { }
2474 0 0 if (defined config("${digest_ext}_url")) { }
2490 0 0 if ($@)
2514 0 0 if ($digest_type eq 'MD5') { }
0 0 elsif ($digest_type eq 'SHA-1') { }
2533 0 0 if ($@)
2540 0 0 unless close $package_fh
2554 0 0 if /^\s+$/
2564 0 0 unless defined $checksum
2566 0 0 if ($checksum eq $calculated_digest) { }
0 0 elsif ("$checksum=" eq $calculated_digest) { }
2622 49 0 if ($package_path =~ /\.(t(gz|bz|xz|Z))|(tar\.(gz|bz2|xz|Z))|.fpkg$/) { }
0 0 elsif ($package_path =~ /\.zip$/) { }
2652 0 49 unless defined $tar_iter
2686 0 0 if (($zip_error = $zip->read($path_to_zip_archive)) ne 0)
2713 49 0 if $format eq 'tar'
2714 0 49 if $format eq 'zip'
2727 0 49 if (not $extracted_files[0]) { }
2745 0 0 if (($zip_error = $zip->read($path_to_zip_archive)) ne 0)
2752 0 0 if (($zip_error = $zip->extractTree) ne 0) { }
2775 49 161 if $path eq './Fetchwarefile'
2776 1 160 if (file_name_is_absolute($path))
2795 49 111 unless @dirs
2804 0 51 if $i > 1
2828 0 0 unless chdir $build_path
2835 0 0 if (defined config('build_commands')) { }
0 0 elsif (defined config('configure_options') or defined config('prefix') or defined config('make_options')) { }
2846 0 0 if defined config('configure_options')
2851 0 0 if (defined config('make_options')) { }
2885 3 3 if ($star_command =~ /,\s*/) { }
2905 0 49 if (config('configure_options'))
2912 0 49 if (config('prefix'))
2913 0 0 if ($configure =~ /--prefix/) { }
2941 0 88 if (config('no_install'))
2952 0 88 if (defined config('install_commands')) { }
2956 0 88 if (defined config('make_options')) { }
2986 139 0 unless (dir(cwd())->dir_list(-1, 1) eq $path)
2987 0 139 unless chdir $path
3014 0 49 if (defined config('uninstall_commands')) { }
3025 0 49 if (defined config('make_options')) { }
3077 3 6 if $upgrade_name_basename eq $download_path_basename
3090 3 3 if ($sorted_file_names->[0][0] eq $download_path_basename and $sorted_file_names->[0][0] ne $upgrade_name_basename) { }
3148 1 1033 unless ref $AnB eq 'ARRAY'
3152 1 1032 unless @$AnB == 2
3157 173 859 if ($type eq 'BothAreDefined') { }
515 344 elsif ($type eq 'Mandatory') { }
344 0 elsif ($type eq 'ConfigOptionEnum') { }
3193 1 172 if (@A_defined > 0 and @B_defined > 0)
3208 1 514 unless defined config($option)
3224 171 173 if (config($option))
3228 1 170 unless grep({config($option) eq $_;} @$enumerations) == 1
3272 1 1 unless 'App::Fetchware'->can($sub_to_hook)