Here's a little program that talks to the user:

my $foo = user_input("Enter foo:"); my $bar = user_input("Enter bar:"); print "foo x bar is " . $foo * $bar; sub user_input { print shift; return chomp <>; }

Now why can't I do that via http?

sub user_input_http { my $web_page = shift; # print HTTP header... print $web_page; # presumably with a form my %params = &parse_cgi_params; # or whatever }

This offers big improvements over the normal CGI way, where you have to restart your application every time you send a web page, and then figure out the state of your program just from the parameters.

What does Perl offer for this? Is the Apache:: namespace any use? What about other programming languages - is this how e.g. Javabeans work?

I only ask.

dave hj~


In reply to HTTP within an application by dash2

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.