Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Web Wizard

by boo_radley (Parson)
on Dec 30, 2000 at 01:42 UTC ( #48906=CUFP: print w/replies, xml ) Need Help??

This was a challenge from a coworker. It presents the shell for a web based wizard, ala Windows 98 wizards -- Presents some information, and "next" and "previous" buttons, and is an extension on CGI recipe contemplations
use CGI::Pretty qw(:standard); use strict; my $current_page; my %pages = (main => {description =>"Uno", nextpage =>"page2", prevpage =>undef, subname =>\&page1}, page2=> {description =>"Dos", nextpage =>"page3", prevpage =>"main", subname =>\&page2}, page3=> {description =>"Tres", nextpage =>"page4", prevpage =>"page2", subname =>\&page3}, page4=> {description =>"Quatro", nextpage =>"page5", prevpage =>"page3", subname =>\&page4}, page5=> {description =>"Five", nextpage =>undef, prevpage =>"page4", subname =>\&page5} ); $current_page = param("Current_Page") ||"main"; if (param("Next")) {$current_page = $pages{$current_page}{nextpage}} elsif (param("Back")) {$current_page = $pages{$current_page}{prevpage}} make_header($pages{$current_page}{description}); param (-name=>"Current_Page", -value=>$current_page); print hidden ("Current_Page"); foreach my $page_name (keys %pages) { $pages{$page_name}{subname}->($current_page eq $page_name); } make_footer(); exit; sub make_header { print header (-type=>'text/html'); print start_html (-title=>shift); print start_form; } sub make_footer { print p,"<CENTER>"; print submit(-name=>'Back') if defined ($pages{$current_page}{prev +page}); print submit(-name=>'Next') if defined ($pages{$current_page}{next +page}); print p"</CENTER>"; print end_form(); print end_html(); } sub page1{ my $status=shift; if ($status){ print "this is page1\n"; } } sub page2{ my $status=shift; if ($status){ print "this is page2\n"; } } sub page3{ my $status=shift; if ($status){ print "this is page3\n"; } } sub page4{ my $status=shift; if ($status){ print "this is page4\n"; } } sub page5{ my $status=shift; if ($status){ print "this is page5\n"; } }

Replies are listed 'Best First'.
Re: Web Wizard
by merlyn (Sage) on Dec 30, 2000 at 09:01 UTC

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: CUFP [id://48906]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (1)
As of 2021-09-18 04:33 GMT
Find Nodes?
    Voting Booth?

    No recent polls found