| 1 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | package Jifty::Request; | ||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Any::Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | extends 'Jifty::Object'; | |||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 0 | ▶ | has 'env' => (is => "ro", isa => "HashRef", default => sub { {} }); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | has '_top_request' => (is => 'rw'); | |||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | has 'arguments' => (is => 'rw'); | |||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | has 'template_arguments' => (is => 'rw'); | |||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | has 'just_validating' => (is => 'rw'); | |||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | has 'continuation_id' => (is => 'rw'); | |||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | has 'future_continuation_id' => (is => 'rw'); | |||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | has 'continuation_type' => (is => 'rw'); | |||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | has 'continuation_path' => (is => 'rw'); | |||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | ▶ | has 'parameters' => (is => 'rw', isa => 'HashRef', default => sub { {} }); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | has 'uploads' => (is => 'rw', isa => 'HashRef'); | |||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | has 'headers' => (is => 'rw', isa => 'HTTP::Headers', default => sub { HTTP::Headers->new }); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | has 'uri' => (is => 'rw', isa => 'URI', default => sub { URI->new('http:///') }); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | has 'cookies' => (is => 'rw', isa => 'HashRef', default => sub { {} } ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | has 'scheme' => (is => "rw", isa => "Str", default => sub { 'http' }); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | has 'request_uri' => ( | |||||||||||||||||||||||||||||||||||||||||
| 27 | is => "rw", | ||||||||||||||||||||||||||||||||||||||||||
| 28 | isa => "Str", | ||||||||||||||||||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | sub address { $_[0]->env->{REMOTE_ADDR} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
address: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | sub remote_host { $_[0]->env->{REMOTE_HOST} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remote_host: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | sub protocol { $_[0]->env->{SERVER_PROTOCOL} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
protocol: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub method { $_[0]->env->{REQUEST_METHOD} = $_[1] if @_ > 1; $_[0]->env->{REQUEST_METHOD} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | sub request_method { Carp::carp "request_method is deprecated, use method instead"; goto \&method } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
request_method: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | sub port { $_[0]->env->{SERVER_PORT} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
port: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | sub user { $_[0]->env->{REMOTE_USER} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
user: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | sub path_info { $_[0]->env->{PATH_INFO} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
path_info: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | sub script_name { $_[0]->env->{SCRIPT_NAME} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
script_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | sub secure { $_[0]->scheme eq 'https' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
secure: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | sub body { $_[0]->env->{'psgi.input'} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
body: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | sub input { $_[0]->env->{'psgi.input'} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
input: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | sub header { shift->headers->header(@_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
header: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
path: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | return @_ == 1 ? $_[0]->uri->path | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | : $_[0]->uri->path( Jifty::Util->canonicalize_path( $_[1], 1 ) ) | ||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | sub content_length { shift->headers->content_length(@_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
content_length: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | sub content_type { shift->headers->content_type(@_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
content_type: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | sub referer { shift->headers->referer(@_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
referer: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | sub user_agent { shift->headers->user_agent(@_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
user_agent: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | ▶ | use Jifty::JSON; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 1 | ▶ | use Jifty::YAML; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 1 | ▶ | use Jifty::Web::FileUpload; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 1 | ▶ | use Plack::Util (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | Jifty::Request - Canonical internal representation of an incoming Jifty request | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | This document discusses the ins and outs of getting data from the web | ||||||||||||||||||||||||||||||||||||||||||
| 66 | browser (or any other source) and figuring out what it means. Most of | ||||||||||||||||||||||||||||||||||||||||||
| 67 | the time, you won't need to worry about the details, but they are | ||||||||||||||||||||||||||||||||||||||||||
| 68 | provided below if you're curious. | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | This class parses the submission and makes it available as a | ||||||||||||||||||||||||||||||||||||||||||
| 71 | protocol-independent B<Jifty::Request> object. | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | Each request contains several types of information: | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | =item actions | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | A request may contain one or more actions; these are represented as | ||||||||||||||||||||||||||||||||||||||||||
| 80 | L<Jifty::Request::Action> objects. Each action request has a | ||||||||||||||||||||||||||||||||||||||||||
| 81 | L<moniker|Jifty::Manual::Glossary/moniker>, a set of submitted | ||||||||||||||||||||||||||||||||||||||||||
| 82 | L<arguments|Jifty::Manual::Glossary/arguments>, and an implementation | ||||||||||||||||||||||||||||||||||||||||||
| 83 | class. By default, all actions that are submitted are run; it is | ||||||||||||||||||||||||||||||||||||||||||
| 84 | possible to only mark a subset of the submitted actions as "active", | ||||||||||||||||||||||||||||||||||||||||||
| 85 | and only the active actions will be run. These will eventually become | ||||||||||||||||||||||||||||||||||||||||||
| 86 | full-fledged L<Jifty::Action> objects. | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | =item state variables | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | State variables are used to pass around bits of information which are | ||||||||||||||||||||||||||||||||||||||||||
| 91 | needed more than once but not often enough to be stored in the | ||||||||||||||||||||||||||||||||||||||||||
| 92 | session. Additionally, they are per-browser window, unlike session | ||||||||||||||||||||||||||||||||||||||||||
| 93 | information. | ||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | =item continuations | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | Continuations can be called or created during the course of a request, | ||||||||||||||||||||||||||||||||||||||||||
| 98 | though each request has at most one "current" continuation. See | ||||||||||||||||||||||||||||||||||||||||||
| 99 | L<Jifty::Continuation>. | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | =item (optional) fragments | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | L<Fragments|Jifty::Manual::Glossary/fragments> are standalone bits of | ||||||||||||||||||||||||||||||||||||||||||
| 104 | reusable code. They are most commonly used in the context of AJAX, | ||||||||||||||||||||||||||||||||||||||||||
| 105 | where fragments are the building blocks that can be updated | ||||||||||||||||||||||||||||||||||||||||||
| 106 | independently. A request is either for a full page, or for multiple | ||||||||||||||||||||||||||||||||||||||||||
| 107 | independent fragments. See L<Jifty::Web::PageRegion>. | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | =head1 REQUEST PROPERTIES | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | =head2 address | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | =head2 arguments | ||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | =head2 body | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | =head2 content_length | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | =head2 content_type | ||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | =head2 cookies | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | =head2 env | ||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | =head2 header | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | =head2 headers | ||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | =head2 input | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | =head2 method | ||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | =head2 request_method (deprecated) | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | =head2 path | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | =head2 path_info | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | =head2 port | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | =head2 protocol | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | =head2 referer | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | =head2 remote_host | ||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | =head2 request_uri | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | =head2 scheme | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | =head2 script_name | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | =head2 secure | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | =head2 uploads | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | =head2 uri | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | =head2 user | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | =head2 user_agent | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | =head2 BUILD PARAMHASH | ||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | Creates a new request object. For each key in the C<PARAMHASH>, the | ||||||||||||||||||||||||||||||||||||||||||
| 170 | method of that name is called, with the C<PARAMHASH>'s value as its | ||||||||||||||||||||||||||||||||||||||||||
| 171 | sole argument. | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | sub BUILD { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | my ($args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | $self->setup_subrequest_env if Jifty->web->request; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | $self->{'actions'} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | $self->{'state_variables'} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | $self->{'fragments'} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | $self->method('GET') unless $self->method; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | $self->path($args->{path}) if $args->{path}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | $self->arguments({}); | |||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | $self->template_arguments({}); | |||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | =head2 setup_subrequest_env | ||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | Copies the bare minimals of the plack environment from the top | ||||||||||||||||||||||||||||||||||||||||||
| 194 | request; this is called in L</BUILD> if the request is a subrequest. | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | sub setup_subrequest_env { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setup_subrequest_env: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 200 | # Copy a bunch of information off of the top Plack request | ||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | my $env = Jifty->web->request->top_request->env; | |||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | $self->{env} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | $self->{env}{$_} = $env->{$_} for qw/psgi.version psgi.multithread psgi.multiprocess psgi.errors/; | |||||||||||||||||||||||||||||||||||||||||
| 204 | # Stub in an empty input filehandle | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | $self->{env}{"psgi.input"} = Plack::Util::inline_object( read => sub {0} ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | =head2 clone | ||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | Return a copy of the request. | ||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | sub clone { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | # "Semi-shallow" clone | ||||||||||||||||||||||||||||||||||||||||||
| 218 | my $ret = bless({map { | ||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | my $val = $self->{$_}; | |||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | $_ => (ref($val) eq "HASH" ? { %$val } : ref($val) eq "ARRAY" ? [ @$val ] : $val); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | } keys %$self}, ref($self)); | ||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | $ret->uri( $self->uri->clone ); | |||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | return $ret; | |||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | =head2 promote | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | Attempt to fill in the request from any number of various methods -- | ||||||||||||||||||||||||||||||||||||||||||
| 230 | YAML, JSON, etc. Falls back to query parameters. Takes a | ||||||||||||||||||||||||||||||||||||||||||
| 231 | L<Plack::Request> object. | ||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | sub promote { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
promote: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | my ($req) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | die Carp::longmess("old calling style") unless ref $req; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | # Import all props from Plack::Request object | ||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | # path of $req->uri is escaped by Plack::Request, we want it unescaped here | ||||||||||||||||||||||||||||||||||||||||||
| 244 | # see also http://github.com/miyagawa/Plack/commit/a01c607cb6d0b6470308987cb94aa4b011c2d7ff | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | my $uri = $req->uri; | |||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | $uri->path( URI::Escape::uri_unescape( $uri->path ) ); | |||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | my $self = $class->new( env => $req->env, | |||||||||||||||||||||||||||||||||||||||||
| 249 | headers => $req->headers, | ||||||||||||||||||||||||||||||||||||||||||
| 250 | parameters => $req->parameters->mixed, | ||||||||||||||||||||||||||||||||||||||||||
| 251 | uploads => $req->uploads->mixed, | ||||||||||||||||||||||||||||||||||||||||||
| 252 | scheme => $req->scheme, | ||||||||||||||||||||||||||||||||||||||||||
| 253 | uri => $uri, | ||||||||||||||||||||||||||||||||||||||||||
| 254 | request_uri => $req->request_uri, | ||||||||||||||||||||||||||||||||||||||||||
| 255 | cookies => $req->cookies, | ||||||||||||||||||||||||||||||||||||||||||
| 256 | actions => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 257 | state_variables => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 258 | fragments => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 259 | arguments => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 260 | template_arguments => {} ); | ||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | # Grab content type and posted data, if any | ||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | my $ct = $req->content_type || 'application/octet-stream'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$req->content_type || 'application/octet-stream'
MC/DC0%0/1
$req->content_type || 'application/octet-stream'
$req->content_type
Truth table0%0/2
A
A= $req->content_type
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | my $data = $req->content; | |||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | # Check it for something appropriate | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | ▶ | if ($data) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | if ($ct =~ m{^text/x-json}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | return $self->from_data_structure(eval{Jifty::JSON::decode_json($data)}); | |||||||||||||||||||||||||||||||||||||||||
| 270 | } elsif ($ct =~ m{^text/x-yaml}) { | ||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | return $self->from_data_structure(eval{Jifty::YAML::Load($data)}); | |||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||
| 275 | # Fall back on using the straight HTTP arguments | ||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | return $self->from_args; | |||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | =head2 from_data_structure | ||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | Fills in the request from a data structure. This is called once the | ||||||||||||||||||||||||||||||||||||||||||
| 282 | YAML or JSON has been parsed. See L</SERIALIZATION> for details of | ||||||||||||||||||||||||||||||||||||||||||
| 283 | how to construct a proper data structure. | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | Returns itself. | ||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | sub from_data_structure { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
from_data_structure: not called CC=28 SCAR=67.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | my $path = $data->{'path'}; | |||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | $path ||= $self->path || '/'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$path ||= $self->path || "/"
$self->path || '/'
MC/DC0%0/2
$path ||= $self->path || "/"
$path
$self->path
Truth table0%0/3
A ||= B
A= $pathB= $self->path
| |||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | $self->path( $path ); | |||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | $self->just_validating( $data->{validating} ) if $data->{validating}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | ▶ | if ( ref $data->{continuation} eq "HASH" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 300 | # Back-compat | ||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | $data->{continuation}{current} ||= $data->{continuation}{id}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$data->{"continuation"}{"current"} ||= $data->{"continuation"}{"id"}
MC/DC0%0/2
$data->{"continuation"}{"current"} ||= $data->{"continuation"}{"id"}
$data->{"continuation"}{"current"}
$data->{"continuation"}{"id"}
Truth table0%0/3
A ||= B
A= $data->{"continuation"}{"current"}B= $data->{"continuation"}{"id"}
| |||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | delete $data->{continuation}{id} if ($data->{continuation}{type} || "") eq "parent"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$data->{'continuation'}{'type'} || ''
MC/DC0%0/1
$data->{'continuation'}{'type'} || ''
$data->{'continuation'}{'type'}
Truth table0%0/2
A
A= $data->{'continuation'}{'type'}
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | $self->continuation_id( $data->{continuation}{current} ); | |||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | $self->future_continuation_id( $data->{continuation}{id} ); | |||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | $self->continuation_type( $data->{continuation}{type} ); | |||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | $self->continuation_path( $data->{continuation}{create} ); | |||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | my %actions = %{ $data->{actions} || {} }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$data->{'actions'} || {}
MC/DC0%0/1
$data->{'actions'} || {}
$data->{'actions'}
Truth table0%0/2
A
A= $data->{'actions'}
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | for my $moniker ( keys %actions ) { | |||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | my $a = $actions{$moniker}; | |||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | next unless ref $a eq "HASH"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | my %arguments; | |||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | if ( exists $a->{fields} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | ▶ | for my $arg ( keys %{ $a->{fields} || {} } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$a->{'fields'} || {}
MC/DC0%0/1
$a->{'fields'} || {}
$a->{'fields'}
Truth table0%0/2
A
A= $a->{'fields'}
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | if ( ref $a->{fields}{$arg} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | for my $type (qw/fallback value/) { | |||||||||||||||||||||||||||||||||||||||||
| 320 | $arguments{$arg} = $a->{fields}{$arg}{$type} | ||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | if exists $a->{fields}{$arg}{$type}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||
| 323 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | $arguments{$arg} = $a->{fields}{$arg}; | |||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||
| 327 | } elsif ( exists $a->{params} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | %arguments = %{$a->{params}}; | |||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | $self->add_action( | ||||||||||||||||||||||||||||||||||||||||||
| 332 | moniker => $a->{moniker} || $moniker, | ||||||||||||||||||||||||||||||||||||||||||
| 333 | class => $a->{class}, | ||||||||||||||||||||||||||||||||||||||||||
| 334 | order => $a->{order}, | ||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | active => exists $a->{active} ? $a->{active} : 1, | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$a->{'moniker'} || $moniker
MC/DC0%0/2
$a->{'moniker'} || $moniker
$a->{'moniker'}
$moniker
Truth table0%0/3
A || B
A= $a->{'moniker'}B= $moniker
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | arguments => \%arguments, | ||||||||||||||||||||||||||||||||||||||||||
| 337 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | my %variables | ||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | = ref $data->{variables} eq "HASH" ? %{ $data->{variables} } : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | for my $v ( keys %variables ) { | |||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | $self->add_state_variable( key => $v, value => $variables{$v} ); | |||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | my %fragments | ||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | = ref $data->{fragments} eq "HASH" ? %{ $data->{fragments} } : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | for my $f ( values %fragments ) { | |||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | next unless ref $f eq "HASH"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 350 | my $current = $self->add_fragment( | ||||||||||||||||||||||||||||||||||||||||||
| 351 | name => $f->{name}, | ||||||||||||||||||||||||||||||||||||||||||
| 352 | path => $f->{path}, | ||||||||||||||||||||||||||||||||||||||||||
| 353 | arguments => $f->{args}, | ||||||||||||||||||||||||||||||||||||||||||
| 354 | wrapper => $f->{wrapper} || 0, | ||||||||||||||||||||||||||||||||||||||||||
| 355 | in_form => $f->{in_form}, | ||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$f->{'wrapper'} || 0
MC/DC0%0/1
$f->{'wrapper'} || 0
$f->{'wrapper'}
Truth table0%0/2
A
A= $f->{'wrapper'}
| |||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | ▶ | while ( ref $f->{parent} eq "HASH" and $f = $f->{parent} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $f->{"parent"} eq "HASH" and $f = $f->{"parent"}
MC/DC0%0/2
ref $f->{"parent"} eq "HASH" and $f = $f->{"parent"}
ref $f->{"parent"} eq "HASH"
$f = $f->{"parent"}
Truth table0%0/3
A and B
A= ref $f->{"parent"} eq "HASH"B= $f = $f->{"parent"}
| |||||||||||||||||||||||||||||||||||||||||||
| 358 | $current = $current->parent( | ||||||||||||||||||||||||||||||||||||||||||
| 359 | Jifty::Request::Fragment->new( | ||||||||||||||||||||||||||||||||||||||||||
| 360 | { name => $f->{name}, | ||||||||||||||||||||||||||||||||||||||||||
| 361 | path => $f->{path}, | ||||||||||||||||||||||||||||||||||||||||||
| 362 | arguments => $f->{args}, | ||||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||
| 364 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | =head2 from_args REQ | ||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | Calls C<from_webform> with the L<Plack::Request/parameters> | ||||||||||||||||||||||||||||||||||||||||||
| 375 | after splitting C<|>'s in argument names. See L</argument munging>. | ||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||
| 377 | Returns itself. | ||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||
| 379 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | sub from_args { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
from_args: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | my %args = %{ $self->parameters }; | |||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||
| 386 | # Either CGI.pm or HTML::Mason should really deal with encoding for us. | ||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | for my $k (keys %args) { | |||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | my $val = $args{$k}; | |||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | if(ref($val) && ref($val) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
ref $val and ref $val eq "ARRAY"
MC/DC0%0/2
ref $val and ref $val eq "ARRAY"
ref $val
ref $val eq "ARRAY"
Truth table0%0/3
A and B
A= ref $valB= ref $val eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 390 | $args{$k} = [ | ||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | map { Jifty::I18N->promote_encoding( $_, $self->content_type ) } | |||||||||||||||||||||||||||||||||||||||||
| 392 | @$val | ||||||||||||||||||||||||||||||||||||||||||
| 393 | ]; | ||||||||||||||||||||||||||||||||||||||||||
| 394 | } elsif(!ref($val)) { | ||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | $args{$k} = Jifty::I18N->promote_encoding($val, $self->content_type); | |||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | my $uploads = $self->uploads; | |||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | for my $k ( keys %$uploads ) { | |||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | my $val = $uploads->{$k}; | |||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | if ( ref $val eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 403 | $args{$k} = | ||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | [ map { Jifty::Web::FileUpload->new_from_plack($_) } @$val ]; | |||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||
| 406 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | $args{$k} = Jifty::Web::FileUpload->new_from_plack($val); | |||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | my @splittable_names = grep /=|\|/, keys %args; | |||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | for my $splittable (@splittable_names) { | |||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | delete $args{$splittable}; | |||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | for my $newarg (split /\|/, $splittable) { | |||||||||||||||||||||||||||||||||||||||||
| 414 | # If your key has a '=', you may just lose | ||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | my ($k, $v) = split /=/, $newarg, 2; | |||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | $args{$k} = $v; | |||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | return $self->from_webform( %args ); | |||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||
| 422 | =head2 from_webform %QUERY_ARGS | ||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||
| 424 | Parses web form arguments into the Jifty::Request data structure. | ||||||||||||||||||||||||||||||||||||||||||
| 425 | Takes in the query arguments. See L</SERIALIZATION> for details of how | ||||||||||||||||||||||||||||||||||||||||||
| 426 | query parameters are parsed. | ||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||
| 428 | Returns itself. | ||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||
| 430 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | ▶ | sub from_webform { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
from_webform: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | my %args = (@_); | |||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||
| 437 | # Pull in all of the arguments | ||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | $self->arguments(\%args); | |||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | # Extract actions and state variables | ||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | $self->from_data_structure($self->webform_to_data_structure(%args)); | |||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 444 | } | ||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||
| 446 | =head2 argument KEY [=> VALUE] | ||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||
| 448 | Merges a single query parameter into the request. This may add | ||||||||||||||||||||||||||||||||||||||||||
| 449 | actions, change action arguments, or change state variables. | ||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||
| 451 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | ▶ | sub argument { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
argument: not called CC=15 SCAR=54.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | $self->arguments->{$key} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | # Continuation type is often undef, so give it a sane default | ||||||||||||||||||||||||||||||||||||||||||
| 463 | # so we can use eq without warnings | ||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | ▶ | my $cont_type = $self->continuation_type || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->continuation_type || ''
MC/DC0%0/1
$self->continuation_type || ''
$self->continuation_type
Truth table0%0/2
A
A= $self->continuation_type
| |||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | ▶ | if ($key eq "J:VALIDATE") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | $self->{validating} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 468 | } elsif ($key eq "J:C") { | ||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | $self->continuation_id($value); | |||||||||||||||||||||||||||||||||||||||||
| 470 | ▶ | } elsif ($key eq "J:CALL" and $cont_type ne "return") { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$key eq "J:CALL" and $cont_type ne "return"
MC/DC0%0/2
$key eq "J:CALL" and $cont_type ne "return"
$key eq "J:CALL"
$cont_type ne "return"
Truth table0%0/3
A and B
A= $key eq "J:CALL"B= $cont_type ne "return"
| |||||||||||||||||||||||||||||||||||||||||||
| 471 | # J:CALL doesn't take preference over J:RETURN | ||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | $self->future_continuation_id($value); | |||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | $self->continuation_type("call"); | |||||||||||||||||||||||||||||||||||||||||
| 474 | } elsif ($key eq "J:RETURN") { | ||||||||||||||||||||||||||||||||||||||||||
| 475 | # J:RETURN trumps all | ||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | $self->future_continuation_id($value); | |||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | $self->continuation_type("return"); | |||||||||||||||||||||||||||||||||||||||||
| 478 | } elsif ($key eq "J:PATH") { | ||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | $self->continuation_path($value); | |||||||||||||||||||||||||||||||||||||||||
| 480 | } elsif ($key =~ /^J:V-(.*)/s) { | ||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | $self->add_state_variable(key => $1, value => $value); | |||||||||||||||||||||||||||||||||||||||||
| 482 | } elsif ($key =~ /^J:A-(?:(\d+)-)?(.+)/s) { | ||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | $self->add_action(moniker => $2, class => $value, order => $1, arguments => {}, active => 1); | |||||||||||||||||||||||||||||||||||||||||
| 484 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 485 | # It's possibly a form field | ||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | my ($t, $a, $m) = $self->parse_form_field_name($key); | |||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | ▶ | if ($t and $t eq "J:A:F" and $self->action($m)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$t and $t eq "J:A:F" and $self->action($m)
$t and $t eq "J:A:F"
MC/DC0%0/3
$t and $t eq "J:A:F" and $self->action($m)
$t
$t eq "J:A:F"
$self->action($m)
Truth table0%0/4
A and B and C
A= $tB= $t eq "J:A:F"C= $self->action($m)
| |||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | $self->action($m)->argument($a => $value); | |||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | $self->action($m)->modified(1); | |||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | defined(my $val = $self->arguments->{$key}) or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | $val; | |||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||
| 499 | =head2 template_argument KEY [=> VALUE] | ||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||
| 501 | Sets an argument for the current template. Template arguments, unlike | ||||||||||||||||||||||||||||||||||||||||||
| 502 | values set via L</argument>, B<cannot> add actions, change action | ||||||||||||||||||||||||||||||||||||||||||
| 503 | argument, or change state variables. They are also not stored in | ||||||||||||||||||||||||||||||||||||||||||
| 504 | continuations. | ||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||
| 506 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | ▶ | sub template_argument { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
template_argument: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | ▶ | $self->template_arguments({}) unless $self->template_arguments; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | $self->template_arguments->{$key} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | ▶ | defined(my $val = $self->template_arguments->{$key}) or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | $val; | |||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||
| 521 | =head2 delete KEY | ||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||
| 523 | Removes the argument supplied -- this is the opposite of L</argument>, | ||||||||||||||||||||||||||||||||||||||||||
| 524 | above. | ||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||
| 526 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | ▶ | sub delete { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | ▶ | $self->template_arguments({}) unless $self->template_arguments; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | ▶ | if (exists $self->template_arguments->{$key}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | delete $self->template_arguments->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | delete $self->arguments->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | ▶ | if ($key =~ /^J:A-(?:(\d+)-)?(.+)/s) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | $self->remove_action($2); | |||||||||||||||||||||||||||||||||||||||||
| 540 | ▶ | } elsif ($key =~ /^J:A:F-(\w+)-(.+)/s and $self->action($2)) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$key =~ /^J:A:F-(\w+)-(.+)/s and $self->action($2)
MC/DC0%0/2
$key =~ /^J:A:F-(\w+)-(.+)/s and $self->action($2)
$key =~ /^J:A:F-(\w+)-(.+)/s
$self->action($2)
Truth table0%0/3
A and B
A= $key =~ /^J:A:F-(\w+)-(.+)/sB= $self->action($2)
| |||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | $self->action($2)->delete($1); | |||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | $self->action($2)->modified(1); | |||||||||||||||||||||||||||||||||||||||||
| 543 | } elsif ($key =~ /^J:V-(.*)/s) { | ||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | $self->remove_state_variable($1); | |||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||
| 546 | } | ||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||
| 548 | =head2 parse_form_field_name FIELDNAME | ||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||
| 550 | Takes a form field name generated by a Jifty action. | ||||||||||||||||||||||||||||||||||||||||||
| 551 | Returns a tuple of | ||||||||||||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||||||||||||
| 553 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||
| 555 | =item type | ||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||
| 557 | A slightly-too-opaque identifier | ||||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||
| 559 | =item moniker | ||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||
| 561 | The moniker for this field's action. | ||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||
| 563 | =item argument name | ||||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||
| 565 | The argument name. | ||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||
| 568 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||
| 570 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | ▶ | sub parse_form_field_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_form_field_name: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | my $field_name = shift; | |||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | my ( $type, $argument, $moniker ); | |||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | ▶ | if ( $field_name =~ /^(.*?)-(\w+)-(.*)$/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | $type = $1; | |||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | $argument = $2; | |||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | $moniker = $3; | |||||||||||||||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||
| 583 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | return ( $type, $argument, $moniker ); | |||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||
| 590 | =head2 webform_to_data_structure HASHREF | ||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||
| 592 | Converts the data from a webform's %args to the data structure that | ||||||||||||||||||||||||||||||||||||||||||
| 593 | L<Jifty::Request> uses internally. | ||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||
| 595 | XXX TODO: ALEX: DOC ME | ||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||
| 597 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | ▶ | sub webform_to_data_structure { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
webform_to_data_structure: not called CC=20 SCAR=60.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | my %args = (@_); | |||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | my $data = {actions => {}, variables => {}}; | |||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||
| 606 | # Pass path through | ||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | $data->{path} = $self->path; | |||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | ▶ | $data->{validating} = $args{'J:VALIDATE'} if defined $args{'J:VALIDATE'} and length $args{'J:VALIDATE'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $args{"J:VALIDATE"} and length $args{"J:VALIDATE"}
MC/DC0%0/2
defined $args{"J:VALIDATE"} and length $args{"J:VALIDATE"}
defined $args{"J:VALIDATE"}
length $args{"J:VALIDATE"}
Truth table0%0/3
A and B
A= defined $args{"J:VALIDATE"}B= length $args{"J:VALIDATE"}
| |||||||||||||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||||||||||||
| 611 | # Continuations | ||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | ▶ | if ($args{'J:C'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | $data->{continuation}{current} = $args{'J:C'}; | |||||||||||||||||||||||||||||||||||||||||
| 614 | } | ||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | ▶ | if ($args{'J:CALL'} or $args{'J:RETURN'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"J:CALL"} or $args{"J:RETURN"}
MC/DC0%0/2
$args{"J:CALL"} or $args{"J:RETURN"}
$args{"J:CALL"}
$args{"J:RETURN"}
Truth table0%0/3
A or B
A= $args{"J:CALL"}B= $args{"J:RETURN"}
| |||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | ▶ | $data->{continuation}{id} = $args{'J:RETURN'} || $args{'J:CALL'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$args{'J:RETURN'} || $args{'J:CALL'}
MC/DC0%0/2
$args{'J:RETURN'} || $args{'J:CALL'}
$args{'J:RETURN'}
$args{'J:CALL'}
Truth table0%0/3
A || B
A= $args{'J:RETURN'}B= $args{'J:CALL'}
| |||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | ▶ | $data->{continuation}{type} = "call" if $args{'J:CALL'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | ▶ | $data->{continuation}{type} = "return" if $args{'J:RETURN'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 620 | } | ||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | ▶ | if ($args{'J:CREATE'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | $data->{continuation}{create} = $args{'J:PATH'}; | |||||||||||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||
| 625 | # Are we only setting some actions as active? | ||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | my $active_actions; | |||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | ▶ | if (exists $args{'J:ACTIONS'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | $active_actions = {}; | |||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | $active_actions->{$_} = 1 for split '!', $args{'J:ACTIONS'}; | |||||||||||||||||||||||||||||||||||||||||
| 630 | } # else $active_actions stays undef | ||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||||||
| 633 | # Mapping from argument types to data structure names; | ||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | my %types = ("J:A:F:F" => "fallback", "J:A:F" => "value"); | |||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||
| 636 | # The "sort" here is key; it ensures that action registrations | ||||||||||||||||||||||||||||||||||||||||||
| 637 | # come before action arguments | ||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | for my $key (sort keys %args) { | |||||||||||||||||||||||||||||||||||||||||
| 639 | 0 | my $value = $args{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 640 | 0 | ▶ | if( $key =~ /^J:V-(.*)/s ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 641 | # It's a variable | ||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | $data->{variables}{$1} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 643 | } elsif ($key =~ /^J:A-(?:(\d+)-)?(.+)/s) { | ||||||||||||||||||||||||||||||||||||||||||
| 644 | # It's an action declatation | ||||||||||||||||||||||||||||||||||||||||||
| 645 | $data->{actions}{$2} = { | ||||||||||||||||||||||||||||||||||||||||||
| 646 | order => $1, | ||||||||||||||||||||||||||||||||||||||||||
| 647 | moniker => $2, | ||||||||||||||||||||||||||||||||||||||||||
| 648 | class => $value, | ||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | ▶ | active => ($active_actions ? ($active_actions->{$2} || 0) : 1), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$active_actions->{$2} or 0
MC/DC0%0/1
$active_actions->{$2} or 0
$active_actions->{$2}
Truth table0%0/2
A
A= $active_actions->{$2}
| |||||||||||||||||||||||||||||||||||||||||||
| 650 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 651 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 652 | # It's possibly a form field | ||||||||||||||||||||||||||||||||||||||||||
| 653 | 0 | my ($t, $a, $m) = $self->parse_form_field_name($key); | |||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | ▶ | next unless $t and $types{$t} and $data->{actions}{$m}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$t and $types{$t} and $data->{"actions"}{$m}
$t and $types{$t}
MC/DC0%0/3
$t and $types{$t} and $data->{"actions"}{$m}
$t
$types{$t}
$data->{"actions"}{$m}
Truth table0%0/4
A and B and C
A= $tB= $types{$t}C= $data->{"actions"}{$m}
| |||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | $data->{actions}{$m}{fields}{$a}{$types{$t}} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||||||||||||||||
| 657 | } | ||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | return $data; | |||||||||||||||||||||||||||||||||||||||||
| 660 | } | ||||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||
| 662 | =head2 continuation_id [CONTINUATION_ID] | ||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||
| 664 | Gets or sets the ID of the current continuation associated with the request. | ||||||||||||||||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||||||||||||||||
| 666 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||
| 668 | =head2 continuation [CONTINUATION] | ||||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||
| 670 | Returns the current L<Jifty::Continuation> object associated with this | ||||||||||||||||||||||||||||||||||||||||||
| 671 | request, if any. | ||||||||||||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||||||||||||
| 673 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||||||||||
| 675 | 0 | ▶ | sub continuation { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
continuation: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||
| 678 | 0 | ▶ | $self->continuation_id(ref $_[0] ? $_[0]->id : $_[0]) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 679 | if @_; | ||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | ▶ | return undef unless $self->continuation_id; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | return Jifty->web->session->get_continuation($self->continuation_id); | |||||||||||||||||||||||||||||||||||||||||
| 683 | } | ||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||
| 685 | =head2 future_continuation_id | ||||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||
| 687 | Gets or sets the ID of the continuation that we are about to return or | ||||||||||||||||||||||||||||||||||||||||||
| 688 | call into. | ||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||
| 690 | =head2 future_continuation | ||||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||
| 692 | Returns the L<Jifty::Continuation> that we are about to return or call | ||||||||||||||||||||||||||||||||||||||||||
| 693 | into, if any. | ||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||
| 695 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | ▶ | sub future_continuation { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
future_continuation: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | ▶ | return undef unless defined $self->future_continuation_id; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | return Jifty->web->session->get_continuation($self->future_continuation_id); | |||||||||||||||||||||||||||||||||||||||||
| 701 | } | ||||||||||||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||||||||||||
| 703 | =head2 save_continuation | ||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||
| 705 | Saves the current request and response if we've been asked to. If we | ||||||||||||||||||||||||||||||||||||||||||
| 706 | save the continuation, we redirect to the next page -- the call to | ||||||||||||||||||||||||||||||||||||||||||
| 707 | C<save_continuation> never returns. | ||||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||
| 709 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | ▶ | sub save_continuation { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
save_continuation: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | my $path; | |||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | ▶ | return unless $path = $self->continuation_path; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||||||||||||||||
| 716 | # Clear out the create path so we don't ave the "create a | ||||||||||||||||||||||||||||||||||||||||||
| 717 | # continuation" into the continuation! | ||||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | $self->continuation_path(undef); | |||||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||||||
| 720 | # Clear out the (locally-set) template arguments, which would | ||||||||||||||||||||||||||||||||||||||||||
| 721 | # bloat the continuation, and can be entirely re-generated. | ||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | $self->template_arguments({}); | |||||||||||||||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | my $c = Jifty::Continuation->new( | |||||||||||||||||||||||||||||||||||||||||
| 725 | request => $self, | ||||||||||||||||||||||||||||||||||||||||||
| 726 | response => Jifty->web->response, | ||||||||||||||||||||||||||||||||||||||||||
| 727 | parent => $self->continuation, | ||||||||||||||||||||||||||||||||||||||||||
| 728 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||
| 730 | # Set us up with the new continuation | ||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | ▶ | Jifty->web->_redirect( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 732 | $path | ||||||||||||||||||||||||||||||||||||||||||
| 733 | . ( $path =~ /\?/ ? "&" : "?" ) . "J:C=" | ||||||||||||||||||||||||||||||||||||||||||
| 734 | . $c->id ); | ||||||||||||||||||||||||||||||||||||||||||
| 735 | } | ||||||||||||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||||||||||||
| 737 | =head2 call_continuation | ||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||
| 739 | Calls the L<Jifty::Continuation> associated with this request, if | ||||||||||||||||||||||||||||||||||||||||||
| 740 | there is one. Returns true if the continuation was called | ||||||||||||||||||||||||||||||||||||||||||
| 741 | successfully -- if calling the continuation requires a redirect, this | ||||||||||||||||||||||||||||||||||||||||||
| 742 | function will throw an exception to its enclosing dispatcher. | ||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||
| 744 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||
| 746 | 0 | ▶ | sub call_continuation { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
call_continuation: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | ▶ | return if $self->is_subrequest; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 749 | 0 | ▶ | return unless $self->continuation_type and $self->continuation_type eq "call" and $self->future_continuation; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->continuation_type and $self->continuation_type eq "call" and $self->future_continuation
$self->continuation_type and $self->continuation_type eq "call"
MC/DC0%0/3
$self->continuation_type and $self->continuation_type eq "call" and $self->future_continuation
$self->continuation_type
$self->continuation_type eq "call"
$self->future_continuation
Truth table0%0/4
A and B and C
A= $self->continuation_typeB= $self->continuation_type eq "call"C= $self->future_continuation
| |||||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | $self->log->debug("Calling continuation ".$self->future_continuation->id); | |||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | return $self->future_continuation->call; | |||||||||||||||||||||||||||||||||||||||||
| 752 | } | ||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||
| 754 | =head2 return_from_continuation | ||||||||||||||||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||||||||||||||||
| 756 | Returns from the current continuation, if there is one. If the | ||||||||||||||||||||||||||||||||||||||||||
| 757 | request path doesn't match, we call the continuation again, which | ||||||||||||||||||||||||||||||||||||||||||
| 758 | should redirect to the right place. If we have to do this, we return | ||||||||||||||||||||||||||||||||||||||||||
| 759 | true, which should be taken as a sign to not process the request | ||||||||||||||||||||||||||||||||||||||||||
| 760 | further. | ||||||||||||||||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||||||||||||||||
| 762 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | ▶ | sub return_from_continuation { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
return_from_continuation: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | ▶ | return unless $self->continuation_type and $self->continuation_type eq "return" and $self->future_continuation; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->continuation_type and $self->continuation_type eq "return" and $self->future_continuation
$self->continuation_type and $self->continuation_type eq "return"
MC/DC0%0/3
$self->continuation_type and $self->continuation_type eq "return" and $self->future_continuation
$self->continuation_type
$self->continuation_type eq "return"
$self->future_continuation
Truth table0%0/4
A and B and C
A= $self->continuation_typeB= $self->continuation_type eq "return"C= $self->future_continuation
| |||||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | ▶ | unless ($self->future_continuation->return_path_matches) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 768 | # This aborts via Jifty::Dispatcher::_abort -- but we're not | ||||||||||||||||||||||||||||||||||||||||||
| 769 | # in the dispatcher yet, so it would go uncaught. Catch it | ||||||||||||||||||||||||||||||||||||||||||
| 770 | # here. | ||||||||||||||||||||||||||||||||||||||||||
| 771 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 772 | 0 | $self->future_continuation->call; | |||||||||||||||||||||||||||||||||||||||||
| 773 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||
| 775 | 0 | ▶ | warn $err if $err and $err ne "ABORT"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$err and $err ne "ABORT"
MC/DC0%0/2
$err and $err ne "ABORT"
$err
$err ne "ABORT"
Truth table0%0/3
A and B
A= $errB= $err ne "ABORT"
| |||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 777 | } | ||||||||||||||||||||||||||||||||||||||||||
| 778 | 0 | $self->log->debug("Returning from continuation ".$self->future_continuation->id); | |||||||||||||||||||||||||||||||||||||||||
| 779 | 0 | $self->future_continuation->return; | |||||||||||||||||||||||||||||||||||||||||
| 780 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 781 | } | ||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||
| 783 | =head2 path | ||||||||||||||||||||||||||||||||||||||||||
| 784 | |||||||||||||||||||||||||||||||||||||||||||
| 785 | Returns the path that was requested | ||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||
| 787 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||
| 789 | =head2 just_validating | ||||||||||||||||||||||||||||||||||||||||||
| 790 | |||||||||||||||||||||||||||||||||||||||||||
| 791 | This method returns true if the request was merely for validation. If | ||||||||||||||||||||||||||||||||||||||||||
| 792 | this flag is set, then all active actions are validated, but no | ||||||||||||||||||||||||||||||||||||||||||
| 793 | actions are run. | ||||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||
| 795 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||||||||||||
| 797 | =head2 state_variables | ||||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||
| 799 | Returns an array of all of this request's state variables, as | ||||||||||||||||||||||||||||||||||||||||||
| 800 | L<Jifty::Request::StateVariable>s. | ||||||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||||||
| 802 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||||
| 804 | 0 | ▶ | sub state_variables { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
state_variables: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | return values %{$self->{'state_variables'}}; | |||||||||||||||||||||||||||||||||||||||||
| 807 | } | ||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||
| 809 | =head2 state_variable NAME | ||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||
| 811 | Returns the L<Jifty::Request::StateVariable> object for the variable | ||||||||||||||||||||||||||||||||||||||||||
| 812 | named I<NAME>, or undef of there is no such variable. | ||||||||||||||||||||||||||||||||||||||||||
| 813 | |||||||||||||||||||||||||||||||||||||||||||
| 814 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 815 | |||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | ▶ | sub state_variable { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
state_variable: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | my $name = shift; | |||||||||||||||||||||||||||||||||||||||||
| 819 | 0 | return $self->{'state_variables'}{$name}; | |||||||||||||||||||||||||||||||||||||||||
| 820 | } | ||||||||||||||||||||||||||||||||||||||||||
| 821 | |||||||||||||||||||||||||||||||||||||||||||
| 822 | =head2 add_state_variable PARAMHASH | ||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||
| 824 | Adds a state variable to this request's internal representation. | ||||||||||||||||||||||||||||||||||||||||||
| 825 | Takes a C<key> and a C<value>; returns the newly-added | ||||||||||||||||||||||||||||||||||||||||||
| 826 | L<Jifty::Request::StateVariable>. | ||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||
| 828 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 829 | |||||||||||||||||||||||||||||||||||||||||||
| 830 | 0 | ▶ | sub add_state_variable { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_state_variable: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 831 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 832 | 0 | my %args = ( | |||||||||||||||||||||||||||||||||||||||||
| 833 | key => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 834 | value => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 835 | @_); | ||||||||||||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||||||||||||
| 837 | 0 | my $state_var = Jifty::Request::StateVariable->new(); | |||||||||||||||||||||||||||||||||||||||||
| 838 | |||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | for my $k (qw/key value/) { | |||||||||||||||||||||||||||||||||||||||||
| 840 | 0 | ▶ | $state_var->$k($args{$k}) if defined $args{$k}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 841 | } | ||||||||||||||||||||||||||||||||||||||||||
| 842 | 0 | $self->{'state_variables'}{$args{'key'}} = $state_var; | |||||||||||||||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||||||||||||||||
| 844 | 0 | return $state_var; | |||||||||||||||||||||||||||||||||||||||||
| 845 | } | ||||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||
| 847 | =head2 remove_state_variable KEY | ||||||||||||||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||||||||||||||
| 849 | Removes the given state variable. The opposite of | ||||||||||||||||||||||||||||||||||||||||||
| 850 | L</add_state_variable>, above. | ||||||||||||||||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||||||||||||||||
| 852 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 853 | |||||||||||||||||||||||||||||||||||||||||||
| 854 | 0 | ▶ | sub remove_state_variable { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove_state_variable: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 855 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 856 | 0 | my ($key) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 857 | 0 | delete $self->{'state_variables'}{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 858 | } | ||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||
| 860 | =head2 clear_state_variables | ||||||||||||||||||||||||||||||||||||||||||
| 861 | |||||||||||||||||||||||||||||||||||||||||||
| 862 | Remove all the state variables. | ||||||||||||||||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||||||||||||||||
| 864 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||||||||||
| 866 | 0 | ▶ | sub clear_state_variables { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clear_state_variables: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 867 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||||||||||||||||
| 869 | 0 | $self->{'state_variables'} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 870 | } | ||||||||||||||||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||||||||||||||||
| 873 | =head2 actions | ||||||||||||||||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||||||||||||||||
| 875 | Returns a list of the actions in the request, as | ||||||||||||||||||||||||||||||||||||||||||
| 876 | L<Jifty::Request::Action> objects. | ||||||||||||||||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||||||||||||||||
| 878 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | ▶ | sub actions { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
actions: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 881 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | ▶ | return sort {($a->order || 0) <=> ($b->order || 0)} | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$a->order || 0
$b->order || 0
MC/DC0%0/1
$a->order || 0
$a->order
MC/DC0%0/1
$b->order || 0
$b->order
Truth table0%0/2
A
A= $a->order
Truth table0%0/2
A
A= $b->order
| |||||||||||||||||||||||||||||||||||||||||||
| 883 | 0 | values %{ $self->{'actions'} }; | |||||||||||||||||||||||||||||||||||||||||
| 884 | } | ||||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||
| 886 | =head2 action MONIKER | ||||||||||||||||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||||||||||||||||
| 888 | Returns a L<Jifty::Request::Action> object for the action with the | ||||||||||||||||||||||||||||||||||||||||||
| 889 | given moniker, or undef if no such action was sent. | ||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||
| 891 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | ▶ | sub action { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
action: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 894 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | my $moniker = shift; | |||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | return $self->{'actions'}{$moniker}; | |||||||||||||||||||||||||||||||||||||||||
| 897 | } | ||||||||||||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||||||||||||
| 899 | =head2 add_action PARAMHASH | ||||||||||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||||||||||
| 901 | Required argument: C<moniker>. | ||||||||||||||||||||||||||||||||||||||||||
| 902 | |||||||||||||||||||||||||||||||||||||||||||
| 903 | Optional arguments: C<class>, C<order>, C<active>, C<arguments>. | ||||||||||||||||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||||||||||||||||
| 905 | Adds a L<Jifty::Request::Action> with the given | ||||||||||||||||||||||||||||||||||||||||||
| 906 | L<moniker|Jifty::Manual::Glossary/moniker> to the request. If the | ||||||||||||||||||||||||||||||||||||||||||
| 907 | request already contains an action with that moniker, it merges it in, | ||||||||||||||||||||||||||||||||||||||||||
| 908 | overriding the implementation class, active state, and B<individual> | ||||||||||||||||||||||||||||||||||||||||||
| 909 | arguments. Returns the newly added L<Jifty::Request::Action>. | ||||||||||||||||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||||||||||||||||
| 911 | See L<Jifty::Action>. | ||||||||||||||||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||||||||||||||||
| 913 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||||||||||||||||
| 915 | 0 | ▶ | sub add_action { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_action: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 917 | 0 | my %args = ( | |||||||||||||||||||||||||||||||||||||||||
| 918 | moniker => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 919 | class => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 920 | order => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 921 | active => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 922 | arguments => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 923 | has_run => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 924 | @_ | ||||||||||||||||||||||||||||||||||||||||||
| 925 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 926 | |||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | ▶ | my $action = $self->{'actions'}->{ $args{'moniker'} } || Jifty::Request::Action->new; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'actions'}{$args{'moniker'}} || 'Jifty::Request::Action'->new
MC/DC0%0/2
$self->{'actions'}{$args{'moniker'}} || 'Jifty::Request::Action'->new
$self->{'actions'}{$args{'moniker'}}
'Jifty::Request::Action'->new
Truth table0%0/3
A || B
A= $self->{'actions'}{$args{'moniker'}}B= 'Jifty::Request::Action'->new
| |||||||||||||||||||||||||||||||||||||||||||
| 928 | |||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | for my $k (qw/moniker class order active has_run/) { | |||||||||||||||||||||||||||||||||||||||||
| 930 | 0 | ▶ | $action->$k($args{$k}) if defined $args{$k}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 931 | } | ||||||||||||||||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | ▶ | if ($args{'arguments'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 934 | 0 | for my $k (keys %{ $args{'arguments'} }) { | |||||||||||||||||||||||||||||||||||||||||
| 935 | 0 | $action->argument($k, $args{'arguments'}{$k}); | |||||||||||||||||||||||||||||||||||||||||
| 936 | } | ||||||||||||||||||||||||||||||||||||||||||
| 937 | } | ||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||
| 939 | 0 | $self->{'actions'}{$args{'moniker'}} = $action; | |||||||||||||||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||||||||||||||||
| 941 | 0 | return $action; | |||||||||||||||||||||||||||||||||||||||||
| 942 | } | ||||||||||||||||||||||||||||||||||||||||||
| 943 | |||||||||||||||||||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||||||||||||||||
| 945 | =head2 clear_actions | ||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||
| 947 | Removes all actions from this request | ||||||||||||||||||||||||||||||||||||||||||
| 948 | |||||||||||||||||||||||||||||||||||||||||||
| 949 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 950 | |||||||||||||||||||||||||||||||||||||||||||
| 951 | 0 | ▶ | sub clear_actions { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clear_actions: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 952 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 953 | 0 | $self->{'actions'} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 954 | } | ||||||||||||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||||||||||||
| 956 | =head2 remove_action MONIKER | ||||||||||||||||||||||||||||||||||||||||||
| 957 | |||||||||||||||||||||||||||||||||||||||||||
| 958 | Removes an action with the given moniker. | ||||||||||||||||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||||||||||||||||
| 960 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||||||||||||||||
| 962 | 0 | ▶ | sub remove_action { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove_action: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 963 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 964 | 0 | my ($moniker) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 965 | 0 | delete $self->{'actions'}{$moniker}; | |||||||||||||||||||||||||||||||||||||||||
| 966 | } | ||||||||||||||||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||||||||||||||||
| 968 | =head2 fragments | ||||||||||||||||||||||||||||||||||||||||||
| 969 | |||||||||||||||||||||||||||||||||||||||||||
| 970 | Returns a list of fragments requested, as L<Jifty::Request::Fragment> objects. | ||||||||||||||||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||||||||||||||||
| 972 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||||||||||||||||
| 974 | 0 | ▶ | sub fragments { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fragments: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 975 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 976 | |||||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | return values %{$self->{'fragments'}} | |||||||||||||||||||||||||||||||||||||||||
| 978 | } | ||||||||||||||||||||||||||||||||||||||||||
| 979 | |||||||||||||||||||||||||||||||||||||||||||
| 980 | =head2 fragment NAME | ||||||||||||||||||||||||||||||||||||||||||
| 981 | |||||||||||||||||||||||||||||||||||||||||||
| 982 | Returns the requested fragment with that name | ||||||||||||||||||||||||||||||||||||||||||
| 983 | |||||||||||||||||||||||||||||||||||||||||||
| 984 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 985 | |||||||||||||||||||||||||||||||||||||||||||
| 986 | 0 | ▶ | sub fragment { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fragment: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 987 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 988 | 0 | my $name = shift; | |||||||||||||||||||||||||||||||||||||||||
| 989 | 0 | return $self->{'fragments'}{$name}; | |||||||||||||||||||||||||||||||||||||||||
| 990 | } | ||||||||||||||||||||||||||||||||||||||||||
| 991 | |||||||||||||||||||||||||||||||||||||||||||
| 992 | =head2 add_fragment PARAMHASH | ||||||||||||||||||||||||||||||||||||||||||
| 993 | |||||||||||||||||||||||||||||||||||||||||||
| 994 | Required arguments: C<name>, C<path> | ||||||||||||||||||||||||||||||||||||||||||
| 995 | |||||||||||||||||||||||||||||||||||||||||||
| 996 | Optional arguments: C<arguments>, C<wrapper> | ||||||||||||||||||||||||||||||||||||||||||
| 997 | |||||||||||||||||||||||||||||||||||||||||||
| 998 | Adds a L<Jifty::Request::Fragment> with the given name to the request. | ||||||||||||||||||||||||||||||||||||||||||
| 999 | If the request already contains a fragment with that name, it merges | ||||||||||||||||||||||||||||||||||||||||||
| 1000 | it in. Returns the newly added L<Jifty::Request::Fragment>. | ||||||||||||||||||||||||||||||||||||||||||
| 1001 | |||||||||||||||||||||||||||||||||||||||||||
| 1002 | See L<Jifty::PageRegion>. | ||||||||||||||||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||||||||||||||||
| 1004 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||||||||||||||||
| 1006 | 0 | ▶ | sub add_fragment { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_fragment: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1007 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1008 | |||||||||||||||||||||||||||||||||||||||||||
| 1009 | 0 | my %args = ( | |||||||||||||||||||||||||||||||||||||||||
| 1010 | name => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 1011 | path => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 1012 | arguments => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 1013 | wrapper => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 1014 | in_form => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 1015 | @_ | ||||||||||||||||||||||||||||||||||||||||||
| 1016 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1017 | |||||||||||||||||||||||||||||||||||||||||||
| 1018 | 0 | ▶ | my $fragment = $self->{'fragments'}->{ $args{'name'} } || Jifty::Request::Fragment->new; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'fragments'}{$args{'name'}} || 'Jifty::Request::Fragment'->new
MC/DC0%0/2
$self->{'fragments'}{$args{'name'}} || 'Jifty::Request::Fragment'->new
$self->{'fragments'}{$args{'name'}}
'Jifty::Request::Fragment'->new
Truth table0%0/3
A || B
A= $self->{'fragments'}{$args{'name'}}B= 'Jifty::Request::Fragment'->new
| |||||||||||||||||||||||||||||||||||||||||||
| 1019 | |||||||||||||||||||||||||||||||||||||||||||
| 1020 | 0 | for my $k (qw/name path wrapper in_form/) { | |||||||||||||||||||||||||||||||||||||||||
| 1021 | 0 | ▶ | $fragment->$k($args{$k}) if defined $args{$k}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1022 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||||||||||||||||
| 1024 | 0 | ▶ | if ($args{'arguments'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1025 | 0 | for my $k (keys %{ $args{'arguments'} }) { | |||||||||||||||||||||||||||||||||||||||||
| 1026 | 0 | $fragment->argument($k, $args{'arguments'}{$k}); | |||||||||||||||||||||||||||||||||||||||||
| 1027 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1028 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1029 | |||||||||||||||||||||||||||||||||||||||||||
| 1030 | 0 | $self->{'fragments'}{$args{'name'}} = $fragment; | |||||||||||||||||||||||||||||||||||||||||
| 1031 | |||||||||||||||||||||||||||||||||||||||||||
| 1032 | 0 | return $fragment; | |||||||||||||||||||||||||||||||||||||||||
| 1033 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1034 | |||||||||||||||||||||||||||||||||||||||||||
| 1035 | =head2 do_mapping PARAMHASH | ||||||||||||||||||||||||||||||||||||||||||
| 1036 | |||||||||||||||||||||||||||||||||||||||||||
| 1037 | Takes two possible arguments, C<request> and C<response>; they default | ||||||||||||||||||||||||||||||||||||||||||
| 1038 | to the current L<Jifty::Request> and the current L<Jifty::Response>. | ||||||||||||||||||||||||||||||||||||||||||
| 1039 | Calls L<Jifty::Request::Mapper/map> on every argument of this request, | ||||||||||||||||||||||||||||||||||||||||||
| 1040 | pulling arguments and results from the given C<request> and C<response>. | ||||||||||||||||||||||||||||||||||||||||||
| 1041 | |||||||||||||||||||||||||||||||||||||||||||
| 1042 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1043 | |||||||||||||||||||||||||||||||||||||||||||
| 1044 | 0 | ▶ | sub do_mapping { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
do_mapping: not called CC=15 SCAR=54.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1045 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1046 | |||||||||||||||||||||||||||||||||||||||||||
| 1047 | 0 | my %args = ( | |||||||||||||||||||||||||||||||||||||||||
| 1048 | request => Jifty->web->request, | ||||||||||||||||||||||||||||||||||||||||||
| 1049 | response => Jifty->web->response, | ||||||||||||||||||||||||||||||||||||||||||
| 1050 | @_, | ||||||||||||||||||||||||||||||||||||||||||
| 1051 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1052 | |||||||||||||||||||||||||||||||||||||||||||
| 1053 | 0 | for (keys %{$self->arguments}) { | |||||||||||||||||||||||||||||||||||||||||
| 1054 | 0 | my ($key, $value) = Jifty::Request::Mapper->map(destination => $_, source => $self->arguments->{$_}, %args); | |||||||||||||||||||||||||||||||||||||||||
| 1055 | 0 | ▶ | next unless $key ne $_ or not defined $value or $value ne $self->argument($_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$key ne $_ or not defined $value or $value ne $self->argument($_)
$key ne $_ or not defined $value
MC/DC0%0/3
$key ne $_ or not defined $value or $value ne $self->argument($_)
$key ne $_
not defined $value
$value ne $self->argument($_)
Truth table0%0/4
A or not(B) or C
A= $key ne $_B= not defined $valueC= $value ne $self->argument($_)
| |||||||||||||||||||||||||||||||||||||||||||
| 1056 | 0 | delete $self->arguments->{$_}; | |||||||||||||||||||||||||||||||||||||||||
| 1057 | 0 | $self->argument($key => $value); | |||||||||||||||||||||||||||||||||||||||||
| 1058 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1059 | 0 | for my $request_action ($self->actions) { | |||||||||||||||||||||||||||||||||||||||||
| 1060 | 0 | ▶ | for my $arg (keys %{$request_action->arguments || {}}) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$request_action->arguments || {}
MC/DC0%0/1
$request_action->arguments || {}
$request_action->arguments
Truth table0%0/2
A
A= $request_action->arguments
| |||||||||||||||||||||||||||||||||||||||||||
| 1061 | 0 | my $map = $request_action->arguments->{$arg}; | |||||||||||||||||||||||||||||||||||||||||
| 1062 | 0 | my ($key, $value) = Jifty::Request::Mapper->map(destination => $arg, source => $map, %args); | |||||||||||||||||||||||||||||||||||||||||
| 1063 | 0 | ▶ | next unless $key ne $arg or not defined $value or $value ne $map; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$key ne $arg or not defined $value or $value ne $map
$key ne $arg or not defined $value
MC/DC0%0/3
$key ne $arg or not defined $value or $value ne $map
$key ne $arg
not defined $value
$value ne $map
Truth table0%0/4
A or not(B) or C
A= $key ne $argB= not defined $valueC= $value ne $map
| |||||||||||||||||||||||||||||||||||||||||||
| 1064 | 0 | $request_action->delete($arg); | |||||||||||||||||||||||||||||||||||||||||
| 1065 | 0 | $request_action->argument($key => $value); | |||||||||||||||||||||||||||||||||||||||||
| 1066 | 0 | $request_action->modified(1); | |||||||||||||||||||||||||||||||||||||||||
| 1067 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1068 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1069 | 0 | for ($self->state_variables) { | |||||||||||||||||||||||||||||||||||||||||
| 1070 | 0 | my ($key, $value) = Jifty::Request::Mapper->map(destination => $_->key, source => $_->value, %args); | |||||||||||||||||||||||||||||||||||||||||
| 1071 | 0 | ▶ | next unless $key ne $_->key or not defined $value or $value ne $_->value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$key ne $_->key or not defined $value or $value ne $_->value
$key ne $_->key or not defined $value
MC/DC0%0/3
$key ne $_->key or not defined $value or $value ne $_->value
$key ne $_->key
not defined $value
$value ne $_->value
Truth table0%0/4
A or not(B) or C
A= $key ne $_->keyB= not defined $valueC= $value ne $_->value
| |||||||||||||||||||||||||||||||||||||||||||
| 1072 | 0 | $self->remove_state_variable($_->key); | |||||||||||||||||||||||||||||||||||||||||
| 1073 | 0 | $self->add_state_variable(key => $key, value => $value); | |||||||||||||||||||||||||||||||||||||||||
| 1074 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1075 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1076 | |||||||||||||||||||||||||||||||||||||||||||
| 1077 | =head2 is_subrequest | ||||||||||||||||||||||||||||||||||||||||||
| 1078 | |||||||||||||||||||||||||||||||||||||||||||
| 1079 | Returns true if this request is a subrequest. | ||||||||||||||||||||||||||||||||||||||||||
| 1080 | |||||||||||||||||||||||||||||||||||||||||||
| 1081 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1082 | |||||||||||||||||||||||||||||||||||||||||||
| 1083 | 0 | ▶ | sub is_subrequest { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_subrequest: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1084 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1085 | 0 | ▶ | return $self->_top_request ? 1 : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1086 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1087 | |||||||||||||||||||||||||||||||||||||||||||
| 1088 | =head2 top_request | ||||||||||||||||||||||||||||||||||||||||||
| 1089 | |||||||||||||||||||||||||||||||||||||||||||
| 1090 | Returns the top-level request for this request; if this is a | ||||||||||||||||||||||||||||||||||||||||||
| 1091 | subrequest, this is the user-created request that the handler got | ||||||||||||||||||||||||||||||||||||||||||
| 1092 | originally. Otherwise, returns itself; | ||||||||||||||||||||||||||||||||||||||||||
| 1093 | |||||||||||||||||||||||||||||||||||||||||||
| 1094 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1095 | |||||||||||||||||||||||||||||||||||||||||||
| 1096 | 0 | ▶ | sub top_request { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
top_request: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1097 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1098 | 0 | ▶ | $self->_top_request(@_) if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1099 | 0 | ▶ | return $self->_top_request || $self; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->_top_request || $self
MC/DC0%0/2
$self->_top_request || $self
$self->_top_request
$self
Truth table0%0/3
A || B
A= $self->_top_requestB= $self
| |||||||||||||||||||||||||||||||||||||||||||
| 1100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1101 | |||||||||||||||||||||||||||||||||||||||||||
| 1102 | 1 | ▶ | no Any::Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1103 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||||||||||||
| 1104 | |||||||||||||||||||||||||||||||||||||||||||
| 1105 | |||||||||||||||||||||||||||||||||||||||||||
| 1106 | package Jifty::Request::Action; | ||||||||||||||||||||||||||||||||||||||||||
| 1107 | 1 | ▶ | use Any::Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1108 | |||||||||||||||||||||||||||||||||||||||||||
| 1109 | 1 | has 'moniker', is => 'rw'; | |||||||||||||||||||||||||||||||||||||||||
| 1110 | 1 | has 'arguments', is => 'rw'; | |||||||||||||||||||||||||||||||||||||||||
| 1111 | 1 | has 'class', is => 'rw'; | |||||||||||||||||||||||||||||||||||||||||
| 1112 | 1 | has 'order', is => 'rw'; | |||||||||||||||||||||||||||||||||||||||||
| 1113 | 1 | has 'active', is => 'rw'; | |||||||||||||||||||||||||||||||||||||||||
| 1114 | 1 | has 'modified', is => 'rw'; | |||||||||||||||||||||||||||||||||||||||||
| 1115 | 1 | has 'has_run', is => 'rw'; | |||||||||||||||||||||||||||||||||||||||||
| 1116 | |||||||||||||||||||||||||||||||||||||||||||
| 1117 | =head2 Jifty::Request::Action | ||||||||||||||||||||||||||||||||||||||||||
| 1118 | |||||||||||||||||||||||||||||||||||||||||||
| 1119 | A small package that encapsulates the bits of an action request: | ||||||||||||||||||||||||||||||||||||||||||
| 1120 | |||||||||||||||||||||||||||||||||||||||||||
| 1121 | =head3 moniker [NAME] | ||||||||||||||||||||||||||||||||||||||||||
| 1122 | |||||||||||||||||||||||||||||||||||||||||||
| 1123 | =head3 argument NAME [VALUE] | ||||||||||||||||||||||||||||||||||||||||||
| 1124 | |||||||||||||||||||||||||||||||||||||||||||
| 1125 | =head3 arguments | ||||||||||||||||||||||||||||||||||||||||||
| 1126 | |||||||||||||||||||||||||||||||||||||||||||
| 1127 | =head3 class [CLASS] | ||||||||||||||||||||||||||||||||||||||||||
| 1128 | |||||||||||||||||||||||||||||||||||||||||||
| 1129 | =head3 order [INTEGER] | ||||||||||||||||||||||||||||||||||||||||||
| 1130 | |||||||||||||||||||||||||||||||||||||||||||
| 1131 | =head3 active [BOOLEAN] | ||||||||||||||||||||||||||||||||||||||||||
| 1132 | |||||||||||||||||||||||||||||||||||||||||||
| 1133 | =head3 has_run [BOOLEAN] | ||||||||||||||||||||||||||||||||||||||||||
| 1134 | |||||||||||||||||||||||||||||||||||||||||||
| 1135 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1136 | |||||||||||||||||||||||||||||||||||||||||||
| 1137 | 0 | ▶ | sub argument { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
argument: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1138 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1139 | 0 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1140 | |||||||||||||||||||||||||||||||||||||||||||
| 1141 | 0 | ▶ | $self->arguments({}) unless $self->arguments; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1142 | |||||||||||||||||||||||||||||||||||||||||||
| 1143 | 0 | ▶ | $self->arguments->{$key} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1144 | 0 | $self->arguments->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 1145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1146 | |||||||||||||||||||||||||||||||||||||||||||
| 1147 | =head3 delete | ||||||||||||||||||||||||||||||||||||||||||
| 1148 | |||||||||||||||||||||||||||||||||||||||||||
| 1149 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1150 | |||||||||||||||||||||||||||||||||||||||||||
| 1151 | 0 | ▶ | sub delete { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1152 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1153 | 0 | my $argument = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1154 | 0 | delete $self->arguments->{$argument}; | |||||||||||||||||||||||||||||||||||||||||
| 1155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1156 | |||||||||||||||||||||||||||||||||||||||||||
| 1157 | |||||||||||||||||||||||||||||||||||||||||||
| 1158 | 1 | ▶ | no Any::Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1159 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||||||||||||
| 1160 | |||||||||||||||||||||||||||||||||||||||||||
| 1161 | |||||||||||||||||||||||||||||||||||||||||||
| 1162 | package Jifty::Request::StateVariable; | ||||||||||||||||||||||||||||||||||||||||||
| 1163 | 1 | ▶ | use Any::Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1164 | |||||||||||||||||||||||||||||||||||||||||||
| 1165 | 1 | has 'key', is => 'rw'; | |||||||||||||||||||||||||||||||||||||||||
| 1166 | 1 | has 'value', is => 'rw'; | |||||||||||||||||||||||||||||||||||||||||
| 1167 | |||||||||||||||||||||||||||||||||||||||||||
| 1168 | 1 | ▶ | no Any::Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1169 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||||||||||||
| 1170 | |||||||||||||||||||||||||||||||||||||||||||
| 1171 | =head2 Jifty::Request::StateVariable | ||||||||||||||||||||||||||||||||||||||||||
| 1172 | |||||||||||||||||||||||||||||||||||||||||||
| 1173 | A small package that encapsulates the bits of a state variable: | ||||||||||||||||||||||||||||||||||||||||||
| 1174 | |||||||||||||||||||||||||||||||||||||||||||
| 1175 | =head3 key | ||||||||||||||||||||||||||||||||||||||||||
| 1176 | |||||||||||||||||||||||||||||||||||||||||||
| 1177 | =head3 value | ||||||||||||||||||||||||||||||||||||||||||
| 1178 | |||||||||||||||||||||||||||||||||||||||||||
| 1179 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1180 | |||||||||||||||||||||||||||||||||||||||||||
| 1181 | package Jifty::Request::Fragment; | ||||||||||||||||||||||||||||||||||||||||||
| 1182 | 1 | ▶ | use Any::Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1183 | |||||||||||||||||||||||||||||||||||||||||||
| 1184 | 1 | has 'name', is => 'rw'; | |||||||||||||||||||||||||||||||||||||||||
| 1185 | 1 | has 'path', is => 'rw'; | |||||||||||||||||||||||||||||||||||||||||
| 1186 | 1 | has 'wrapper', is => 'rw'; | |||||||||||||||||||||||||||||||||||||||||
| 1187 | 1 | has 'in_form', is => 'rw'; | |||||||||||||||||||||||||||||||||||||||||
| 1188 | 1 | has 'arguments', is => 'rw'; | |||||||||||||||||||||||||||||||||||||||||
| 1189 | 1 | has 'parent', is => 'rw'; | |||||||||||||||||||||||||||||||||||||||||
| 1190 | |||||||||||||||||||||||||||||||||||||||||||
| 1191 | 1 | ▶ | no Any::Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1192 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||||||||||||
| 1193 | |||||||||||||||||||||||||||||||||||||||||||
| 1194 | =head2 Jifty::Request::Fragment | ||||||||||||||||||||||||||||||||||||||||||
| 1195 | |||||||||||||||||||||||||||||||||||||||||||
| 1196 | A small package that encapsulates the bits of a fragment request: | ||||||||||||||||||||||||||||||||||||||||||
| 1197 | |||||||||||||||||||||||||||||||||||||||||||
| 1198 | =head3 name [NAME] | ||||||||||||||||||||||||||||||||||||||||||
| 1199 | |||||||||||||||||||||||||||||||||||||||||||
| 1200 | =head3 path [PATH] | ||||||||||||||||||||||||||||||||||||||||||
| 1201 | |||||||||||||||||||||||||||||||||||||||||||
| 1202 | =head3 wrapper [BOOLEAN] | ||||||||||||||||||||||||||||||||||||||||||
| 1203 | |||||||||||||||||||||||||||||||||||||||||||
| 1204 | =head3 in_form [BOOLEAN] | ||||||||||||||||||||||||||||||||||||||||||
| 1205 | |||||||||||||||||||||||||||||||||||||||||||
| 1206 | =head3 argument NAME [VALUE] | ||||||||||||||||||||||||||||||||||||||||||
| 1207 | |||||||||||||||||||||||||||||||||||||||||||
| 1208 | =head3 arguments | ||||||||||||||||||||||||||||||||||||||||||
| 1209 | |||||||||||||||||||||||||||||||||||||||||||
| 1210 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1211 | |||||||||||||||||||||||||||||||||||||||||||
| 1212 | 0 | ▶ | sub argument { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
argument: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1213 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1214 | 0 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1215 | |||||||||||||||||||||||||||||||||||||||||||
| 1216 | 0 | ▶ | $self->arguments({}) unless $self->arguments; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1217 | |||||||||||||||||||||||||||||||||||||||||||
| 1218 | 0 | ▶ | $self->arguments->{$key} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1219 | 0 | $self->arguments->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 1220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1221 | |||||||||||||||||||||||||||||||||||||||||||
| 1222 | =head3 delete | ||||||||||||||||||||||||||||||||||||||||||
| 1223 | |||||||||||||||||||||||||||||||||||||||||||
| 1224 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1225 | |||||||||||||||||||||||||||||||||||||||||||
| 1226 | 0 | ▶ | sub delete { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1227 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1228 | 0 | my $argument = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1229 | 0 | delete $self->arguments->{$argument}; | |||||||||||||||||||||||||||||||||||||||||
| 1230 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1231 | |||||||||||||||||||||||||||||||||||||||||||
| 1232 | =head1 SERIALIZATION | ||||||||||||||||||||||||||||||||||||||||||
| 1233 | |||||||||||||||||||||||||||||||||||||||||||
| 1234 | =head2 CGI Query parameters | ||||||||||||||||||||||||||||||||||||||||||
| 1235 | |||||||||||||||||||||||||||||||||||||||||||
| 1236 | The primary source of Jifty requests through the website are CGI query | ||||||||||||||||||||||||||||||||||||||||||
| 1237 | parameters. These are requests submitted using CGI GET or POST | ||||||||||||||||||||||||||||||||||||||||||
| 1238 | requests to your Jifty application. | ||||||||||||||||||||||||||||||||||||||||||
| 1239 | |||||||||||||||||||||||||||||||||||||||||||
| 1240 | =head3 argument munging | ||||||||||||||||||||||||||||||||||||||||||
| 1241 | |||||||||||||||||||||||||||||||||||||||||||
| 1242 | In addition to standard Mason argument munging, Jifty also takes | ||||||||||||||||||||||||||||||||||||||||||
| 1243 | arguments with a B<name> of | ||||||||||||||||||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||||||||||||||||
| 1245 | bla=bap|beep=bop|foo=bar | ||||||||||||||||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||||||||||||||||
| 1247 | and an arbitrary value, and makes them appear as if they were actually | ||||||||||||||||||||||||||||||||||||||||||
| 1248 | separate arguments. The purpose is to allow submit buttons to act as | ||||||||||||||||||||||||||||||||||||||||||
| 1249 | if they'd sent multiple values, without using JavaScript. | ||||||||||||||||||||||||||||||||||||||||||
| 1250 | |||||||||||||||||||||||||||||||||||||||||||
| 1251 | =head3 actions | ||||||||||||||||||||||||||||||||||||||||||
| 1252 | |||||||||||||||||||||||||||||||||||||||||||
| 1253 | =head4 registration | ||||||||||||||||||||||||||||||||||||||||||
| 1254 | |||||||||||||||||||||||||||||||||||||||||||
| 1255 | For each action, the client sends a query argument whose name is | ||||||||||||||||||||||||||||||||||||||||||
| 1256 | C<J:A-I<moniker>> and whose value is the fully qualified class name of | ||||||||||||||||||||||||||||||||||||||||||
| 1257 | the action's implementation class. This is the action "registration." | ||||||||||||||||||||||||||||||||||||||||||
| 1258 | The registration may also take the form C<J:A-I<order>-I<moniker>>, | ||||||||||||||||||||||||||||||||||||||||||
| 1259 | which also sets the action's run order. | ||||||||||||||||||||||||||||||||||||||||||
| 1260 | |||||||||||||||||||||||||||||||||||||||||||
| 1261 | =head4 arguments | ||||||||||||||||||||||||||||||||||||||||||
| 1262 | |||||||||||||||||||||||||||||||||||||||||||
| 1263 | The action's arguments are specified with query arguments of the form | ||||||||||||||||||||||||||||||||||||||||||
| 1264 | C<J:A:F-I<argumentname>-I<moniker>>. To cope with checkboxes and the | ||||||||||||||||||||||||||||||||||||||||||
| 1265 | like (which don't submit anything when left unchecked) we provide a | ||||||||||||||||||||||||||||||||||||||||||
| 1266 | level of fallback, which is checked if the first doesn't exist: | ||||||||||||||||||||||||||||||||||||||||||
| 1267 | C<J:A:F:F-I<argumentname>-I<moniker>>. | ||||||||||||||||||||||||||||||||||||||||||
| 1268 | |||||||||||||||||||||||||||||||||||||||||||
| 1269 | =head3 state variables | ||||||||||||||||||||||||||||||||||||||||||
| 1270 | |||||||||||||||||||||||||||||||||||||||||||
| 1271 | State variables are set via C<J:V-I<name>> being set to the value of | ||||||||||||||||||||||||||||||||||||||||||
| 1272 | the state parameter. | ||||||||||||||||||||||||||||||||||||||||||
| 1273 | |||||||||||||||||||||||||||||||||||||||||||
| 1274 | =head4 continuations | ||||||||||||||||||||||||||||||||||||||||||
| 1275 | |||||||||||||||||||||||||||||||||||||||||||
| 1276 | The current continuation set by passing the parameter C<J:C>, which is | ||||||||||||||||||||||||||||||||||||||||||
| 1277 | set to the id of the continuation. To create a new continuation, the | ||||||||||||||||||||||||||||||||||||||||||
| 1278 | parameter C<J:CREATE> is passed. Calling a continuation is a simple | ||||||||||||||||||||||||||||||||||||||||||
| 1279 | as passing C<J:CALL> with the id of the continuation to call; this | ||||||||||||||||||||||||||||||||||||||||||
| 1280 | will redirect to the appropriate url, with L<J:RETURN> set. | ||||||||||||||||||||||||||||||||||||||||||
| 1281 | |||||||||||||||||||||||||||||||||||||||||||
| 1282 | =head3 request options | ||||||||||||||||||||||||||||||||||||||||||
| 1283 | |||||||||||||||||||||||||||||||||||||||||||
| 1284 | The existence of C<J:VALIDATE> says that the request is only | ||||||||||||||||||||||||||||||||||||||||||
| 1285 | validating arguments. C<J:ACTIONS> is set to a exclamation mark separated | ||||||||||||||||||||||||||||||||||||||||||
| 1286 | list of monikers; the actions with those monikers will be marked | ||||||||||||||||||||||||||||||||||||||||||
| 1287 | active, while all other actions are marked inactive. In the absence | ||||||||||||||||||||||||||||||||||||||||||
| 1288 | of C<J:ACTIONS>, all actions are active. | ||||||||||||||||||||||||||||||||||||||||||
| 1289 | |||||||||||||||||||||||||||||||||||||||||||
| 1290 | =head2 YAML POST Request Protocol | ||||||||||||||||||||||||||||||||||||||||||
| 1291 | |||||||||||||||||||||||||||||||||||||||||||
| 1292 | |||||||||||||||||||||||||||||||||||||||||||
| 1293 | =head2 JSON POST Request Protocol | ||||||||||||||||||||||||||||||||||||||||||
| 1294 | |||||||||||||||||||||||||||||||||||||||||||
| 1295 | |||||||||||||||||||||||||||||||||||||||||||
| 1296 | |||||||||||||||||||||||||||||||||||||||||||
| 1297 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1298 | |||||||||||||||||||||||||||||||||||||||||||
| 1299 | 1 | ▶ | no Any::Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1300 | 1 | __PACKAGE__->meta->make_immutable(inline_constructor => 0); | |||||||||||||||||||||||||||||||||||||||||
| 1301 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 1302 | |||||||||||||||||||||||||||||||||||||||||||