diff options
Diffstat (limited to 'MDK')
-rw-r--r-- | MDK/Common.pm.pl | 2 | ||||
-rw-r--r-- | MDK/Common/File.pm | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/MDK/Common.pm.pl b/MDK/Common.pm.pl index ed919a7..e818535 100644 --- a/MDK/Common.pm.pl +++ b/MDK/Common.pm.pl @@ -74,7 +74,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.19"; +$VERSION = "1.1.20"; 1; EOF diff --git a/MDK/Common/File.pm b/MDK/Common/File.pm index 26923a4..86fb98b 100644 --- a/MDK/Common/File.pm +++ b/MDK/Common/File.pm @@ -82,6 +82,10 @@ ensure the file exists, set the modification time to current time returns all the file in directory (except "." and "..") +=item all_files_rec(DIRNAME) + +returns all the files in directory and the sub-directories (except "." and "..") + =item glob_(STRING) simple version of C<glob>: doesn't handle wildcards in directory (eg: @@ -117,7 +121,7 @@ L<MDK::Common> use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK); @ISA = qw(Exporter); -@EXPORT_OK = qw(dirname basename cat_ cat_or_die cat__ output output_p output_with_perm append_to_file linkf symlinkf renamef mkdir_p rm_rf cp_f cp_af touch all glob_ substInFile expand_symlinks openFileMaybeCompressed catMaybeCompressed); +@EXPORT_OK = qw(dirname basename cat_ cat_or_die cat__ output output_p output_with_perm append_to_file linkf symlinkf renamef mkdir_p rm_rf cp_f cp_af touch all all_files_rec glob_ substInFile expand_symlinks openFileMaybeCompressed catMaybeCompressed); %EXPORT_TAGS = (all => [ @EXPORT_OK ]); sub dirname { local $_ = shift; s|[^/]*/*\s*$||; s|(.)/*$|$1|; $_ || '.' } @@ -220,6 +224,12 @@ sub all { @l; } +sub all_files_rec { + my ($d) = @_; + + map { $_, -d $_ ? all_files_rec($_) : () } map { "$d/$_" } all($d); +} + sub glob_ { my ($d, $f) = $_[0] =~ /\*/ ? (dirname($_[0]), basename($_[0])) : ($_[0], '*'); |