Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Answer: Redirecting from a scipt to another script

by jreades (Friar)
on Sep 06, 2000 at 18:19 UTC ( #31248=categorized answer: print w/replies, xml ) Need Help??

Q&A > CGI programming > Redirecting from a scipt to another script - Answer contributed by jreades

I can make a few suggestions for exploration:

  1. If you want to do this via browser redirect are you sure that the script is exiting cleanly -- this is in line with what the Anonymous Monk suggested, but I'd definitely go with trying the redirect as the last line before exit 0;.

  2. This might also be a candidate for an exec() -- rather than redirecting to the new script, launch the script 'b' from within script 'a'. There was a good thread (at least, I sure learned a lot) just a couple of weeks back. You can read it here (the thread thread picks up about midway down and I'd particularly recommend: tilly's piece and that from geeksalad.

I also find it helpful to use the following line when debugging scripts that are on a server:

BEGIN { $| = 1; open(STDERR, ">&STDOUT"); print "Content-Type: text/pl +ain\n\n"; }

This nice snippet redirects STDERR to STDOUT and prints everything as text/plain to the browser -- then you can use your standard print $whatever . "\n"; while debugging.

Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2020-09-24 04:36 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (132 votes). Check out past polls.