×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

perl cgi

perl cgi

perl cgi

(OP)
my perl cgi program is called with a form, It goes out and chks one file size, if the size has changed it does stuff, that parts ok...but if the file size has not changed I want the script to just die...but it always want to come back and open a window...it doesnt care which window just whatever i tell it with the "print "location: XXX.htm"...If i leave that out it opens a window with a "cannot find file" msg.  there must be some way to run a script and then not have it come  back knocking on the door.
Thanks
Jaq@QB7.com

RE: perl cgi

It's hard to tell without seeing the actual code but you might want to try to put an EXIT command.

if(size == changed)
{
print "Hello !";
}
else
{
exit;
}

RE: perl cgi

(OP)
No...thanks for trying darkom...but that doesnt work...the script generates a window that says "cant find file"

RE: perl cgi

Can you put the code in your reply so we can see how it is structured !

RE: perl cgi

(OP)
Well..it appears to be true of any perl cgi program...I have yet to see one that doesnt insist on opening a browser window somewhere along the line. Heres a simplified example..it will open up a window at completion that says the browser cant find the requested window, I just want it to finish its job and die.

#########

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
  ($strip,$filename) = split(/=/,$buffer);   

$sz = -s $filename;  
if($sz > 0)  {
   open (FILE, "$filename");
      $nuData=<FILE>;
   close (FILE);
   
   open (FILE, ">$filename");     # clear file
   close (FILE);
   
# append new data to storage file
   open (DOX,">>Storage.txt");          
       print DOX "$nuData \n";
   close (DOX);
}

exit;           #   so...how does one end this simple
                   #  script without opening a window?



RE: perl cgi

if your goal is to keep the form page in the browser when the file size has not changed, then may I suggest doing this :

if($sz > 0)  {
   open (FILE, "$filename");
      $nuData=<FILE>;
   close (FILE);
   
   open (FILE, ">$filename");     # clear file
   close (FILE);
   
# append new data to storage file
   open (DOX,">>Storage.txt");          
       print DOX "$nuData \n";
   close (DOX);
}

else {
 print "history.back()";
}

That will prevent the File not found message. But if a user submits a form he would expect a return to tell him(or her) the result.

I suggest putting a page with the message "the file has not changed !!!" in the else part.

If the cgi just dies then what will the user see ?
The browser expects a return and will always put an error message if you don't tell it otherwise.

Hope that helps.

RE: perl cgi

(OP)
That one opens a window that say "this page cannot be displayed...etc....etc"...
My question isnt really about this script in particular. Let me rephrase it. Does a perl cgi script always open a window, no matter the scripts function?....if not ..where kind I find an example of a perl cgi script that performs any simple function without opening a window.
Thanks for your continued input.

RE: perl cgi

In that case try using a standard perl script. (.pl) instead of a cgi. Then you won't have a windows open.

Here is an exemple :

#!/usr/lpp/ssp/perl5/bin/perl

$command_text = "ip_general";
$command_text = uc($command_text);
print '$command_text\n';
exit;

If you use the line :
use CGI;

then it will probably open a window. I have never seen a CGI used other then for a web page.

RE: perl cgi

(OP)
Ok...thanks for the info..Ill follow that path

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close