File: WgetFeature.pm

package info (click to toggle)
wget 1.25.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 26,088 kB
  • sloc: ansic: 109,273; sh: 7,660; perl: 6,790; python: 5,466; makefile: 602; lex: 167; sed: 16
file content (41 lines) | stat: -rw-r--r-- 928 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package WgetFeature;

use strict;
use warnings;

our $VERSION = 0.01;

use English qw(-no_match_vars);
use WgetTests;

sub import
{
    my ($class, @required_feature) = @_;

    # create a list of available features from 'wget --version' output
    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;
    }

    foreach (@required_feature)
    {
        if (!$have_features{$_})
        {
            print "Skipped test: Wget misses feature '$_'\n";
            print "Features available from 'wget --version' output:\n";
            foreach (keys %have_features)
            {
                print "    $_=$have_features{$_}\n";
            }
            exit 77; # skip
        }
    }
}

1;