I'm trying to create my first site having an AJAX setup using Perl on a free web hosting server. The host has much to be desired. There are Perl modules installed on the server but CGI::Ajax is not installed. I'm new to Perl. Is there a reasonable way to hard-code a simple AJAX setup without using the module I mentioned? Might it have something to do with XMLHttpRequest?
Update: Yeah, I'm reading through the CGI::Ajax module code and comments. I don't suppose I could just extract something out of there and put it into the script that would otherwise call the module? But I'd have to pretty much understand the whole scary module first...
Update: I'm looking into a way to include CGI::Ajax by uploading the module to the same directory as the script that will "use" it, and modifying the @INC path, or something like that...
In all the years I've been writing web applications, I have written more than my fair share of Ajax calls and I have never used CGI::Ajax. In fact, until just now I had never heard of it. I've now skimmed the documentation and I really can't see what advantages it gives you.
There are two parts of an Ajax interaction. The client part runs in the browser and is therefore pretty much always written in Javascript. These days, jQuery makes it pretty much trivial. I can't see how a Perl module would help here.
The server part runs on a web server. All you need is an application which receives an HTTP request and sends an HTTP response. A CGI application written in Perl is one obvious way to write that - but these days I'd be far more likely to use something based on PSGI. You'll probably want your application to return data as JSON and set the Content-type header appropriately and perhaps CGI::Ajax helps with that - but it's not exactly onerous to do it in any other web framework.
So, to summarise:
Update: So, in this case, you don't need to install the extra module. But, in general, your Perl development life will be far easier if you can get modules installed easily when you want them. So I would very much recommend looking for a hosting solution that allows you to do that.
There's nothing special about AJAX requests. They are just like any other web request. The following is a sample web (incl AJAX) request handler:
#!/usr/bin/perl
use strict;
use warnings;
use CGI qw( );
my $cgi = CGI->new();
print $cgi->header('text/plain');
print "Hello, World!\n";