Caution: This may be nonfunctional on NS4.7+. Tested it on IE6 earlier but now it aint working with NS4.7. Either I broke it or it's not cross-browser yet.

Here is an example of SVG (drawing XML dialect) interacting with a server through get reqests (can also do post requests). The original concept was posted on the svg-developers yahoo group in early Feb 2002, and I've adapted it to perl (of course).

The startup screen gives you 2 squares. Clicking on the squares causes a request to a database to go out which returns the xml for the drawings of the circles that fall within the square's periphery.

Key point: This is all done from within a single browser window, and with no refresh of the image.

Other key point: My server is not running mod_perl, which would make the lag about 1/2 as bad (currently it's 500mS for me, with 100 entries x 5 fields in the database, but then again the request is going 1/2 around the world for me).

Modules used:

  1. CGI (as a demo shortcut to grab the parameters
  2. SVG (for the client-DBI connection using SVG messages)
  3. CGI::Carp (this is a hosted server and I needed to see my errors sans error log access)
  4. DBI (with mySQL)

I've included the source files for inspection.

  1. click here for the demo
  2. click here for the svg source
  3. click here for the perl source

Next step: drawing onto the space and updatating the database from that.

I used SVG, but you could just as well use xmlrpc and dhtml for this.

hackmare.


In reply to Implementing refresh-free SVG-perl-DBI-Javascript client-server interaction by hackmare

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.