spx2 has asked for the wisdom of the Perl Monks concerning the following question:

I've started reading about ajax here
ajax asp script I've found an asp script on server side that is providing the current time
the script is just this one and it's written in ASP
<% response.expires=-1 response.write(time) %>
The purpose of this script is to return the current time. To be able to follow the tutorial I've written my own in Perl like this
#!/usr/bin/perl -wT use DateTime; print "Content-type: text/html\n\n"; print DateTime->now;
This SHOULD be the equivalent to the above ASP script however,I do not understand
what kind of object is response in ASP and how it works,why it is needed ?

Any clarification is warmly welcomed. Thank you

Replies are listed 'Best First'.
Re: translating ajax+asp -> perl
by Joost (Canon) on Feb 11, 2008 at 20:50 UTC
    This isn't strictly about perl, but I'll let it slide.

    An ASP server hands a page a couple of objects, among which are response and request. Request provides the data sent from the client (browser) to the server, response is the object used by the page to send data back to the client.

    CGI (in any language) is actually a lower-level protocol where the input from the client is sent via environment variables and STDIN (for request bodies) and the CGI program is supposed to provide all output via STDOUT, which then probably gets parsed by the server to extract/process the message headers.

    Other systems use more-or-less different protocols. It's probably even possible to implement most of the ASP protocol on top of CGI or some other system.

    If you're using mod_perl, for instance, most information is available via a single $request object (or objects available via that object) which also handles the response. STDOUT may or may not be tied to the response body.

    In your case, it would probably be a good idea to read up a bit on ASP. Or find some other source of info on Ajax.

    update: see also Apache2::ASP

      Hi, thanks for the answer.Also do you think there is a way to intercept XmlHttpObjects ?