If your web page needs to send something small (less than 1KB of data) back to the server, you could do it by loading an image. The image url could contain an encoded data.

www.yourwebsite.com/cgi-bin/servebmp.cgi?saveThis=askldajlkdjasldkjaslkjasdljaslkas

And when you load the image, your perl script on the other end could decode the url and store the data. Oh, and when it's done, it should send back an image. perhaps a 1x1 bmp image. It has the smallest header:

############################################################### # # This function creates a simple B/W bitmap image # to send back to the browser as a response. # # Usage: SpitBMP(width, height) # # Example: SpitBMP(4, 3) ---> Creates a black 4x3 BMP image # sub SpitBMP { my $W = @_ ? shift : 1; my $H = @_ ? shift : 1; $|++; my $HEADERLEN = 62; my $DATASIZE = Ceil($W * $H / 8); my $FILESIZE = $DATASIZE + $HEADERLEN; my $BITS_PER_PIXEL = 1; my $HEADER = 'BM' . pack('VxxxxVVVV', $FILESIZE, $HEADERLEN, 40, $W, + $H) . chr(1) . pack('xCxxxxxV', $BITS_PER_PIXEL, $DATASIZE) . "\0" x + 20 . "\xFF\xFF\xFF\0"; my $OUTPUT = $HEADER . "\0" x $DATASIZE; print "Content-Type: image/bmp\n" . 'Content-Length: ' . length($OUTPUT) . "\n\n" . $OUTPUT; } ############################################################### # # Rounds a number up to the nearest integer. # # Usage: INTEGER = Ceil(FLOAT) # sub Ceil { my $DEC = shift; my $INT = int($DEC); return $INT if ($DEC - $INT == 0); return $INT + 1 if ($DEC > 0); return $INT - 1; }

In reply to Re: cgi page reload by harangzsolt33
in thread cgi page reload by bigup401

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.