PerlBench

 view release on metacpan or  search on metacpan

lib/PerlBench/Results.pm  view on Meta::CPAN

    # fill in additional information about hosts and perls
    while(my($hostname, $hosthash) = each %{$self->{h} || {}}) {
	#print "host $hostname\n";
	while (my($perl, $perlhash) = each %{$hosthash->{p}}) {
	    #print " perl $perl\n";
	    my $perldir = "$dir/$hostname/perls/$perl";
	    my $version_txt = "$perldir/version.txt";
	    open(my $fh, "<", $version_txt) || die "Can't open $version_txt: $!";
	    local($_);
	    while (<$fh>) {
		if (/^This is perl, v(\S+)/) {
		    $perlhash->{version} = $1;
		    $perlhash->{name} = "perl-$1";
		}
		if (/^Binary build (\d+.*) provided by ActiveState/) {
		    $perlhash->{name} .= " build $1";
		    $perlhash->{name} =~ s/^perl/ActivePerl/;
		}
	    }
	    die "Can't determine perl version from $version_txt" unless $perlhash->{version};
	    close($fh);

perlbench-run  view on Meta::CPAN

    unless (-x $path) {
	die "$path is not executable";
	next;
    }
    if (-d $path and -x "$path/perl") {
	$path = "$path/perl";
	print "updating given dir path to $path\n" if $::opt_v;
    }

    my $self = bless { path => $path, label => $label }, $class;
    $self->run_cmd(*V, '-e', 'print qq(This is perl ), $]+0, qq(\n)');
    my $version = <V>;
    close V or die "closing pipe from perl: exit code $?";
    chomp $version;
    unless ($version =~ /^This is perl (\d+.\d+)/) {
	die "$path does not appear to be a working perl";
    }
    $self->{version} = $1;
    $self->run_cmd(*V, '-v');
    while (<V>) {
	if (/^This is perl, v(\S+)/) {	# old format
	    $self->{name} = "perl-$1";
	}
	if (/^This is perl (\d), version (\d+), subversion (\d+) \((\S+) (?:\((\S+)\){2})?/) {
	    print "new format: $4 $5\n" if $::opt_v;
	    $self->{name} = "perl-$1";
	    $self->{git_version} = $5
	}
	if (/^Binary build (\d+.*) provided by ActiveState/) {
	    $self->{name} .= " build $1";
	    $self->{name} =~ s/^perl/ActivePerl/;
	}
    }
    close(V);



( run in 1.267 second using v1.01-cache-2.11-cpan-49f99fa48dc )