Hello everyone,

I've looked everywhere for an answer, but I can't seem to find a description of a nice way to do this.

I'm writing a perl / cgi script that has a number of views. Let's say you can move through web pages in the following sequence:

View 1 -> View 2 -> View 3 (password-protected)

View 3 is password-protected. If you're not logged in when you request it, the script redirects you to the login screen. So basically your path looks like this:

View 1 -> View 2 -> Login -> View 3

Now, how do you come back from View 3 to View 1. Would I store this sequence in a hidden variable and update it for each view? It's easy to remember just the last view, but it doesn't work beyond 2 screens. If I'm in View 3, I remember that the last view was View 2, but I don't know what comes before View 1.

Does anyone know of a nice and clean way to program this? Any examples of code? The code I've got is a mess - I would hate to maintain it, so I need to find a cleaner solution.

Thank you,
Alex


In reply to Storing sequence of cgi states by relax99

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.