# # TLUtils.pm # common functions for TeX Live Infrastructure # Copyright 2007 Norbert Preining # # based on Fabrice Popineau's FileUtils.pm # # This file is licensed under the GNU General Public Licence version 2 # or any later version package TLUtils; use File::Basename; BEGIN { use Exporter (); use Cwd; use File::Path; use vars qw( @ISA @EXPORT_OK ); @ISA = qw(Exporter); @EXPORT_OK = qw( &sort_uniq &push_uniq ); } sub sort_uniq { my (@l) = @_; my ($e, $f, @r); $f = ""; @l = sort(@l); foreach $e (@l) { if ($e ne $f) { $f = $e; push @r, $e; } } return @r; } sub push_uniq { local (*l, @le) = @_; my ($e); foreach $e (@le) { if (! &member($e, @l)) { push @l, $e; } } } sub member { my ($e, @l) = @_; my ($f); foreach $f (@l) { if ($e eq $f) { return 1; } } return 0; } sub debug { print @_ if ($::opt_debug); } 1; ### Local Variables: ### perl-indent-level: 4 ### tab-width: 4 ### indent-tabs-mode: t ### End: # vim:set tabstop=4: #