1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00
wget/tests/WgetFeature.pm
Pär Karlsson 5e71d5aea1 * WgetFeature.pm: Fixed finding of WgetFeature.cfg when using separate
build dirs.
 * WgetFeature.pm: Fixed warning from BLOCK eval, made it indo EXPR eval

This fixes 'make distcheck' and removes a warning.
2014-11-03 14:23:29 +01:00

45 lines
942 B
Perl

package WgetFeature;
use strict;
use warnings;
our $VERSION = 0.01;
use Carp;
use English qw(-no_match_vars);
use FindBin;
use WgetTests;
our %SKIP_MESSAGES;
{
my $cfgfile = "$FindBin::Bin/WgetFeature.cfg";
open my $fh, '<', $cfgfile
or croak "Cannot open '$cfgfile': $ERRNO";
my @lines = <$fh>;
close $fh or carp "Cannot close '$cfgfile': $ERRNO";
my $evalstr = join q{}, @lines;
eval { $evalstr } or carp "Cannot eval '$cfgfile': $ERRNO";
}
sub import
{
my ($class, $feature) = @_;
my $output = `$WgetTest::WGETPATH --version`;
my ($list) = $output =~ m/^([+-]\S+(?:\s+[+-]\S+)+)/msx;
my %have_features;
for my $f (split m/\s+/msx, $list)
{
my $feat = $f;
$feat =~ s/^.//msx;
$have_features{$feat} = $f =~ m/^[+]/msx ? 1 : 0;
}
if (!$have_features{$feature})
{
print "$SKIP_MESSAGES{$feature}\n";
exit 77; # skip
}
}
1;