Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Stopping CGI/Perl  when Browser stops listening

Posted on 1998-07-24
1
Medium Priority
?
211 Views
Last Modified: 2013-12-25
I have made a CGI-Perl script which feeds back multple JPG images to a <IMG> tag client call.  The multi images can run up to 200 JPGs.  One thing that's for sure is the client won't sit there for all 200 JPGS to show on their screen as an animation (they'll leave my page to somewhere else).  Now if this is the case, I'd hate for my CGI script to "keep sending" JPG images if there's no one watching it.

Therefore, I'd like to have my Perl script "immediately" stop sending images and quit if the client browser has stopped accepting images.  I remeber such a command exists in Perl but I totally forget what it is.  Would you know the answer?

Thanks.
0
Comment
Question by:ljaques
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 6

Accepted Solution

by:
alamo earned 0 total points
ID: 1831149
You probably have a line to copy the image file to STDOUT which looks something like:
print <IN>;

Change it to:
print (<IN>) || last;

When the user hits stop on the browser, the server kills STDOUT and thus print fails. (Bet you didn't know print was a function that returns true or false, most people don't use it that way). What you are going to print needs to be enclised in () so that it doesn't try to print <IN>||last, which won't work.

Hope this helps!

p.s. I would have told you this last time if I had realized it, I knew it was possible but had never actually figured out how to do it. Now I have :-)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question