[ABE.pm] CGI::Ajax

Ricardo SIGNES rjbs-perl-abe at lists.manxome.org
Wed Dec 14 06:09:02 PST 2005


* Pat Regan <thehead at patshead.com> [2005-12-13T23:26:48]
> Have you guys seen this module?  I saw a reference to it on Perlmonks
> the other day, so I gave it a quick look.  After a quick perusal of the
> documentation, it seemed that the module does most of the work as far as
> writing the Javascript you need to update the contents of named divs.

I've heard it mentioned, but I haven't used it.  The module I hear more
about is HTML::Prototype, which gives you a Perl interface to building
things with the Prototype JS library.

> So, I decided that the easiest way to work with a directory of images
> was to generate a javascript array of all the images and stuff that into
> my template.

On a side note, here, I recently started using Data::JavaScript::Anon,
and I quite like it.  It dumps simple Perl structures into equivalent
JavaScript structures.

> I guess what I am saying is that this module looks very easy to use, and
> is probably worth looking at...  If you actually REALLY have a use for
> AJAX :).  Has anyone else looked at it, or any other modules related to
> AJAX?

Not much.  I should, I know Rubric could benefit from some smarter
controls, but it's never been a top priority.  I probably will get to it
soon, for HTML::Widget::Factory.  I use that to provide Template Toolkit
templates with an easy way to do something like this:

  widget.input(name => "first_name")

...and that produces:

  <input name="first_name" />

...unless the widget factory was told it was OK to get the values from
some existing CGI.pm or similar obejct, in which case it might produce:

  <input name="first_name" value="Joe &amp; Jane" />

Widgets are plugins, and yesterday I wrote a plugin to produce a field
with a pop-up calendar using the totally awesome jscalendar.

  http://www.dynarch.com/projects/calendar/

To make a field that has a pop-up calendar, I just say:

  widget.calendar(id => "birthday")

and I get all the JavaScript, HTML, etc, put there for me.  I can pass
any of the options to jscalendar, too, and they're translated from Perl
to JS and fed to jscalendar.

Once I write more of these, I will probably start feeling like doing
more work wiht Ajax-y stuff.  It would be nice to say things like:

  widget.autocomplete(name => "favorite_flavor", options => url(...))

I wish HTTP's successor would show up soon, though.  All this stateless
work is annoying!

-- 
rjbs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/abe-pm/attachments/20051214/62134e96/attachment.bin


More information about the ABE-pm mailing list