[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] memory leaks in 5.20r4




running this simple script, MacPerl leaks memory like a sieve.. I can barely
reclaim any of the 45MB or so I have assigned to Perl .. this wouldn't be so
much of a problem, but I have another app that takes around 150 of my 208MB
and I NEED that RAM and I hate rebooting all the dang time just to reap
unused RAM back ...

anyone know whether it's the script or just MacPerl at fault?

#!perl
# no -w cuz one of the Net:: modules whines about Types.pm :P
# Isn't this fixed YET??
use strict;
use MacPerl qw(Answer Ask);

chomp(my $do_what = Answer('Update Map and FTP lists and download or just
download ?', 'Both', 'Update', 'Download'));
chomp(my $user = Ask('Enter Username'));
chomp(my $pass = Ask('Enter Password'));
if ($user eq '' or $pass eq '') {
    print 'Exited with no username or password entered';
    exit;
}

if ( $do_what >= 1 ) {
  {
    local $^W = 1;
    use Net::Telnet ();
    print "Updating files...\n";
    my $t = new Net::Telnet(Timeout => 300);
    $t->open('216.155.0.50') or die ("Could not open connection: $!");
    # ^^ my shell account, but any will do ^^
    $t->login($user, $pass) or die ("Could not log in! $!");
    my @output = $t->cmd('~/bin/updatemaps') or die($!);
    print @output, "\n\n";
    my $ok = $t->close;
  }
}

if ($do_what == 0 || $do_what == 2) {
    print "Downloading ...\n";
    use Net::FTP;
    my $curdir = '~/public_html/cgi-scripts/ncrp/input_files/';
    my $ftp = Net::FTP->new('216.155.0.50') or die ("Could not open
connection: $!");
    $ftp->login($user, $pass) or die ("Could not log in! $!");
    $ftp->type('A') or die ("could not change type! $!");
    my @files = ( "${curdir}maps_list.txt",
                  "${curdir}ftpinfo.txt",
                  "${curdir}ftpdirs_full_backup.txt" );
    $ftp->cwd($curdir) or die ("Could not change directory $!");
    foreach my $file (@files) {
        $ftp->get($file) or die ("Could not download $file! $!");
        print "$file download successful!\n";
    }
}
print 'Update completed.';
exit;


-- 
Scott R. Godin            | e-mail : webmaster@webdragon.net
Laughing Dragon Services  |    web : http://www.webdragon.net/



# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org