[roch-pm] Help with File handle.

echo dev echo_dev at hotmail.com
Sun Feb 23 02:14:54 CST 2003


Hey,

Never mind I fixed the bug see I had the open in the sub and everytime I 
recurivly called the sub it made a new file. So I moved the open out of the 
sub and BOOM it works great thanks everyone.

Happy Hacking
hde





>From: "echo dev" <echo_dev at hotmail.com>
>Reply-To: rochester-pm-list at happyfunball.pm.org
>To: rochester-pm-list at happyfunball.pm.org
>Subject: Re: [roch-pm] Help with File handle.
>Date: Sun, 23 Feb 2003 06:05:17 +0000
>
>Here is the sub with errors.
>
>Thanks
>hde
>
>sub code_base_conf
>{
>    my @file_contents;
>    my $start_dir = shift;
>    my @dir_contents;
>    my $cwd = $start_dir;
>    my $old_cwd;
>
>    open (CONFIG_FILE, ">/home/hde/code_serv.conf")
>	or die "Can't create config file : $!\n";
>
>    chdir ($start_dir) or
>	die "Can't cd to $start_dir : $!\n";
>
>    opendir (DIR, $start_dir)
>	or die "Can't open $start_dir : $!\n";
>
>    @dir_contents = readdir (DIR)
>	or die "Can't read dir $start_dir : $!\n";
>
>    closedir (DIR) or
>	die "Can't close dir $start_dir : $!\n";
>
>    select CONFIG_FILE;
>
>    for my $file_or_dir (@dir_contents)
>    {
>        next if ($file_or_dir eq qq{.});
>        next if ($file_or_dir eq qq{..});
>
>        if (-d $file_or_dir)                 # If the file is a directory.
>        {
>            next if (-l $file_or_dir);
>
>            $cwd = &cwd;
>	    $old_cwd = $cwd;
>	    $cwd =~ s{(/.*/)+}{}g;
>
>	    printf ("%s %s %s\n", $cwd, "=>", $old_cwd);
>	    $cwd = &cwd;
>
>            chdir (qq{$cwd/$file_or_dir}) or
>                die "Can't cd to $cwd/$file_or_dir : $!\n";
>
>            opendir (DIR, qq{$cwd/$file_or_dir}) or
>                die "Can't open dir $file_or_dir : $!\n";
>
>            code_base_conf ((readdir (DIR)));
>
>            closedir (DIR);
>
>            chdir ($cwd) or
>                die "Can't cd to $cwd : $!\n";
>
>            next;
>        }
>
>    }
>    chdir ("/home/hde/code_base/perl/code_base_Backup");
>    #clean_conf ("./code_serv.conf");
>}
>
>_________________________________________________________________
>Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
>http://join.msn.com/?page=features/featuredemail
>
>--
>For information on unsubscribing from this list, please visit
>http://rochester.pm.org


_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus

--
For information on unsubscribing from this list, please visit
http://rochester.pm.org



More information about the Rochester-pm mailing list