on 02/07/2001 09:21 PM, g3pb at [EMAIL PROTECTED] wrote:

> i am writing a short script to log into a unix type box, request a report,
> wait for the output and then log out. one problem i can't seem to figure out
> is how to slow down the transmission of my commands. occasionaly the
> commands i send lose a character or two which of course ...
> 
> how do i slow the transmission rate
> 
> thanks

Can you show us a sample of your script?

here's one of mine that does something similar... perhaps you can compare
the two and see what you're doing differently.. this works fine on my Mac.

-=-

#!perl -w
use strict;

# selectively silence the compile-time warning for Types.pm until
# someone fixes the bloody thing :)
my $DOWARN;
BEGIN { 
    $SIG{'__WARN__'} = sub { warn $_[0] if $DOWARN };
    # change to 1 if you wish to test for other compile-time
    # warnings being present.
    $DOWARN = 0; 
} 
$DOWARN = 1; # all run-time warnings still in effect.

use MacPerl qw(Answer Ask);
my $do_what = 
  Answer('Update Map and FTP lists and download or just download ?',
         'Both', 'Update', 'Download');
my $user    = Ask('Enter Username') or die "No Username Entered\n";
my $pass    = Ask('Enter Password') or die "No Password Entered\n";

if ( $do_what >= 1 ) {
    use Net::Telnet;
    print "Updating files...\n";

    my $telnet = new Net::Telnet(Timeout => 300);
    $telnet->open('216.155.0.50');
    $telnet->login($user, $pass);

    my @output = $telnet->cmd('~/bin/updatemaps') or die($!);
    print @output, "\n\n";

    my @output2 = $telnet->cmd('~/bin/update_database.plx') or die($!);
    print @output2, "\n\n";

    $telnet->close() or die("Error closing Telnet session: $!");
}

if ($do_what == 0 || $do_what == 2) {
    use Net::FTP;
    print "Downloading ...\n";

    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->ascii() or die ("could not change type to ascii! $!");

    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";
    }

    $ftp->quit() or die("error closing FTP session: $!");
}

print 'Update completed.';
exit;


-- 
Scott R. Godin            | e-mail : [EMAIL PROTECTED]
Laughing Dragon Services  |    web : http://www.webdragon.net/


Reply via email to