in reply to How to exit subroutine and go to Beginning of CGI Script?
My first comment is that the way you are asking this question leaves a ton of room for interpretation.
If your "subroutne" is in a seperate .pl file how are you calling it? For sake of discussion I will assume you are doing something like:
In that case if I want to start my script over again with no regard to "state" or values of variables then within foo() I would simply#!/usr/bin/perl -w use CGI qw/ fatalsToBrowser/; # don't do this in production use strict; require "myfile.pl"; &foo(); # &foo is defined in myfile.pl
. . . #much handwaving exec($0); . . .
Otherwise it gets slightly trickier. Check out the CGI.pm documentation and look at the redirect method. Yould do something like:
: : # NOTE: $q was defined elsewhere as my $q=new CGI; print $q->redirect("http://my.site.tld/cgi-bin/foo.cgi?...") : : :
| Peter L. Berghold -- Unix Professional Peter at Berghold dot Net | |
| Dog trainer, dog agility exhibitor, brewer of fine Belgian style ales. Happiness is a warm, tired, contented dog curled up at your side and a good Belgian ale in your chalice. | |
|
|---|