2009-09-05 16:54:05 -04:00
|
|
|
package WgetFeature;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
2014-11-01 05:06:26 -04:00
|
|
|
our $VERSION = 0.01;
|
|
|
|
|
|
|
|
use Carp;
|
|
|
|
use English qw(-no_match_vars);
|
2014-11-03 07:45:45 -05:00
|
|
|
use FindBin;
|
2014-09-24 10:40:03 -04:00
|
|
|
use WgetTests;
|
2009-09-05 16:54:05 -04:00
|
|
|
|
2014-11-01 05:06:26 -04:00
|
|
|
our %SKIP_MESSAGES;
|
|
|
|
{
|
2014-11-03 07:45:45 -05:00
|
|
|
my $cfgfile = "$FindBin::Bin/WgetFeature.cfg";
|
|
|
|
open my $fh, '<', $cfgfile
|
|
|
|
or croak "Cannot open '$cfgfile': $ERRNO";
|
2014-11-01 05:06:26 -04:00
|
|
|
my @lines = <$fh>;
|
2014-11-03 07:45:45 -05:00
|
|
|
close $fh or carp "Cannot close '$cfgfile': $ERRNO";
|
|
|
|
my $evalstr = join q{}, @lines;
|
|
|
|
eval { $evalstr } or carp "Cannot eval '$cfgfile': $ERRNO";
|
2014-11-01 05:06:26 -04:00
|
|
|
}
|
2009-09-05 16:54:05 -04:00
|
|
|
|
|
|
|
sub import
|
|
|
|
{
|
|
|
|
my ($class, $feature) = @_;
|
|
|
|
|
|
|
|
my $output = `$WgetTest::WGETPATH --version`;
|
2014-11-01 05:06:26 -04:00
|
|
|
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
|
2009-09-05 16:54:05 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|