Index: Changes.txt =================================================================== --- Changes.txt (revision 0) +++ Changes.txt (revision 0) @@ -0,0 +1,13 @@ +SAJAX CHANGELOG +--------------- + +Sajax version 0.6 (March 8, 2005) + +* Layout of archive changed; base folder changed; subfolders added for backends +* [php] Used short open tags by default. Thanks to Matthew M. Vince. +* [perl] Backend port added. Thanks to Nathan Schmidt, Jason Purdy and Nate + Mueller. +* [python] Backend port added. Thanks to Adam Collard. Please note that + this port is licensed under the Creative Commons "By" License version + 2.0. + Index: perl/example_multiply.cgi =================================================================== --- perl/example_multiply.cgi (revision 0) +++ perl/example_multiply.cgi (revision 0) @@ -0,0 +1,113 @@ +#! /usr/bin/perl -w + +# Perl version cloned from the original PHP by http://www.modernmethod.com/sajax/ +# I've left commented-out examples in the code for running with static methods. +# For moving to ModPerl it's important to no be redefining subs all the time, +# so this code adds the rs_register(funcname,coderef) call, which takes a coderef +# rather than the name of a sub to be called. + + +use Sajax; +use CGI; + +my $q = new CGI; + +my $rv = ""; + +$rv .= "content-type: text/html\n\n"; + + +=pod +#for static method calls +sub Sajax::multiply { + my($x, $y)=@_; + return $x * $y; +} +sub Sajax::divide { + my($x, $y)=@_; + return $x / $y; +} +=cut + +#equivalent modperl methods +my $msub = sub { + my($x, $y)=@_; + return $x * $y; +}; +my $dsub = sub { + my($x, $y)=@_; + return $x / $y; +}; + + + +Sajax::rs_init(); + +#register static methods (called by name) +#Sajax::rs_export("multiply","divide"); + +#modperl methods (called as anonymous coderefs) +Sajax::rs_register("multiply",$msub); +Sajax::rs_register("divide",$dsub); + + +my $handled_value = Sajax::rs_handle_client_request($q); + +if(defined $handled_value) { + $rv .= $handled_value; +} else { + +$rv .= "\n
\n