| 1 | package CGI::Application::Plugin::DetectAjax; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use vars qw($VERSION @EXPORT); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 2 | require Exporter; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 2 | @CGI::Application::Plugin::DetectAjax::ISA = qw(Exporter); | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 2 | $VERSION = '0.06'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 2 | @EXPORT = qw( | |||||||||||||||||||||||||||
| 13 | is_ajax | ||||||||||||||||||||||||||||
| 14 | ); | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 3 | ▶ | sub is_ajax { | ||||||||||||||||||||||||||
|
Subroutine
is_ajax: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 3 | my $header = 'HTTP_X_REQUESTED_WITH'; | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 3 | ▶ | if (exists $ENV{$header} && lc $ENV{$header} eq 'xmlhttprequest') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $ENV{$header} and lc $ENV{$header} eq "xmlhttprequest"
MC/DC50%1/2
exists $ENV{$header} and lc $ENV{$header} eq "xmlhttprequest"
exists $ENV{$header}
lc $ENV{$header} eq "xmlhttprequest"
Truth table66%2/3
A and B
A= exists $ENV{$header}B= lc $ENV{$header} eq "xmlhttprequest"
| |||||||||||||||||||||||||||||
| 24 | 1 | return 1; | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | else { | ||||||||||||||||||||||||||||
| 27 | 2 | return 0; | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 2 | 1; | |||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | __END__ | ||||||||||||||||||||||||||||