diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-08-27T18·34-0400 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-08-27T18·34-0400 |
commit | 15e1b2c223494ecb5efefc3ea0e3b926a6b1d7dc (patch) | |
tree | 49c0c914a6d3d02f54150bfaba3731aa9b98d720 /perl/lib/Nix/Utils.pm | |
parent | a9e6752bbd888ab8fbc1cda6e4d539b2858c4cef (diff) | |
parent | 9e2fc6951ca049b15149a2c4b75d2f5bff7f07e1 (diff) |
Merge branch 'no-manifests'
Diffstat (limited to 'perl/lib/Nix/Utils.pm')
-rw-r--r-- | perl/lib/Nix/Utils.pm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/perl/lib/Nix/Utils.pm b/perl/lib/Nix/Utils.pm new file mode 100644 index 000000000000..1e7e0b5afb2f --- /dev/null +++ b/perl/lib/Nix/Utils.pm @@ -0,0 +1,19 @@ +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; +} |