diff options
-rw-r--r-- | MDK/Common.pm.pl | 2 | ||||
-rw-r--r-- | MDK/Common/System.pm | 14 | ||||
-rw-r--r-- | perl-MDK-Common.spec | 3 |
3 files changed, 16 insertions, 3 deletions
diff --git a/MDK/Common.pm.pl b/MDK/Common.pm.pl index 914d59c..e042014 100644 --- a/MDK/Common.pm.pl +++ b/MDK/Common.pm.pl @@ -71,7 +71,7 @@ use vars qw(@ISA @EXPORT $VERSION); #); # perl_checker: RE-EXPORT-ALL @EXPORT = map { @$_ } map { values %{'MDK::Common::' . $_ . 'EXPORT_TAGS'} } grep { /::$/ } keys %MDK::Common::; -$VERSION = "1.1.9"; +$VERSION = "1.1.10"; 1; EOF diff --git a/MDK/Common/System.pm b/MDK/Common/System.pm index 40c1fc8..5ecdc86 100644 --- a/MDK/Common/System.pm +++ b/MDK/Common/System.pm @@ -88,6 +88,10 @@ returns the epoch in microseconds takes care of CR/LF translation +=item whereis_binary(STRING) + +return the first absolute file in $PATH (similar to which(1) and whereis(1)) + =item getVarsFromSh(FILENAME) returns a hash associating shell variables to their value. useful for config @@ -175,7 +179,7 @@ use MDK::Common::File; use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK %compat_arch $printable_chars $sizeof_int $bitof_int); #); @ISA = qw(Exporter); -@EXPORT_OK = qw(%compat_arch $printable_chars $sizeof_int $bitof_int arch typeFromMagic list_passwd list_home list_skels list_users syscall_ psizeof availableMemory availableRamMB gettimeofday unix2dos getVarsFromSh setVarsInSh setVarsInShMode setExportedVarsInSh setExportedVarsInCsh template2file template2userfile read_gnomekderc update_gnomekderc fuzzy_pidofs); #); +@EXPORT_OK = qw(%compat_arch $printable_chars $sizeof_int $bitof_int arch typeFromMagic list_passwd list_home list_skels list_users syscall_ psizeof availableMemory availableRamMB gettimeofday unix2dos whereis_binary getVarsFromSh setVarsInSh setVarsInShMode setExportedVarsInSh setExportedVarsInCsh template2file template2userfile read_gnomekderc update_gnomekderc fuzzy_pidofs); #); %EXPORT_TAGS = (all => [ @EXPORT_OK ]); @@ -285,7 +289,13 @@ sub availableRamMB() { 4 * MDK::Common::Math::round((-s '/proc/kcore') / 1024 / sub gettimeofday() { my $t = pack "LL"; syscall_('gettimeofday', $t, 0) or die "gettimeofday failed: $!\n"; unpack("LL", $t) } sub unix2dos { local $_ = $_[0]; s/\015$//mg; s/$/\015/mg; $_ } - +sub whereis_binary { + my ($prog) = @_; + foreach (split(':', $ENV{PATH})) { + my $f = "$_/$prog"; + -x $f and return $f; + } +} sub getVarsFromSh { my %l; diff --git a/perl-MDK-Common.spec b/perl-MDK-Common.spec index 03f8a43..3fdb016 100644 --- a/perl-MDK-Common.spec +++ b/perl-MDK-Common.spec @@ -72,6 +72,9 @@ rm -rf $RPM_BUILD_ROOT # MODIFY IN THE CVS: cvs.mandrakesoft.com:/cooker soft/perl-MDK-Common %changelog +* Wed Jan 7 2004 Pixel <pixel@mandrakesoft.com> 1.1.10-1mdk +- add whereis_binary() + * Mon Jan 5 2004 Pixel <pixel@mandrakesoft.com> 1.1.9-1mdk - many perl_checker enhancements |