CPAN-Testers-ParseReport

 view release on metacpan or  search on metacpan

lib/CPAN/Testers/ParseReport.pm  view on Meta::CPAN

                    if ($v =~ /^'(.*)'$/) {
                        $v = $1;
                    }
                    $v =~ s/^\s+//;
                    $v =~ s/\s+$//;
                    if ($qr && $ck =~ $qr) {
                        $extract{$ck} = $v;
                    } elsif ($conf_vars{$ck}) {
                        $extract{$ck} = $v;
                    }
                }
            }
        }
        if ($in_prg_output) {
            unless ($extract{"meta:output_from"}) {
                if (/Output from (.+):$/) {
                    $extract{"meta:output_from"} = $1
                }
            }

            # Parsing of Module::Versions::Report text in test output
            if (/Modules in memory:/) {
                $expect_module_versions_report = 1;
                next LINE;
            }
            elsif ($expect_module_versions_report) {
                if (/\s+(\S+)(?:\s+(v\d\S+?))?;/) {
                    $extract{"mod:$1"} = defined $2 ? $2 : 'undef';
                    next LINE;
                }
                elsif (/\[at .+?\]/) {
                    # trailing timestamp
                    $expect_module_versions_report = 0;
                    next LINE;
                }
            }
        }
        if ($in_env_context) {
            if ($extract{"meta:writer"} =~ /^CPANPLUS\b/
                ||
                exists $extract{"env:PERL5_CPANPLUS_IS_VERSION"}
               ) {
                (
                 s/Perl:\s+\$\^X/\$^X/
                 ||
                 s/EUID:\s+\$>/\$EUID/
                 ||
                 s/UID:\s+\$</\$UID/
                 ||
                 s/EGID:\s+\$\)/\$EGID/
                 ||
                 s/GID:\s+\$\(/\$GID/
                )
            }
            if (my($left,$right) = /^\s{4}(\S+)\s*=\s*(.*)$/) {
                if ($left eq '$UID/$EUID') {
                    my($uid,$euid) = split m{\s*/\s*}, $right;
                    $extract{'env:$UID'} = $uid;
                    $extract{'env:$EUID'} = $euid;
                } elsif ($left =~ /GID/) {
                    for my $xgid (uniq split " ", $right) {
                        $extract{"env:$left∋$xgid"} = "true";
                    }
                } else {
                    $extract{"env:$left"} = $right;
                }
            }
        }
        if ($in_test_summary) {
            if (/^(?:Result:|Files=\d)/) {
                $in_test_summary = 0;
            } elsif (/^(\S+)\s+\(Wstat:.+?Tests:.+?Failed:\s*(\d+)\)$/) {
                my $in_test_summary_current_test = $1; # t/globtest.t or t\globtest.t
                my $in_test_summary_current_failed = $2;
                $in_test_summary_current_test =~ s|\\|/|g; # only t/globtest.t
                $extract{"fail:$in_test_summary_current_test"} = $in_test_summary_current_failed;
            } elsif (/^\s+Failed tests?:/) {
                # ignoring the exact combination of tests for now, seems like overkill
            }
        }
        push @previous_line, $_;
        if ($expect_prereq || $expect_toolchain) {
            if (/Perl module toolchain versions installed/) {
                # first time discovered in CPANPLUS 0.89_06
                $expecting_toolchain_soon = 1;
                $expect_prereq=0;
                next LINE;
            }
            if (exists $moduleunpack->{type}) {
                my($module,$v,$needwant);
                # type 1 and 2 are about prereqs, type three about toolchain
                if ($moduleunpack->{type} == 1) {
                    (my $leader,$module,$needwant,$v) = eval { unpack $moduleunpack->{tpl}, $_; };
                    next LINE if $@;
                    if ($leader =~ /^-/) {
                        $moduleunpack = {};
                        $expect_prereq = 0;
                        next LINE;
                    } elsif ($leader =~ /^(
                                         buil          # build_requires:
                                         |conf         # configure_requires:
                                        )/x) {
                        next LINE;
                    } elsif ($module =~ /^(
                                         -             # line drawing
                                        )/x) {
                        next LINE;
                    }
                } elsif ($moduleunpack->{type} == 2) {
                    (my $leader,$module,$v,$needwant) = eval { unpack $moduleunpack->{tpl}, $_; };
                    next LINE if $@;
                    for ($module,$v,$needwant) {
                        s/^\s+//;
                        s/\s+$//;
                    }
                    if ($leader =~ /^\*/) {
                        $moduleunpack = {};
                        $expect_prereq = 0;
                        next LINE;
                    } elsif (!defined $v
                             or !defined $needwant
                             or $v =~ /\s/



( run in 1.854 second using v1.01-cache-2.11-cpan-5735350b133 )