I\'ve used Perl a bit for small applications and test code, but I\'m new to networking and CGI.
I get how to make the header of a request (using CGI.pm and printing
In addition to the CGI.pm http()
method you can get HTTP headers information from the environment variables.
So in case you are using something like CGI::Minimal, which doesn't have the http method. you can do something like:
my $header = 'HTTP_X_REQUESTED_WITH';
if (exists $ENV{$header} && lc $ENV{$header} eq 'xmlhttprequest') {
_do_some_ajaxian_stuff();
}