From thehead at patshead.com Tue Dec 13 20:26:48 2005 From: thehead at patshead.com (Pat Regan) Date: Tue, 13 Dec 2005 23:26:48 -0500 Subject: [ABE.pm] CGI::Ajax Message-ID: <439F9F08.1050705@patshead.com> 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. Anywho, the module made me angry tonight :). It is actually no fault of the module. I wanted to give it a try, and I thought this would be a good excuse to update a very old perl script I wrote to manage my image galleries on my web page. First, I just wanted to test the module... So I wrote a wee bit of code just to pass a filename back to the browser in order to update the current image that is displayed. It only took me about 15 minutes to write the code, it would have taken 5 if I had actually read the documentation and saw that I have to create a reference to a function in the javascript instead of a function. At this point, I was very happy. So I decided to work out how I was going to actually do this. At this point, I should probably say that I am not usually a fan of javascript and generally avoid it at all costs. I just thought it would be fun to seehow much work it would be to write an AJAX page with this module, and how hard it would be to make the same page friendly to non-javascript browsers. 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. And it works quite well, and is quite easy to do... Unfortunately, and this is the part that makes me angry, it doesn't require the use of AJAX in any way :). 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? Pat -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: OpenPGP digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20051214/c6393dc7/signature.bin From rjbs-perl-abe at lists.manxome.org Wed Dec 14 06:09:02 2005 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Wed, 14 Dec 2005 09:09:02 -0500 Subject: [ABE.pm] CGI::Ajax In-Reply-To: <439F9F08.1050705@patshead.com> References: <439F9F08.1050705@patshead.com> Message-ID: <20051214140902.GZ23917@manxome.org> * Pat Regan [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: ...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: 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