Apache2-Ajax
view release on metacpan or search on metacpan
lib/Apache2/Ajax.pm view on Meta::CPAN
=over
=item * header =E<gt> $header
By default, the only header Apache2::Ajax sets is
the I<Content-Type>, for which I<text/html> is used.
If additional headers are required, they may
be passed as an optional argument in the
form of a hash reference, as in
my $header = {'Content-Type' => 'text/html; charset=utf-8',
'X-err_header_out' => 'err_headers_out',
};
my $ajax = Apache2::Ajax->new($r);
my $html = $ajax->build_html(header => $header);
=item * html =E<gt> \&Show_form
This option specifies the subroutine
provided which generates the html for the web page:
t/ajax/subs.t view on Meta::CPAN
my $res = GET "/$path";
ok t_cmp($res->code, 200, "Checking request was OK");
my $content = $res->content;
ok t_cmp($content, qr{function myfunc},
"Checking presence of myfunc");
ok t_cmp($content, qr{onkeyup},
"Checking presence of onkeyup");
ok t_cmp($content, qr{pjxdebugrequest},
"Checking presence of pjxdebugrequest");
ok t_cmp $res->header('Content-Type'),
'text/html; charset=utf-8',
'Content-Type: made it';
ok t_cmp $res->header('X-err_header_out'),
'err_headers_out',
'X-err_header_out: made it';
t/response/TestAjax/subs.pm view on Meta::CPAN
use strict;
use warnings;
use Apache2::Ajax;
use Apache2::Const -compile => qw(OK SERVER_ERROR);
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::RequestUtil ();
sub handler {
my ($r) = @_;
my $header = {'Content-Type' => 'text/html; charset=utf-8',
'X-err_header_out' => 'err_headers_out',
};
my $ajax = Apache2::Ajax->new($r);
$r->print($ajax->build_html(header => $header));
return Apache2::Const::OK;
}
sub exported_fx {
my $value_a = shift;
my $value_b = shift;
( run in 0.263 second using v1.01-cache-2.11-cpan-4d50c553e7e )