http://qs321.pair.com?node_id=31248


in reply to Redirecting from a scipt to another script

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.