/usr/share/vile/perl/Glob2re.pm is in vile-common 9.8g-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 42 43 | package Glob2re;
require 5.000;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(glob2re);
sub glob2re {
my ($glob) = @_;
my $re = '(^|\/)';
while ($glob ne '') {
if ($glob =~ /^\*(.*)$/) {
$re .= '.*';
$glob = $1;
}
elsif ($glob =~ /^\?(.*)$/) {
$re .= '.';
$glob = $1;
}
elsif ($glob =~ /^\[(.+?)\](.*)$/) {
$re .= "[$1]";
$glob= $2;
}
elsif ($glob =~ /^\{(.*?,.*?)\}(.*)$/) {
my ($alts) = $1;
$glob = $2;
$re .= '(' . join('|',map(quotemeta,split(/,/, $alts))) . ')';
}
elsif ($glob =~ /^(.[^[{*?]*)(.*)$/) {
$re .= quotemeta($1);
$glob = $2;
}
else {
# shouldn't get here. If we do, give up
$glob = '';
}
}
$re .= '$';
return $re;
}
1;
|