Hi all. I've been using this site for years, but this is my first time asking for help :)
Here's the situation in a Windows programming environment:
in my mainmenu, there is the line "do you want to continue
y/n? y" and it reads the STDIN. Normally, this works. However, after this one function, extract, this <STDIN> causes the screen to freeze. If I do a 'cls' before the STDIN, it works fine; but if I don't, it freezes. In a perfect world, I would like for it not to have to do a 'cls.'
Is there something about 'cls' that clears a buffer or resets the world? If so, is there a way to recreate it? Specifically in Perl, is there a way to clear your buffers?
A little more background: The extract function uses a lot of calls to SFTP (Vandyke). I don't know if that would affect this either.
If you could help shed some light on this subject, I would really appreciate it!!!
Thanks,
Cecilia
Here's the code that the script is hanging on:
&Ftp ($PLATFORM1,$Login,$Pass,"send $elt $destFile");
&Telnet($PLATFORM1,$Login,$Pass,"chmod 0755 $destFile");
and the functions are as defined:
# Subroutine to run ftp
sub myFTP {
my($Host,$Login,$Pass,$Src,$Dest,$Mode) = @_;
local $cmdLine;
$cmdLine = "SFXCL.exe /Q /Overwrite always /DefaultType " . $Mode .
+" " . $Src . " sftp://" . $Login . ":" . $Pass . "@". $Host . "/" . $
+Dest;
system($cmdLine);
}
# Subroutine to ftp to a remote host
sub Ftp {
#valid commands are:
# chdir/cd, mkdir/md, rmdir/rd, ascii/binary, get/fetch
# send/put, del/rm
my($Host,$Login,$Pass,$cmd) = @_;
local $cwd = "";
local $mode = "binary";
@cmd = split (/,/,$cmd);
foreach $in (@cmd) {
$in =~ s/^ //;
($first, $second, $third) = split (/ /, $in);
if ($first =~ m/chdir|cd/ig) {
$cwd = $second; }
elsif ($first =~ m/mkdir|md/ig) {
$second = cwdDir($cwd, $second);
CreateSubDirs($Login, $Pass, $second); }
elsif ($first =~ m/rmdir|rd/ig) {
$second = cwdDir($cwd, $second);
Telnet($Host,$Login,$Pass, "rmdir $second"); }
elsif ($first =~ m/ascii/ig) {
$mode = "ascii"; }
elsif ($first =~ m/binary/ig) {
$mode = "binary"; }
elsif ($first =~ m/get|fetch/ig) {
if (($second eq "") || ($third eq " ")) {
$third = $second; }
$second = cwdDir($cwd, $second);
myFTP($Host,$Login,$Pass,$second,$third, $mode); }
elsif ($first =~ m/send|put/ig) {
if (($third eq "") || ($second eq " ")) {
$third = $second; }
$third = cwdDir($cwd, $third);
CreateSubDirs($Host,$Login, $Pass, $third);
myFTP($Host,$Login,$Pass,$second,$third, $mode);
}
elsif ($first =~ m/del|rm/ig ) {
$fixedDir = cwdDir($cwd, $second);
Telnet($Host,$Login,$Pass,"rm $second"); }
else {
print "error with FTP command: $in"; }
}
}
# Sub to telnet
# This isn't Telnet with new behavior
sub Telnet {
my ($Host, $Login, $Pass, $cmd) = @_;
my $theCommand;
$theCommand = "vsh -l $Login -pw $Pass $Host $cmd";<br>
return(system($theCommand));
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.