Catalyst::TraitFor::Request::XMLHttpRequest - A request trait for XMLHttpRequest detection support
version 0.01
Setting up the request trait for your application:
package MyApp; use Moose; use CatalystX::RoleApplicator; use namespace::autoclean; extends 'Catalyst'; __PACKAGE__->apply_request_class_roles(qw( Catalyst::TraitFor::Request::XMLHttpRequest )); __PACKAGE__->setup; 1;
Using the trait in your controllers
sub some_action : Path('foo') { my ($self, $ctx) = @_; # do something depending on the request being an XMLHttpRequest or not if ($ctx->request->is_xhr) { ... } else { ... } }
This request trait adds support for detecting XMLHttpRequests to the Catalyst request.
This attribute contains a boolean value indicating whether or not the request is a XMLHttpRequest.
Florian Ragwitz <rafl@debian.org>
This software is copyright (c) 2010 by Florian Ragwitz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Catalyst::TraitFor::Request::XMLHttpRequest, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::TraitFor::Request::XMLHttpRequest
CPAN shell
perl -MCPAN -e shell install Catalyst::TraitFor::Request::XMLHttpRequest
For more information on module installation, please visit the detailed CPAN module installation guide.