Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

NPH scripts? (was Re: Browser Timeout)

by eg (Friar)
on Feb 22, 2001 at 23:54 UTC ( [id://60299]=note: print w/replies, xml ) Need Help??


in reply to Re: Browser Timeout
in thread Browser Timeout

I'm curious because I've never used them, but what's the added advantage or utility of an NPH script over a non-NPH script. To bypass output buffer and avoid browser timeouts, I usually just set $&#124 and an alarm:

{ local $| = 1; local $SIG{ALRM} = sub { print `/usr/bin/fortune`; alarm ALARM_TIME; + }; alarm 1; ... process that (might) take a very long time ... alarm 0; }

Would using NPH be better?

update Thanks, merlyn.

Thanks, ERic

Replies are listed 'Best First'.
Re: NPH scripts? (was Re: Browser Timeout)
by merlyn (Sage) on Feb 23, 2001 at 00:00 UTC
    This works under modern Apache, but under older Apache versions, the script also had to be named nph-something to turn off the buffering. Consider the name as a signal that Apache should do its own $| = 1 equivalent.

    The other things that older Apache required was that these "NPH" scripts provide the first HTTP status line as well, since Apache essentially stepped out of the way entirely. I think this is still true for scripts named like this as a backward compatiblity.

    -- Randal L. Schwartz, Perl hacker

Re: NPH scripts? (was Re: Browser Timeout)
by shambright (Beadle) on May 12, 2001 at 21:58 UTC
    I have the same question.... I have several scripts that take longer than my browser has patience. Where exactly do I PUT the ' $|=1; ' in order to make sure that I don't get timed out?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://60299]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2024-04-19 11:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found