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"; } }

In reply to Web Wizard by boo_radley

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.