I m not a Unix guy but am currently working with it. In one terminal I ssh into a machine- and then telnet into another. In this telnet I spawn an application that accepts commands. I send commands like "moveUp(10)" and others. I wanted to write a program to use on top of this so instead of typing that in- I could just press "up" 10 times- or some other key. Kind of like making shortcut keys. I was going to use perl. I was thinking I could just run the application in a different termnial window to register my key pressed- and have it post the textual commands to the telnet window. Is this possible- and if so how do I do it?
I created a form on an webpage. I then input parameters and submit the form to my perl cgi script. I want the script to create a KML file and prompt the user to save the KML file from Internet Explorer after submitting the form. So...in the perl script- instead of using open(OUTPUT- >outputfilename.kml) and using print OUTPUT "blahblah" for every print statement- do I just use print by itself to popoulate the file- and when its done IE will automatically prompt me to save it? I know that Google Earth uses this method when calling a cgi script. It just outputs the code back to Google Earth viewer simply with the print statement.
In my HTML form- I have <FORM ACTION="http://www.site.com/myscript.cgi>. So I call the script and in my script- I have
print "Content-Type: application/vnd.google-earth.kml+xml \n"
Content-Disposition: attachment; filename="outputfile.kml"\n\n
Are these the key elements I need to call the script? I submit the form and I get nothing back- so I am trying to figure out if it s something in my script. I do parse the $ENV{QUERY_STRING}- just to let you know.
this is what i have so far. (perl)
#!Z://perl
print "please enter the amount of money you would like to convert into coins. \n";
$money = <STDIN>;
$changequarter = $money / 25;
$CQ = int($changequarter);
$D = $money % 25;
$dime = $D / 10;
$DA = int($D);
$N = $D % 10;
$nickle = $N / 5;
$NA = int($nickle);
$P = $nickle % 5;
$penny = int($P);
print " you have $CQ quarters\n";
print " $DA dimes.\n";
print " $NA nickles\n";
print " and $penny pennys\n";
something is wrong with the dimes i think. can anyone be of help?
if(opendir(DIR-$directory)) { # Proess file with NGC
foreach my $filename1 (readdir DIR) {
if ($filename1 =~ /ngc.*\.xml$/i ) {
if (open(NGC_Input-$filename1)) {
$NGC_Update=$filename1;
close (NGC_Input);
}
}
}
}
Someone provided me with the code above to search for any file that has ngc on it. However the code provided also has a specific directory to look for. Is it possbile to remove the directory and just search for file. I tried editing it but nothing seems to work. I m just new in perl so can someone please help??? thank you
No comments:
Post a Comment