| 1 | # ABSTRACT: Dancer2's Domain Specific Language (DSL) | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | package Dancer2::Core::DSL; | ||||||||||||||||||||
| 4 | 159 | $Dancer2::Core::DSL::VERSION = '2.2.2'; | |||||||||||||||||||
| 5 | 159 | ▶ | use Moo; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 159 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 159 | ▶ | use Path::Tiny (); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 159 | ▶ | use Module::Runtime 'require_module'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 159 | ▶ | use Ref::Util qw< is_arrayref is_hashref >; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 159 | ▶ | use Dancer2::Core::Hook; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 159 | ▶ | use Dancer2::Core::Response::Delayed; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 159 | with 'Dancer2::Core::Role::DSL'; | |||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 0 | ▶ | sub hook_aliases { +{} } | ||||||||||||||||||
|
Subroutine
hook_aliases: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 16 | 0 | ▶ | sub supported_hooks { () } | ||||||||||||||||||
|
Subroutine
supported_hooks: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 0 | ▶ | sub _add_postponed_plugin_hooks { | ||||||||||||||||||
|
Subroutine
_add_postponed_plugin_hooks: not called CC=5 SCAR=34.0
| |||||||||||||||||||||
| 19 | 0 | my ( $self, $postponed_hooks) = @_; | |||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 0 | $postponed_hooks = $postponed_hooks->{'plugin'}; | |||||||||||||||||||
| 22 | 0 | ▶ | return unless defined $postponed_hooks; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 0 | for my $plugin ( keys %{$postponed_hooks} ) { | |||||||||||||||||||
| 25 | 0 | for my $name ( keys %{$postponed_hooks->{$plugin} } ) { | |||||||||||||||||||
| 26 | 0 | my $hook = $postponed_hooks->{$plugin}{$name}{hook}; | |||||||||||||||||||
| 27 | 0 | my $caller = $postponed_hooks->{$plugin}{$name}{caller}; | |||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | $self->has_hook($name) | ||||||||||||||||||||
| 30 | or croak "plugin $plugin does not support the hook `$name'. (" | ||||||||||||||||||||
| 31 | 0 | ▶ | . join( ", ", @{$caller} ) . ")"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | 0 | $self->add_hook($hook); | |||||||||||||||||||
| 34 | } | ||||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | } | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 307 | ▶ | sub dsl_keywords { | ||||||||||||||||||
|
Subroutine
dsl_keywords: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | # the flag means : 1 = is global, 0 = is not global. global means can be | ||||||||||||||||||||
| 41 | # called from anywhere. not global means must be called from within a route | ||||||||||||||||||||
| 42 | # handler | ||||||||||||||||||||
| 43 | 307 | { any => { is_global => 1 }, | |||||||||||||||||||
| 44 | app => { is_global => 1 }, | ||||||||||||||||||||
| 45 | captures => { is_global => 0 }, | ||||||||||||||||||||
| 46 | config => { is_global => 1 }, | ||||||||||||||||||||
| 47 | content => { is_global => 0 }, | ||||||||||||||||||||
| 48 | content_type => { is_global => 0 }, | ||||||||||||||||||||
| 49 | context => { is_global => 0 }, | ||||||||||||||||||||
| 50 | cookie => { is_global => 0 }, | ||||||||||||||||||||
| 51 | cookies => { is_global => 0 }, | ||||||||||||||||||||
| 52 | dance => { is_global => 1 }, | ||||||||||||||||||||
| 53 | dancer_app => { is_global => 1 }, | ||||||||||||||||||||
| 54 | dancer_version => { is_global => 1 }, | ||||||||||||||||||||
| 55 | dancer_major_version => { is_global => 1 }, | ||||||||||||||||||||
| 56 | debug => { is_global => 1 }, | ||||||||||||||||||||
| 57 | decode_json => { is_global => 1 }, | ||||||||||||||||||||
| 58 | del => { is_global => 1 }, | ||||||||||||||||||||
| 59 | delayed => { | ||||||||||||||||||||
| 60 | is_global => 0, prototype => '&@', | ||||||||||||||||||||
| 61 | }, | ||||||||||||||||||||
| 62 | dirname => { is_global => 1 }, | ||||||||||||||||||||
| 63 | done => { is_global => 0 }, | ||||||||||||||||||||
| 64 | dsl => { is_global => 1 }, | ||||||||||||||||||||
| 65 | encode_json => { is_global => 1 }, | ||||||||||||||||||||
| 66 | engine => { is_global => 1 }, | ||||||||||||||||||||
| 67 | error => { is_global => 1 }, | ||||||||||||||||||||
| 68 | false => { is_global => 1 }, | ||||||||||||||||||||
| 69 | flush => { is_global => 0 }, | ||||||||||||||||||||
| 70 | forward => { is_global => 0 }, | ||||||||||||||||||||
| 71 | from_json => { is_global => 1 }, | ||||||||||||||||||||
| 72 | from_yaml => { is_global => 1 }, | ||||||||||||||||||||
| 73 | get => { is_global => 1 }, | ||||||||||||||||||||
| 74 | halt => { is_global => 0 }, | ||||||||||||||||||||
| 75 | header => { is_global => 0 }, | ||||||||||||||||||||
| 76 | headers => { is_global => 0 }, | ||||||||||||||||||||
| 77 | hook => { is_global => 1 }, | ||||||||||||||||||||
| 78 | info => { is_global => 1 }, | ||||||||||||||||||||
| 79 | log => { is_global => 1 }, | ||||||||||||||||||||
| 80 | mime => { is_global => 1 }, | ||||||||||||||||||||
| 81 | options => { is_global => 1 }, | ||||||||||||||||||||
| 82 | param => { is_global => 0 }, | ||||||||||||||||||||
| 83 | params => { is_global => 0 }, | ||||||||||||||||||||
| 84 | query_parameters => { is_global => 0 }, | ||||||||||||||||||||
| 85 | body_parameters => { is_global => 0 }, | ||||||||||||||||||||
| 86 | route_parameters => { is_global => 0 }, | ||||||||||||||||||||
| 87 | pass => { is_global => 0 }, | ||||||||||||||||||||
| 88 | patch => { is_global => 1 }, | ||||||||||||||||||||
| 89 | path => { is_global => 1 }, | ||||||||||||||||||||
| 90 | post => { is_global => 1 }, | ||||||||||||||||||||
| 91 | prefix => { is_global => 1 }, | ||||||||||||||||||||
| 92 | prepare_app => { | ||||||||||||||||||||
| 93 | is_global => 1, prototype => '&', | ||||||||||||||||||||
| 94 | }, | ||||||||||||||||||||
| 95 | psgi_app => { is_global => 1 }, | ||||||||||||||||||||
| 96 | push_header => { is_global => 0 }, | ||||||||||||||||||||
| 97 | push_response_header => { is_global => 0 }, | ||||||||||||||||||||
| 98 | put => { is_global => 1 }, | ||||||||||||||||||||
| 99 | redirect => { is_global => 0 }, | ||||||||||||||||||||
| 100 | request => { is_global => 0 }, | ||||||||||||||||||||
| 101 | request_data => { is_global => 0 }, | ||||||||||||||||||||
| 102 | request_header => { is_global => 0 }, | ||||||||||||||||||||
| 103 | response => { is_global => 0 }, | ||||||||||||||||||||
| 104 | response_header => { is_global => 0 }, | ||||||||||||||||||||
| 105 | response_headers => { is_global => 0 }, | ||||||||||||||||||||
| 106 | runner => { is_global => 1 }, | ||||||||||||||||||||
| 107 | send_as => { is_global => 0 }, | ||||||||||||||||||||
| 108 | send_error => { is_global => 0 }, | ||||||||||||||||||||
| 109 | send_file => { is_global => 0 }, | ||||||||||||||||||||
| 110 | session => { is_global => 0 }, | ||||||||||||||||||||
| 111 | set => { is_global => 1 }, | ||||||||||||||||||||
| 112 | setting => { is_global => 1 }, | ||||||||||||||||||||
| 113 | splat => { is_global => 0 }, | ||||||||||||||||||||
| 114 | start => { is_global => 1 }, | ||||||||||||||||||||
| 115 | status => { is_global => 0 }, | ||||||||||||||||||||
| 116 | template => { is_global => 1 }, | ||||||||||||||||||||
| 117 | to_app => { is_global => 1 }, | ||||||||||||||||||||
| 118 | to_json => { is_global => 1 }, | ||||||||||||||||||||
| 119 | to_yaml => { is_global => 1 }, | ||||||||||||||||||||
| 120 | true => { is_global => 1 }, | ||||||||||||||||||||
| 121 | upload => { is_global => 0 }, | ||||||||||||||||||||
| 122 | uri_for => { is_global => 0 }, | ||||||||||||||||||||
| 123 | uri_for_route => { is_global => 0 }, | ||||||||||||||||||||
| 124 | var => { is_global => 0 }, | ||||||||||||||||||||
| 125 | vars => { is_global => 0 }, | ||||||||||||||||||||
| 126 | warning => { is_global => 1 }, | ||||||||||||||||||||
| 127 | }; | ||||||||||||||||||||
| 128 | } | ||||||||||||||||||||
| 129 | |||||||||||||||||||||
| 130 | 15 | ▶ | sub dancer_app { shift->app } | ||||||||||||||||||
|
Subroutine
dancer_app: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 131 | 1 | ▶ | sub dancer_version { Dancer2->VERSION } | ||||||||||||||||||
|
Subroutine
dancer_version: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 132 | |||||||||||||||||||||
| 133 | 0 | ▶ | sub dancer_major_version { | ||||||||||||||||||
|
Subroutine
dancer_major_version: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 134 | 0 | return ( split /\./, dancer_version )[0]; | |||||||||||||||||||
| 135 | } | ||||||||||||||||||||
| 136 | |||||||||||||||||||||
| 137 | 0 | ▶ | sub log { shift->app->log( @_ ) } | ||||||||||||||||||
|
Subroutine
log: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 138 | 3 | ▶ | sub debug { shift->app->log( debug => @_ ) } | ||||||||||||||||||
|
Subroutine
debug: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 139 | 2 | ▶ | sub info { shift->app->log( info => @_ ) } | ||||||||||||||||||
|
Subroutine
info: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 140 | 5 | ▶ | sub warning { shift->app->log( warning => @_ ) } | ||||||||||||||||||
|
Subroutine
warning: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 141 | 2 | ▶ | sub error { shift->app->log( error => @_ ) } | ||||||||||||||||||
|
Subroutine
error: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 142 | |||||||||||||||||||||
| 143 | 1 | ▶ | sub true {1} | ||||||||||||||||||
|
Subroutine
true: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 144 | 0 | ▶ | sub false {0} | ||||||||||||||||||
|
Subroutine
false: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 145 | |||||||||||||||||||||
| 146 | 3 | ▶ | sub _path_obj { Path::Tiny::path(@_) } | ||||||||||||||||||
|
Subroutine
_path_obj: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 147 | 1 | ▶ | sub dirname { shift and _path_obj(@_)->parent->stringify } | ||||||||||||||||||
|
Subroutine
dirname: called CC=2 SCAR=7.6
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||
| 148 | 2 | ▶ | sub path { shift and _path_obj(@_)->stringify } | ||||||||||||||||||
|
Subroutine
path: called CC=2 SCAR=7.6
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||
| 149 | |||||||||||||||||||||
| 150 | 4 | ▶ | sub config { shift->app->settings } | ||||||||||||||||||
|
Subroutine
config: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 151 | |||||||||||||||||||||
| 152 | 10 | ▶ | sub engine { shift->app->engine(@_) } | ||||||||||||||||||
|
Subroutine
engine: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 153 | |||||||||||||||||||||
| 154 | 231 | ▶ | sub setting { shift->app->setting(@_) } | ||||||||||||||||||
|
Subroutine
setting: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 155 | |||||||||||||||||||||
| 156 | 215 | ▶ | sub set { shift->setting(@_) } | ||||||||||||||||||
|
Subroutine
set: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 157 | |||||||||||||||||||||
| 158 | 38 | ▶ | sub template { shift->app->template(@_) } | ||||||||||||||||||
|
Subroutine
template: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 159 | |||||||||||||||||||||
| 160 | 162 | ▶ | sub session { | ||||||||||||||||||
|
Subroutine
session: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||
| 161 | 162 | my ( $self, $key, $value ) = @_; | |||||||||||||||||||
| 162 | |||||||||||||||||||||
| 163 | # shortcut reads if no session exists, so we don't | ||||||||||||||||||||
| 164 | # instantiate sessions for no reason | ||||||||||||||||||||
| 165 | 162 | ▶ | if ( @_ == 2 ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 166 | 71 | ▶ | return unless $self->app->has_session; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 167 | } | ||||||||||||||||||||
| 168 | |||||||||||||||||||||
| 169 | 147 | ▶ | my $session = $self->app->session | ||||||||||||||||||
|
Condition33%1/3
$self->app->session || croak('No session available, a session engine needs to be set')
MC/DC0%0/2
$self->app->session || croak('No session available, a session engine needs to be set')
$self->app->session
croak('No session available, a session engine needs to be set')
Truth table33%1/3
A || B
A= $self->app->sessionB= croak('No session available, a session engine needs to be set')
| |||||||||||||||||||||
| 170 | || croak "No session available, a session engine needs to be set"; | ||||||||||||||||||||
| 171 | |||||||||||||||||||||
| 172 | 147 | $self->app->setup_session; | |||||||||||||||||||
| 173 | |||||||||||||||||||||
| 174 | # return the session object if no key | ||||||||||||||||||||
| 175 | 147 | ▶ | @_ == 1 and return $session; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 176 | |||||||||||||||||||||
| 177 | # read if a key is provided | ||||||||||||||||||||
| 178 | 129 | ▶ | @_ == 2 and return $session->read($key); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 179 | |||||||||||||||||||||
| 180 | |||||||||||||||||||||
| 181 | # write to the session or delete if value is undef | ||||||||||||||||||||
| 182 | 73 | ▶ | if ( defined $value ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 183 | 64 | $session->write( $key => $value ); | |||||||||||||||||||
| 184 | } | ||||||||||||||||||||
| 185 | else { | ||||||||||||||||||||
| 186 | 9 | $session->delete($key); | |||||||||||||||||||
| 187 | } | ||||||||||||||||||||
| 188 | } | ||||||||||||||||||||
| 189 | |||||||||||||||||||||
| 190 | 11 | ▶ | sub send_as { shift->app->send_as(@_) } | ||||||||||||||||||
|
Subroutine
send_as: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 191 | |||||||||||||||||||||
| 192 | 20 | ▶ | sub send_error { shift->app->send_error(@_) } | ||||||||||||||||||
|
Subroutine
send_error: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 193 | |||||||||||||||||||||
| 194 | 24 | ▶ | sub send_file { shift->app->send_file(@_) } | ||||||||||||||||||
|
Subroutine
send_file: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 195 | |||||||||||||||||||||
| 196 | # | ||||||||||||||||||||
| 197 | # route handlers & friends | ||||||||||||||||||||
| 198 | # | ||||||||||||||||||||
| 199 | |||||||||||||||||||||
| 200 | 104 | ▶ | sub hook { | ||||||||||||||||||
|
Subroutine
hook: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 201 | 104 | my ( $self, $name, $code ) = @_; | |||||||||||||||||||
| 202 | 104 | $self->app->add_hook( | |||||||||||||||||||
| 203 | Dancer2::Core::Hook->new( name => $name, code => $code ) ); | ||||||||||||||||||||
| 204 | } | ||||||||||||||||||||
| 205 | |||||||||||||||||||||
| 206 | 4 | ▶ | sub prefix { | ||||||||||||||||||
|
Subroutine
prefix: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 207 | 4 | my $app = shift->app; | |||||||||||||||||||
| 208 | 4 | ▶ | @_ == 1 | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 209 | ? $app->prefix(@_) | ||||||||||||||||||||
| 210 | : $app->lexical_prefix(@_); | ||||||||||||||||||||
| 211 | } | ||||||||||||||||||||
| 212 | |||||||||||||||||||||
| 213 | 9 | ▶ | sub halt { shift->app->halt(@_) } | ||||||||||||||||||
|
Subroutine
halt: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 214 | |||||||||||||||||||||
| 215 | 2 | ▶ | sub del { shift->_normalize_route( [qw/delete /], @_ ) } | ||||||||||||||||||
|
Subroutine
del: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 216 | 383 | ▶ | sub get { shift->_normalize_route( [qw/get head/], @_ ) } | ||||||||||||||||||
|
Subroutine
get: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 217 | 1 | ▶ | sub options { shift->_normalize_route( [qw/options /], @_ ) } | ||||||||||||||||||
|
Subroutine
options: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 218 | 3 | ▶ | sub patch { shift->_normalize_route( [qw/patch /], @_ ) } | ||||||||||||||||||
|
Subroutine
patch: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 219 | 43 | ▶ | sub post { shift->_normalize_route( [qw/post /], @_ ) } | ||||||||||||||||||
|
Subroutine
post: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 220 | 4 | ▶ | sub put { shift->_normalize_route( [qw/put /], @_ ) } | ||||||||||||||||||
|
Subroutine
put: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 221 | |||||||||||||||||||||
| 222 | 2 | ▶ | sub prepare_app { push @{ shift->app->prep_apps }, @_ } | ||||||||||||||||||
|
Subroutine
prepare_app: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 223 | |||||||||||||||||||||
| 224 | 7 | ▶ | sub any { | ||||||||||||||||||
|
Subroutine
any: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||
| 225 | 7 | my $self = shift; | |||||||||||||||||||
| 226 | |||||||||||||||||||||
| 227 | # If they've supplied their own list of methods, | ||||||||||||||||||||
| 228 | # expand del, otherwise give them the default list. | ||||||||||||||||||||
| 229 | 7 | ▶ | if ( is_arrayref($_[0]) ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 230 | 3 | s/^del$/delete/ for @{ $_[0] }; | |||||||||||||||||||
| 231 | } | ||||||||||||||||||||
| 232 | else { | ||||||||||||||||||||
| 233 | 4 | unshift @_, [qw/delete get head options patch post put/]; | |||||||||||||||||||
| 234 | } | ||||||||||||||||||||
| 235 | |||||||||||||||||||||
| 236 | 7 | $self->_normalize_route(@_); | |||||||||||||||||||
| 237 | } | ||||||||||||||||||||
| 238 | |||||||||||||||||||||
| 239 | 443 | ▶ | sub _normalize_route { | ||||||||||||||||||
|
Subroutine
_normalize_route: called CC=5 SCAR=16.3
| |||||||||||||||||||||
| 240 | 443 | my $app = shift->app; | |||||||||||||||||||
| 241 | 443 | my $methods = shift; | |||||||||||||||||||
| 242 | 443 | my %args; | |||||||||||||||||||
| 243 | |||||||||||||||||||||
| 244 | # Options are optional, try to deduce their presence from arg length. | ||||||||||||||||||||
| 245 | 443 | ▶ | if ( @_ == 4 ) { | ||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||
| 246 | # @_ = ( NAME, REGEXP, OPTIONS, CODE ) | ||||||||||||||||||||
| 247 | # get 'foo', '/foo', { 'user_agent' => '...' }, sub {...} | ||||||||||||||||||||
| 248 | 3 | @args{qw<name regexp options code>} = @_; | |||||||||||||||||||
| 249 | } elsif ( @_ == 2 ) { | ||||||||||||||||||||
| 250 | # @_ = ( REGEXP, CODE ) | ||||||||||||||||||||
| 251 | # get '/foo', sub {...} | ||||||||||||||||||||
| 252 | 429 | @args{qw<regexp code>} = @_; | |||||||||||||||||||
| 253 | } elsif ( @_ == 3 ) { | ||||||||||||||||||||
| 254 | # @_ = ( REGEXP, OPTIONS, CODE ) | ||||||||||||||||||||
| 255 | # get '/foo', { 'user_agent' => '...' }, sub {...} | ||||||||||||||||||||
| 256 | # @_ = ( NAME, REGEXP, CODE ) | ||||||||||||||||||||
| 257 | # get 'foo', '/foo',sub {...} | ||||||||||||||||||||
| 258 | 11 | ▶ | if ( is_hashref( $_[1] ) ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 259 | 0 | @args{qw<regexp options code>} = @_; | |||||||||||||||||||
| 260 | } else { | ||||||||||||||||||||
| 261 | 11 | @args{qw<name regexp code>} = @_; | |||||||||||||||||||
| 262 | } | ||||||||||||||||||||
| 263 | } | ||||||||||||||||||||
| 264 | |||||||||||||||||||||
| 265 | 443 | return map $app->add_route( %args, method => $_ ), @{$methods}; | |||||||||||||||||||
| 266 | } | ||||||||||||||||||||
| 267 | |||||||||||||||||||||
| 268 | # | ||||||||||||||||||||
| 269 | # Server startup | ||||||||||||||||||||
| 270 | # | ||||||||||||||||||||
| 271 | |||||||||||||||||||||
| 272 | # access to the runner singleton | ||||||||||||||||||||
| 273 | # will be populated on-the-fly when needed | ||||||||||||||||||||
| 274 | # this singleton contains anything needed to start the application server | ||||||||||||||||||||
| 275 | 1 | ▶ | sub runner { Dancer2->runner } | ||||||||||||||||||
|
Subroutine
runner: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 276 | |||||||||||||||||||||
| 277 | # start the server | ||||||||||||||||||||
| 278 | 0 | ▶ | sub start { shift->runner->start } | ||||||||||||||||||
|
Subroutine
start: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 279 | |||||||||||||||||||||
| 280 | 0 | ▶ | sub dance { shift->start(@_) } | ||||||||||||||||||
|
Subroutine
dance: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 281 | |||||||||||||||||||||
| 282 | 2 | ▶ | sub psgi_app { | ||||||||||||||||||
|
Subroutine
psgi_app: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 283 | 2 | my $self = shift; | |||||||||||||||||||
| 284 | |||||||||||||||||||||
| 285 | 2 | $self->app->to_app; | |||||||||||||||||||
| 286 | } | ||||||||||||||||||||
| 287 | |||||||||||||||||||||
| 288 | 198 | ▶ | sub to_app { shift->app->to_app } | ||||||||||||||||||
|
Subroutine
to_app: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 289 | |||||||||||||||||||||
| 290 | # | ||||||||||||||||||||
| 291 | # Response alterations | ||||||||||||||||||||
| 292 | # | ||||||||||||||||||||
| 293 | |||||||||||||||||||||
| 294 | 9 | ▶ | sub status { | ||||||||||||||||||
|
Subroutine
status: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 295 | 9 | $Dancer2::Core::Route::RESPONSE->status( $_[1] ); | |||||||||||||||||||
| 296 | } | ||||||||||||||||||||
| 297 | |||||||||||||||||||||
| 298 | 0 | ▶ | sub push_header { | ||||||||||||||||||
|
Subroutine
push_header: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 299 | 0 | Carp::croak "DEPRECATED: push_header keyword. Please use the 'push_response_header' keyword instead of 'push_header'"; | |||||||||||||||||||
| 300 | } | ||||||||||||||||||||
| 301 | |||||||||||||||||||||
| 302 | 0 | ▶ | sub push_response_header { | ||||||||||||||||||
|
Subroutine
push_response_header: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 303 | 0 | shift; | |||||||||||||||||||
| 304 | 0 | $Dancer2::Core::Route::RESPONSE->push_header(@_); | |||||||||||||||||||
| 305 | } | ||||||||||||||||||||
| 306 | |||||||||||||||||||||
| 307 | 0 | ▶ | sub header { | ||||||||||||||||||
|
Subroutine
header: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 308 | 0 | Carp::croak "DEPRECATED: header keyword. Please use the 'response_header' keyword instead of 'header'"; | |||||||||||||||||||
| 309 | } | ||||||||||||||||||||
| 310 | |||||||||||||||||||||
| 311 | 4 | ▶ | sub response_header { | ||||||||||||||||||
|
Subroutine
response_header: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 312 | 4 | shift; | |||||||||||||||||||
| 313 | 4 | $Dancer2::Core::Route::RESPONSE->header(@_); | |||||||||||||||||||
| 314 | } | ||||||||||||||||||||
| 315 | |||||||||||||||||||||
| 316 | 0 | ▶ | sub headers { | ||||||||||||||||||
|
Subroutine
headers: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 317 | 0 | Carp::croak "DEPRECATED: headers keyword. Please use the 'response_headers' keyword instead of 'headers'"; | |||||||||||||||||||
| 318 | } | ||||||||||||||||||||
| 319 | |||||||||||||||||||||
| 320 | 0 | ▶ | sub response_headers { | ||||||||||||||||||
|
Subroutine
response_headers: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 321 | 0 | shift; | |||||||||||||||||||
| 322 | 0 | $Dancer2::Core::Route::RESPONSE->header(@_); | |||||||||||||||||||
| 323 | } | ||||||||||||||||||||
| 324 | |||||||||||||||||||||
| 325 | 1 | ▶ | sub content { | ||||||||||||||||||
|
Subroutine
content: called CC=6 SCAR=33.1
Pod
undocumented
| |||||||||||||||||||||
| 326 | 1 | my $dsl = shift; | |||||||||||||||||||
| 327 | |||||||||||||||||||||
| 328 | # simple synchronous response | ||||||||||||||||||||
| 329 | 1 | ▶ | my $responder = $Dancer2::Core::Route::RESPONDER | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 330 | or croak 'Cannot use content keyword outside delayed response'; | ||||||||||||||||||||
| 331 | |||||||||||||||||||||
| 332 | # flush if wasn't flushed before | ||||||||||||||||||||
| 333 | 0 | ▶ | if ( !$Dancer2::Core::Route::WRITER ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 334 | 0 | $Dancer2::Core::Route::WRITER = $responder->([ | |||||||||||||||||||
| 335 | $Dancer2::Core::Route::RESPONSE->status, | ||||||||||||||||||||
| 336 | $Dancer2::Core::Route::RESPONSE->headers_to_array, | ||||||||||||||||||||
| 337 | ]); | ||||||||||||||||||||
| 338 | } | ||||||||||||||||||||
| 339 | |||||||||||||||||||||
| 340 | eval { | ||||||||||||||||||||
| 341 | 0 | $Dancer2::Core::Route::WRITER->write(@_); | |||||||||||||||||||
| 342 | 0 | 1; | |||||||||||||||||||
| 343 | 0 | ▶ | } or do { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 344 | 0 | ▶ | my $error = $@ || 'Zombie Error'; | ||||||||||||||||||
|
Condition0%0/2
$@ || 'Zombie Error'
MC/DC0%0/1
$@ || 'Zombie Error'
$@
Truth table0%0/2
A
A= $@
| |||||||||||||||||||||
| 345 | 0 | ▶ | $Dancer2::Core::Route::ERROR_HANDLER | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 346 | ? $Dancer2::Core::Route::ERROR_HANDLER->($error) | ||||||||||||||||||||
| 347 | : $dsl->app->logger_engine->log( | ||||||||||||||||||||
| 348 | warning => "Error in delayed response: $error" | ||||||||||||||||||||
| 349 | ); | ||||||||||||||||||||
| 350 | }; | ||||||||||||||||||||
| 351 | } | ||||||||||||||||||||
| 352 | |||||||||||||||||||||
| 353 | 0 | ▶ | sub content_type { | ||||||||||||||||||
|
Subroutine
content_type: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 354 | 0 | shift; | |||||||||||||||||||
| 355 | 0 | $Dancer2::Core::Route::RESPONSE->content_type(@_); | |||||||||||||||||||
| 356 | } | ||||||||||||||||||||
| 357 | |||||||||||||||||||||
| 358 | 1 | ▶ | sub delayed { | ||||||||||||||||||
|
Subroutine
delayed: called CC=3 SCAR=18.1
Pod
undocumented
| |||||||||||||||||||||
| 359 | 1 | my ( $dsl, $cb, @args ) = @_; | |||||||||||||||||||
| 360 | |||||||||||||||||||||
| 361 | 1 | ▶ | @args % 2 == 0 | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 362 | or croak 'Arguments to delayed() keyword must be key/value pairs'; | ||||||||||||||||||||
| 363 | |||||||||||||||||||||
| 364 | # first time, responder doesn't exist yet | ||||||||||||||||||||
| 365 | 1 | my %opts = @args; | |||||||||||||||||||
| 366 | $Dancer2::Core::Route::RESPONDER | ||||||||||||||||||||
| 367 | or return Dancer2::Core::Response::Delayed->new( | ||||||||||||||||||||
| 368 | cb => $cb, | ||||||||||||||||||||
| 369 | request => $Dancer2::Core::Route::REQUEST, | ||||||||||||||||||||
| 370 | response => $Dancer2::Core::Route::RESPONSE, | ||||||||||||||||||||
| 371 | |||||||||||||||||||||
| 372 | 1 | ▶ | ( error_cb => $opts{'on_error'} )x!! $opts{'on_error'}, | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 373 | ); | ||||||||||||||||||||
| 374 | |||||||||||||||||||||
| 375 | # we're in an async request process | ||||||||||||||||||||
| 376 | 0 | my $request = $Dancer2::Core::Route::REQUEST; | |||||||||||||||||||
| 377 | 0 | my $response = $Dancer2::Core::Route::RESPONSE; | |||||||||||||||||||
| 378 | 0 | my $responder = $Dancer2::Core::Route::RESPONDER; | |||||||||||||||||||
| 379 | 0 | my $writer = $Dancer2::Core::Route::WRITER; | |||||||||||||||||||
| 380 | 0 | my $handler = $Dancer2::Core::Route::ERROR_HANDLER; | |||||||||||||||||||
| 381 | |||||||||||||||||||||
| 382 | 0 | ▶ | return sub { | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 383 | 0 | local $Dancer2::Core::Route::REQUEST = $request; | |||||||||||||||||||
| 384 | 0 | local $Dancer2::Core::Route::RESPONSE = $response; | |||||||||||||||||||
| 385 | 0 | local $Dancer2::Core::Route::RESPONDER = $responder; | |||||||||||||||||||
| 386 | 0 | local $Dancer2::Core::Route::WRITER = $writer; | |||||||||||||||||||
| 387 | 0 | local $Dancer2::Core::Route::ERROR_HANDLER = $handler; | |||||||||||||||||||
| 388 | |||||||||||||||||||||
| 389 | 0 | $cb->(@_); | |||||||||||||||||||
| 390 | 0 | }; | |||||||||||||||||||
| 391 | } | ||||||||||||||||||||
| 392 | |||||||||||||||||||||
| 393 | 0 | ▶ | sub flush { | ||||||||||||||||||
|
Subroutine
flush: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 394 | 0 | ▶ | my $responder = $Dancer2::Core::Route::RESPONDER | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 395 | or croak 'flush() called outside streaming response'; | ||||||||||||||||||||
| 396 | |||||||||||||||||||||
| 397 | 0 | my $response = $Dancer2::Core::Route::RESPONSE; | |||||||||||||||||||
| 398 | 0 | $Dancer2::Core::Route::WRITER = $responder->([ | |||||||||||||||||||
| 399 | $response->status, $response->headers_to_array, | ||||||||||||||||||||
| 400 | ]); | ||||||||||||||||||||
| 401 | } | ||||||||||||||||||||
| 402 | |||||||||||||||||||||
| 403 | 0 | ▶ | sub done { | ||||||||||||||||||
|
Subroutine
done: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 404 | 0 | ▶ | my $writer = $Dancer2::Core::Route::WRITER | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 405 | or croak 'done() called outside streaming response'; | ||||||||||||||||||||
| 406 | |||||||||||||||||||||
| 407 | 0 | $writer->close; | |||||||||||||||||||
| 408 | } | ||||||||||||||||||||
| 409 | |||||||||||||||||||||
| 410 | 3 | ▶ | sub pass { shift->app->pass } | ||||||||||||||||||
|
Subroutine
pass: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 411 | |||||||||||||||||||||
| 412 | # | ||||||||||||||||||||
| 413 | # Route handler helpers | ||||||||||||||||||||
| 414 | # | ||||||||||||||||||||
| 415 | |||||||||||||||||||||
| 416 | 0 | ▶ | sub context { | ||||||||||||||||||
|
Subroutine
context: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 417 | 0 | Carp::croak "DEPRECATED: context keyword. Please use the 'app' keyword instead of 'context'"; | |||||||||||||||||||
| 418 | } | ||||||||||||||||||||
| 419 | |||||||||||||||||||||
| 420 | 128 | ▶ | sub request { $Dancer2::Core::Route::REQUEST } | ||||||||||||||||||
|
Subroutine
request: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 421 | |||||||||||||||||||||
| 422 | 1 | ▶ | sub request_header { shift; $Dancer2::Core::Route::REQUEST->headers->header(@_) } | ||||||||||||||||||
|
Subroutine
request_header: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 423 | |||||||||||||||||||||
| 424 | 12 | ▶ | sub response { $Dancer2::Core::Route::RESPONSE } | ||||||||||||||||||
|
Subroutine
response: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 425 | |||||||||||||||||||||
| 426 | 2 | ▶ | sub upload { shift; $Dancer2::Core::Route::REQUEST->upload(@_); } | ||||||||||||||||||
|
Subroutine
upload: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 427 | |||||||||||||||||||||
| 428 | 2 | ▶ | sub captures { $Dancer2::Core::Route::REQUEST->captures } | ||||||||||||||||||
|
Subroutine
captures: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 429 | |||||||||||||||||||||
| 430 | 5 | ▶ | sub uri_for { shift; $Dancer2::Core::Route::REQUEST->uri_for(@_); } | ||||||||||||||||||
|
Subroutine
uri_for: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 431 | |||||||||||||||||||||
| 432 | 26 | ▶ | sub uri_for_route { shift->app->uri_for_route(@_); } | ||||||||||||||||||
|
Subroutine
uri_for_route: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 433 | |||||||||||||||||||||
| 434 | 32 | ▶ | sub splat { $Dancer2::Core::Route::REQUEST->splat } | ||||||||||||||||||
|
Subroutine
splat: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 435 | |||||||||||||||||||||
| 436 | 49 | ▶ | sub params { shift; $Dancer2::Core::Route::REQUEST->params(@_); } | ||||||||||||||||||
|
Subroutine
params: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 437 | |||||||||||||||||||||
| 438 | 6 | ▶ | sub param { shift; $Dancer2::Core::Route::REQUEST->param(@_); } | ||||||||||||||||||
|
Subroutine
param: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 439 | |||||||||||||||||||||
| 440 | 6 | ▶ | sub query_parameters { shift; $Dancer2::Core::Route::REQUEST->query_parameters(@_); } | ||||||||||||||||||
|
Subroutine
query_parameters: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 441 | 18 | ▶ | sub body_parameters { shift; $Dancer2::Core::Route::REQUEST->body_parameters(@_); } | ||||||||||||||||||
|
Subroutine
body_parameters: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 442 | 14 | ▶ | sub route_parameters { shift; $Dancer2::Core::Route::REQUEST->route_parameters(@_); } | ||||||||||||||||||
|
Subroutine
route_parameters: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 443 | |||||||||||||||||||||
| 444 | 2 | ▶ | sub request_data { shift; $Dancer2::Core::Route::REQUEST->body_data(@_); } | ||||||||||||||||||
|
Subroutine
request_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 445 | |||||||||||||||||||||
| 446 | 30 | ▶ | sub redirect { shift->app->redirect(@_) } | ||||||||||||||||||
|
Subroutine
redirect: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 447 | |||||||||||||||||||||
| 448 | 50 | ▶ | sub forward { shift->app->forward(@_) } | ||||||||||||||||||
|
Subroutine
forward: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 449 | |||||||||||||||||||||
| 450 | 12 | ▶ | sub vars { $Dancer2::Core::Route::REQUEST->vars } | ||||||||||||||||||
|
Subroutine
vars: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 451 | |||||||||||||||||||||
| 452 | 9 | ▶ | sub var { shift; $Dancer2::Core::Route::REQUEST->var(@_); } | ||||||||||||||||||
|
Subroutine
var: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 453 | |||||||||||||||||||||
| 454 | 0 | ▶ | sub cookies { $Dancer2::Core::Route::REQUEST->cookies } | ||||||||||||||||||
|
Subroutine
cookies: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 455 | 0 | ▶ | sub cookie { shift->app->cookie(@_) } | ||||||||||||||||||
|
Subroutine
cookie: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 456 | |||||||||||||||||||||
| 457 | 2 | ▶ | sub mime { | ||||||||||||||||||
|
Subroutine
mime: called CC=2 SCAR=9.2
Pod
undocumented
| |||||||||||||||||||||
| 458 | 2 | my $self = shift; | |||||||||||||||||||
| 459 | 2 | ▶ | if ( $self->app ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 460 | 2 | return $self->app->mime_type; | |||||||||||||||||||
| 461 | } | ||||||||||||||||||||
| 462 | else { | ||||||||||||||||||||
| 463 | 0 | my $runner = $self->runner; | |||||||||||||||||||
| 464 | 0 | $runner->mime_type->reset_to_default; | |||||||||||||||||||
| 465 | 0 | return $runner->mime_type; | |||||||||||||||||||
| 466 | } | ||||||||||||||||||||
| 467 | } | ||||||||||||||||||||
| 468 | |||||||||||||||||||||
| 469 | # | ||||||||||||||||||||
| 470 | # engines | ||||||||||||||||||||
| 471 | # | ||||||||||||||||||||
| 472 | |||||||||||||||||||||
| 473 | 10 | ▶ | sub from_json { | ||||||||||||||||||
|
Subroutine
from_json: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 474 | 10 | shift; # remove first element | |||||||||||||||||||
| 475 | 10 | require_module('Dancer2::Serializer::JSON'); | |||||||||||||||||||
| 476 | 10 | Dancer2::Serializer::JSON::from_json(@_); | |||||||||||||||||||
| 477 | } | ||||||||||||||||||||
| 478 | |||||||||||||||||||||
| 479 | 34 | ▶ | sub to_json { | ||||||||||||||||||
|
Subroutine
to_json: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 480 | 34 | shift; # remove first element | |||||||||||||||||||
| 481 | 34 | require_module('Dancer2::Serializer::JSON'); | |||||||||||||||||||
| 482 | 34 | Dancer2::Serializer::JSON::to_json(@_); | |||||||||||||||||||
| 483 | } | ||||||||||||||||||||
| 484 | |||||||||||||||||||||
| 485 | 1 | ▶ | sub decode_json { | ||||||||||||||||||
|
Subroutine
decode_json: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 486 | 1 | shift; # remove first element | |||||||||||||||||||
| 487 | 1 | require_module('Dancer2::Serializer::JSON'); | |||||||||||||||||||
| 488 | 1 | Dancer2::Serializer::JSON::decode_json(@_); | |||||||||||||||||||
| 489 | } | ||||||||||||||||||||
| 490 | |||||||||||||||||||||
| 491 | 2 | ▶ | sub encode_json { | ||||||||||||||||||
|
Subroutine
encode_json: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 492 | 2 | shift; # remove first element | |||||||||||||||||||
| 493 | 2 | require_module('Dancer2::Serializer::JSON'); | |||||||||||||||||||
| 494 | 2 | Dancer2::Serializer::JSON::encode_json(@_); | |||||||||||||||||||
| 495 | } | ||||||||||||||||||||
| 496 | |||||||||||||||||||||
| 497 | 9 | ▶ | sub from_yaml { | ||||||||||||||||||
|
Subroutine
from_yaml: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 498 | 9 | shift; # remove first element | |||||||||||||||||||
| 499 | 9 | require_module('Dancer2::Serializer::YAML'); | |||||||||||||||||||
| 500 | 9 | Dancer2::Serializer::YAML::from_yaml(@_); | |||||||||||||||||||
| 501 | } | ||||||||||||||||||||
| 502 | |||||||||||||||||||||
| 503 | 19 | ▶ | sub to_yaml { | ||||||||||||||||||
|
Subroutine
to_yaml: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 504 | 19 | shift; # remove first element | |||||||||||||||||||
| 505 | 19 | require_module('Dancer2::Serializer::YAML'); | |||||||||||||||||||
| 506 | 19 | Dancer2::Serializer::YAML::to_yaml(@_); | |||||||||||||||||||
| 507 | } | ||||||||||||||||||||
| 508 | |||||||||||||||||||||
| 509 | 159 | 1; | |||||||||||||||||||
| 510 | |||||||||||||||||||||
| 511 | __END__ | ||||||||||||||||||||