-
-
20 Oct 2010 19:51:34 UTC
- Distribution: CGI-Application-Plugin-DetectAjax
- Module version: 0.06
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues
- Testers (815 / 1 / 0)
- Kwalitee
Bus factor: 0- 95.00% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (3.09KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors-
Jiří Pavlovský
- Dependencies
- CGI::Application
- Exporter
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
CGI::Application::Plugin::DetectAjax - check for XMLHttpRequest in CGI::Application based modules
SYNOPSIS
package My::App; use base qw/CGI::Application/; use CGI::Application::Plugin::DetectAjax; ... sub myrunmode { my $self = shift; my $object = MyClass->new; my $result = $object->do_work(); if ($self->is_ajax) { return to_json($result); } else { my $t = $self->load_tmpl('myrunmode.tmpl'); $t->param(RESULT => $result); return $t->output; } }
DESCRIPTION
CGI::Application::Plugin::DetectAjax adds is_ajax method to your CGI::Application modules which detects whether the current request was made by XMLHttpRequest.
METHODS
is_ajax
This method will return true if the current request was made by XMLHttpRequest and false otherwise. It works by checking for 'X-Requested-With' header and its value.
BUGS
Please report any bugs or feature requests to
bug-cgi-application-plugin-ajax@rt.cpan.org
, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.SEE ALSO
CGI::Application, CGI, perl(1)
AUTHOR
Jiří Pavlovský <jira@getnet.cz>
LICENSE
Copyright (C) 2010 Jiří Pavlovský <jira@getnet.cz>
This library is free software. You can modify and or distribute it under the same terms as Perl itself.
Module Install Instructions
To install CGI::Application::Plugin::DetectAjax, copy and paste the appropriate command in to your terminal.
cpanm CGI::Application::Plugin::DetectAjax
perl -MCPAN -e shell install CGI::Application::Plugin::DetectAjax
For more information on module installation, please visit the detailed CPAN module installation guide.