DISCUSS: CPAN Namespace for AJAX
am 03.08.2005 18:18:42 von lawrenceI have a module that is ready for release, it just needs a (better)
name. The working title has been "Pail" (Perl/Ajax Implementation
Layer) but that does not fill me with joy, as it is utterly opaque.
I have noticed that there appear to be *no* AJAX related modules in
CPAN (which I find difficult to believe), and the only module I have
found OUTSIDE of CPAN was Sajax.pm which is pretty deficient (not
using the "X" in AJAX being at the top of the list.)
Some ideas that I have had:
1) HTTP::AJAX::Pail
Keeps the "cutesy" name, but puts it into a namespace where it will at
least invite reading.
2) HTTP::AJAX::Class
My module is an object-oriented base-class, and as such deserves a
highly generic name. (Although it has two variants, one that provides
XML marshalling for return values, and one that allows arbitrary text
return).
A little detail about the functionality:
On the server side, you write a class
package My::Class;
use base 'HTTP::AJAX::Pail';
sub get_record {
my ($self, $paramhash) = @_ ;
return undef unless exists $paramhash->{record_num};
my $message = do_something($paramhash->{record_num});
return ( { record_num => $paramhash->{record_num} ,
record_text => $message } );
}
1;
In your javascript you do something roughly like:
There are some other details I'm glossing over right now, because they
seem to be outside the scope of the "What do I *CALL* this thing?"
discussion.
FYI (because you're dying to know) - the method=javascript is a
'magical' method that walks your derived class's symbol table, and
creates a javascript class, 'My_Class' with stub routines to build the
AJAX request and fire it off.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - lawrenabae@abaluon.abaom s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
sort them into the correct order.