| Store | Cart
Lists » pdk

Re: perlapp - combine related executables to reduce size

From: $Bill Luebkert <dbec...@roadrunner.com>
Sun, 29 Apr 2012 06:06:03 -0700
On 04/28/2012 22:05, Sat Guru Khalsa wrote:
>> But this did not work for recursion>>      sub recurseDir () {>         my ($dir) = @_;>         opendir (DIR, $dir);>         while (defined (my $f=readder(DIR))) {>            if (-d "$dir\\$f") {&recurseDir("$dir\\$f"); }>            .. other wise do something with the plain file ..

It works OK to just use DIR if you slurp the dir contents into a
vrbl (don't have a memory issue):

sub recurseDir () {
	my $dir = shift;

opendir (DIR, $dir) or die ...;
my @files = readdir $dir;
closedir DIR;

foreach my $file (@files) {
	next if $file =~ /^\.\.?$/;
	if (-d "$dir/$file") {
		recurseDir ("$dir/$file");
	} else {
		# otherwise do something with the plain file ..
	}
}

}
_______________________________________________
PDK mailing list
P...@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Recent Messages in this Thread
will...@aol.com Mar 17, 2012 09:30 pm
Sat Guru Khalsa Apr 26, 2012 01:15 pm
Sat Guru Khalsa Apr 29, 2012 05:05 am
$Bill Luebkert Apr 29, 2012 01:06 pm
Phillip Richcreek Mar 17, 2012 05:25 pm
Messages in this thread