| 1 | package Amon2::Plugin::Web::HTTPSession; | ||||||||||||||||||||||||
| 2 | 1 | ▶ | use 5.008005; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||
| 6 | 1 | our $VERSION = "5.04"; | |||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||
| 8 | 1 | ▶ | use HTTP::Session; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 9 | 1 | ▶ | use Amon2::Util; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 10 | 1 | ▶ | use Plack::Util (); | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 11 | 1 | ▶ | use Plack::Request; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||
| 13 | 0 | ▶ | sub init { | ||||||||||||||||||||||
|
Subroutine
init: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||
| 14 | 0 | my ($class, $c, $conf) = @_; | |||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||
| 16 | 0 | ▶ | my $state_conf = $conf->{state} or die "missing configuration : state"; | ||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||
| 17 | 0 | ▶ | my $store_conf = $conf->{store} or die "missing configuration : store"; | ||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||
| 18 | 0 | my $state_code = $class->_load($state_conf, 'HTTP::Session::State'); | |||||||||||||||||||||||
| 19 | 0 | my $store_code = $class->_load($store_conf, 'HTTP::Session::Store'); | |||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||
| 21 | 0 | ▶ | Amon2::Util::add_method($c, session => sub { | ||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||
| 22 | 0 | my $self = shift; | |||||||||||||||||||||||
| 23 | 0 | ▶ | $self->{+__PACKAGE__} ||= do { | ||||||||||||||||||||||
|
Condition0%0/3
$self->{"Amon2::Plugin::Web::HTTPSession"} ||= do {
"HTTP::Session"->new("state", &$state_code($self), "store", &$store_code($self), "request", "Plack::Request"->new($self->request->env))
}
MC/DC0%0/2
$self->{"Amon2::Plugin::Web::HTTPSession"} ||= do {
"HTTP::Session"->new("state", &$state_code($self), "store", &$store_code($self), "request", "Plack::Request"->new($self->request->env))
}
$self->{"Amon2::Plugin::Web::HTTPSession"}
do {
"HTTP::Session"->new("state", &$state_code($self), "store", &$store_code($self), "request", "Plack::Request"->new($self->request->env))
}
Truth table0%0/3
A ||= B
A= $self->{"Amon2::Plugin::Web::HTTPSession"}B= do {
"HTTP::Session"->new("state", &$state_code($self), "store", &$store_code($self), "request", "Plack::Request"->new($self->request->env))
}
| |||||||||||||||||||||||||
| 24 | 0 | HTTP::Session->new( | |||||||||||||||||||||||
| 25 | state => $state_code->($self), | ||||||||||||||||||||||||
| 26 | store => $store_code->($self), | ||||||||||||||||||||||||
| 27 | # Note: Do not decode session id | ||||||||||||||||||||||||
| 28 | request => Plack::Request->new($self->request->env), | ||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||
| 30 | }; | ||||||||||||||||||||||||
| 31 | 0 | }); | |||||||||||||||||||||||
| 32 | 0 | ▶ | $c->add_trigger(AFTER_DISPATCH => sub { | ||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||
| 33 | 0 | my ($self, $res) = @_; | |||||||||||||||||||||||
| 34 | 0 | ▶ | if (my $session = $self->{+__PACKAGE__}) { | ||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||
| 35 | 0 | $session->response_filter($res); | |||||||||||||||||||||||
| 36 | 0 | $session->finalize(); | |||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||
| 38 | 0 | }); | |||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||
| 41 | 0 | ▶ | sub _load { | ||||||||||||||||||||||
|
Subroutine
_load: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||
| 42 | 0 | my ($class, $stuff, $namespace) = @_; | |||||||||||||||||||||||
| 43 | 0 | ▶ | if (ref $stuff) { | ||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||
| 44 | 0 | ▶ | if (ref $stuff eq 'CODE') { | ||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||
| 45 | 0 | return $stuff; | |||||||||||||||||||||||
| 46 | } else { | ||||||||||||||||||||||||
| 47 | 0 | ▶ | return sub { $stuff }; | ||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||
| 49 | } else { | ||||||||||||||||||||||||
| 50 | 0 | my $store_class = Plack::Util::load_class($stuff, $namespace); | |||||||||||||||||||||||
| 51 | 0 | my $store_obj; | |||||||||||||||||||||||
| 52 | 0 | ▶ | return sub { | ||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||
| 53 | 0 | ▶ | $store_obj ||= do { | ||||||||||||||||||||||
|
Condition0%0/3
$store_obj ||= do {
my $config ||= "Amon2"->context->config->{$store_class} || {};
$store_class->new($config)
}
MC/DC0%0/2
$store_obj ||= do {
my $config ||= "Amon2"->context->config->{$store_class} || {};
$store_class->new($config)
}
$store_obj
do {
my $config ||= "Amon2"->context->config->{$store_class} || {};
$store_class->new($config)
}
Truth table0%0/3
A ||= B
A= $store_objB= do {
my $config ||= "Amon2"->context->config->{$store_class} || {};
$store_class->new($config)
}
| |||||||||||||||||||||||||
| 54 | 0 | ▶ | my $config ||= Amon2->context->config->{$store_class} || {}; | ||||||||||||||||||||||
|
Condition0%0/5
my $config ||= "Amon2"->context->config->{$store_class} || {}
'Amon2'->context->config->{$store_class} || {}
MC/DC0%0/2
my $config ||= "Amon2"->context->config->{$store_class} || {}
my $config
'Amon2'->context->config->{$store_class}
Truth table0%0/3
A ||= B
A= my $configB= 'Amon2'->context->config->{$store_class}
| |||||||||||||||||||||||||
| 55 | 0 | $store_class->new($config); | |||||||||||||||||||||||
| 56 | }; | ||||||||||||||||||||||||
| 57 | 0 | }; | |||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||
| 62 | 1 | 1; | |||||||||||||||||||||||
| 63 | __END__ | ||||||||||||||||||||||||