3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 ##----------------------------##
8 ##---] CORE/CPAN INCLUDES [---##
9 ##----------------------------##
14 ##-------------------##
16 ##-------------------##
17 our $VERSION = qw(1.1);
19 ##-------------------##
21 ##-------------------##
23 my $modver = $Getopt::Long
::VERSION
|| 0;
24 my $isOldGetopt = ($modver eq '2.25') ?
1 : 0;
26 ###########################################################################
27 ## Intent: Script init function
28 ###########################################################################
33 # mozilla.build/mingw perl in need of an upgrade
34 # emulate Getopt::Long switch|short:init
35 foreach (qw(debug regex sort))
37 if (defined($argv{$_}))
48 my @args = ($isOldGetopt)
49 ?
qw(debug|d regex|r sort|s)
50 : qw(debug|d:1 regex|r:1 sort|s:1)
53 unless(GetOptions
(\
%argv, @args))
56 print " --sort Sort list elements early\n";
57 print " --regex Exclude subdirs by pattern\n";
61 my $debug = $argv{debug
} || 0;
65 my @in = ($argv{sort}) ?
sort @ARGV : @ARGV;
69 next if ($seen{$d}++);
71 print " arg is $d\n" if ($debug);
76 foreach my $dir (@out)
78 my $dirM = quotemeta($dir);
79 $found++, last if ($d eq $dir || $d =~ m!^${dirM}\/!);
81 print "Adding $d\n" if ($debug && !$found);
82 push @out, $d if (!$found);
84 print "Adding: $d\n" if ($debug);