mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 09:36:15 +02:00
19 lines
390 B
Perl
19 lines
390 B
Perl
package Nix::Utils;
|
||
|
||
$urlRE = "(?: [a-zA-Z][a-zA-Z0-9\+\-\.]*\:[a-zA-Z0-9\%\/\?\:\@\&\=\+\$\,\-\_\.\!\~\*]+ )";
|
||
|
||
sub checkURL {
|
||
my ($url) = @_;
|
||
die "invalid URL ‘$url’\n" unless $url =~ /^ $urlRE $ /x;
|
||
}
|
||
|
||
sub uniq {
|
||
my %seen;
|
||
my @res;
|
||
foreach my $name (@_) {
|
||
next if $seen{$name};
|
||
$seen{$name} = 1;
|
||
push @res, $name;
|
||
}
|
||
return @res;
|
||
}
|