CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Jump to beginning of script

 



wjbell
stranger

Mar 29, 2002, 2:01 PM

Post #1 of 3 (623 views)
Jump to beginning of script Can't Post

I have a script that goes to a subroutine when the user follows a query string like script.cgi?action=foo. What I want to do is have the script jump back up to the top of the script and proccess from there in that subroutine only. Is there a way to have the script jump to the top (sort of start over) from a subroutine?

Sort of like:

...
...
top script stuff

sub foo {

Do whatever this subroutine is suppose to do here then

execute back up to the top of the script without any query string

}


Paul
Enthusiast

Mar 30, 2002, 2:06 AM

Post #2 of 3 (620 views)
Re: [wjbell] Jump to beginning of script [In reply to] Can't Post

Well you can use return; to carry on or are you saying you want to go right back to the beginning?


(This post was edited by RedRum on Mar 30, 2002, 2:10 AM)


Coderifous
journeyman

Mar 30, 2002, 10:14 AM

Post #3 of 3 (615 views)
Re: [RedRum] Jump to beginning of script [In reply to] Can't Post

using the CGI module provided by Lincoln Stein:


Code
  

use CGI;



my $cgi = new CGI;



if($cgi->param()){

# call that sub you want to run if there is a query string.

$cgi->delete_all; # tosses all parameters



# if not using object-oriented interface, then say:

# Delete_all();





}



# then the script will continue here ( at the top in my example ) with no

# query string.



I hope this helps.

--Jim

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives