App-pause
view release on metacpan or search on metacpan
script/pause view on Meta::CPAN
# fill defaults from "default" property and check against schema
no warnings ('void');
require List::Util;
require Time::Local;
require Scalar::Util;
require Scalar::Util::Numeric::PP;
my $_sahv_dpath;
my $_sahv_err;
if (exists $args->{"del"}) {
$_sahv_dpath = [];
# skip if undef
(!defined($args->{"del"}) ? 1 :
(# check type 'bool'
((!ref($args->{"del"})) ? 1 : (($_sahv_err //= "Not of type boolean value"),0))))
; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
} # if date arg exists
if (exists $args->{"detail"}) {
$_sahv_dpath = [];
# skip if undef
(!defined($args->{"detail"}) ? 1 :
(# check type 'bool'
((!ref($args->{"detail"})) ? 1 : (($_sahv_err //= "Not of type boolean value"),0))))
; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
} # if date arg exists
if (exists $args->{"files"}) {
$_sahv_dpath = [];
# req #0
((defined($args->{"files"})) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Required but not specified"),0))
&&
# check type 'array'
((ref($args->{"files"}) eq 'ARRAY') ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Not of type array"),0))
&&
([push(@{$_sahv_dpath}, undef), scalar(# clause: of
((!defined(List::Util::first(sub {!(
($_sahv_dpath->[-1] = $_),
# req #0
((defined($args->{"files"}->[$_])) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Required but not specified"),0))
&&
# check type 'str'
((!ref($args->{"files"}->[$_])) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Not of type text"),0))
)}, 0..@{$args->{"files"}}-1))) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Not of type text"),0))), pop(@{$_sahv_dpath})]->[1])
; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
} # if date arg exists
if (exists $args->{"mtime_max"}) {
$_sahv_dpath = [];
# req #0
((defined($args->{"mtime_max"})) ? 1 : (($_sahv_err //= "Required but not specified"),0))
&&
# coerce rule(s): From_float::epoch, From_obj::datetime, From_obj::time_moment, From_str::iso8601 # coerce to: float(epoch)
(($args->{"mtime_max"} = (!ref($args->{"mtime_max"}) && $args->{"mtime_max"} =~ /\A[0-9]{8,10}(?:.[0-9]+)?\z/ && $args->{"mtime_max"} >= 10**8 && $args->{"mtime_max"} <= 2**31) ? [undef,$args->{"mtime_max"}] : ((Scalar::Util::blessed($arg...
&&
# check type 'date'
((!ref($args->{"mtime_max"}) && $args->{"mtime_max"} =~ /\A[0-9]+\z/) ? 1 : (($_sahv_err //= "Not of type date"),0))
; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
} # if date arg exists
if (exists $args->{"mtime_min"}) {
$_sahv_dpath = [];
# req #0
((defined($args->{"mtime_min"})) ? 1 : (($_sahv_err //= "Required but not specified"),0))
&&
# coerce rule(s): From_float::epoch, From_obj::datetime, From_obj::time_moment, From_str::iso8601 # coerce to: float(epoch)
(($args->{"mtime_min"} = (!ref($args->{"mtime_min"}) && $args->{"mtime_min"} =~ /\A[0-9]{8,10}(?:.[0-9]+)?\z/ && $args->{"mtime_min"} >= 10**8 && $args->{"mtime_min"} <= 2**31) ? [undef,$args->{"mtime_min"}] : ((Scalar::Util::blessed($arg...
&&
# check type 'date'
((!ref($args->{"mtime_min"}) && $args->{"mtime_min"} =~ /\A[0-9]+\z/) ? 1 : (($_sahv_err //= "Not of type date"),0))
; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
} # if date arg exists
if (exists $args->{"password"}) {
$_sahv_dpath = [];
# req #0
((defined($args->{"password"})) ? 1 : (($_sahv_err //= "Required but not specified"),0))
&&
# check type 'str'
((!ref($args->{"password"})) ? 1 : (($_sahv_err //= "Not of type text"),0))
; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
} # if date arg exists
$args->{"retries"} //= 5;
if (exists $args->{"retries"}) {
$_sahv_dpath = [];
# req #0
((defined($args->{"retries"})) ? 1 : (($_sahv_err //= "Required but not specified"),0))
&&
# check type 'int'
((Scalar::Util::Numeric::PP::isint($args->{"retries"})) ? 1 : (($_sahv_err //= "Not of type integer"),0))
; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
} # if date arg exists
if (exists $args->{"size_max"}) {
$_sahv_dpath = [];
# req #1
((defined($args->{"size_max"})) ? 1 : (($_sahv_err //= "Required but not specified"),0))
&&
# check type 'int'
((Scalar::Util::Numeric::PP::isint($args->{"size_max"})) ? 1 : (($_sahv_err //= "Not of type integer"),0))
&&
(# clause: min
(($args->{"size_max"} >= 0) ? 1 : (($_sahv_err //= "Must be at least 0"),0)))
; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
} # if date arg exists
if (exists $args->{"size_min"}) {
$_sahv_dpath = [];
# req #1
((defined($args->{"size_min"})) ? 1 : (($_sahv_err //= "Required but not specified"),0))
&&
# check type 'int'
((Scalar::Util::Numeric::PP::isint($args->{"size_min"})) ? 1 : (($_sahv_err //= "Not of type integer"),0))
&&
(# clause: min
(($args->{"size_min"} >= 0) ? 1 : (($_sahv_err //= "Must be at least 0"),0)))
script/pause view on Meta::CPAN
&&
# check type 'int'
((Scalar::Util::Numeric::PP::isint($args->{"retries"})) ? 1 : (($_sahv_err //= "Not of type integer"),0))
; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
} # if date arg exists
if (exists $args->{"username"}) {
$_sahv_dpath = [];
# req #0
((defined($args->{"username"})) ? 1 : (($_sahv_err //= "Required but not specified"),0))
&&
# check type 'str'
((!ref($args->{"username"})) ? 1 : (($_sahv_err //= "Not of type text"),0))
&&
(# clause: match
(($args->{"username"} =~ qr((?:(?-)\A\w{2,9}\z))) ? 1 : (($_sahv_err //= "Must match regex pattern \\A\\w{2,9}\\z"),0)))
&&
(# clause: max_len
((length($args->{"username"}) <= 9) ? 1 : (($_sahv_err //= "Length must be at most 9"),0)))
; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
} # if date arg exists
# check required args
return [400, "Missing required argument: files"] unless exists $args->{"files"};
return [400, "Missing required value for argument: files"] if exists($args->{"files"}) && !defined($args->{"files"});
return [400, "Missing required value for argument: password"] if exists($args->{"password"}) && !defined($args->{"password"});
return [400, "Missing required value for argument: retries"] if exists($args->{"retries"}) && !defined($args->{"retries"});
return [400, "Missing required value for argument: username"] if exists($args->{"username"}) && !defined($args->{"username"});
_pci_err([500, "Extraneous command-line argument(s): ".join(", ", @check_argv)]) if @check_argv;
[200];
} elsif ($sc_name eq "upload") {
FILL_FROM_POS: {
1;
if (@ARGV > 0) { if (exists $args->{"files"}) { return [400, "You specified --file but also argument #0"]; } else { $args->{"files"} = [splice(@ARGV, 0)]; } }
}
my @check_argv = @ARGV;
# fill from cmdline_src
# fill defaults from "default" property and check against schema
no warnings ('void');
require Time::Duration::Parse::AsHash;
require Scalar::Util;
require List::Util;
require Scalar::Util::Numeric::PP;
my $_sahv_dpath;
my $_sahv_err;
if (exists $args->{"delay"}) {
$_sahv_dpath = [];
# req #0
((defined($args->{"delay"})) ? 1 : (($_sahv_err //= "Required but not specified"),0))
&&
# coerce rule(s): From_str::hms, From_float::seconds, From_obj::datetime_duration, From_str::iso8601, From_str::human # coerce to: float(secs)
(($args->{"delay"} = ($args->{"delay"} =~ /\A([0-9]{1,2}):([0-9]{1,2})(?::([0-9]{1,2})(\.[0-9]{1,9})?)?\z/) ? (do { if ($1 > 23) { ["Invalid hour '$1', must be between 0-23"] } elsif ($2 > 59) { ["Invalid minute '$2', must be between 0-59...
&&
# check type 'duration'
((!ref($args->{"delay"}) && $args->{"delay"} =~ /\A[0-9]+(?:\.[0-9]+)?\z/) ? 1 : (($_sahv_err //= "Not of type duration"),0))
; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
} # if date arg exists
if (exists $args->{"files"}) {
$_sahv_dpath = [];
# req #0
((defined($args->{"files"})) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Required but not specified"),0))
&&
# check type 'array'
((ref($args->{"files"}) eq 'ARRAY') ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Not of type array"),0))
&&
(# clause: min_len
((@{$args->{"files"}} >= 1) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Length must be at least 1"),0)))
&&
([push(@{$_sahv_dpath}, undef), scalar(# clause: of
((!defined(List::Util::first(sub {!(
($_sahv_dpath->[-1] = $_),
# req #0
((defined($args->{"files"}->[$_])) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Required but not specified"),0))
&&
# check type 'str'
((!ref($args->{"files"}->[$_])) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Not of type text"),0))
)}, 0..@{$args->{"files"}}-1))) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Not of type text"),0))), pop(@{$_sahv_dpath})]->[1])
; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
} # if date arg exists
if (exists $args->{"password"}) {
$_sahv_dpath = [];
# req #0
((defined($args->{"password"})) ? 1 : (($_sahv_err //= "Required but not specified"),0))
&&
# check type 'str'
((!ref($args->{"password"})) ? 1 : (($_sahv_err //= "Not of type text"),0))
; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
} # if date arg exists
$args->{"retries"} //= 5;
if (exists $args->{"retries"}) {
$_sahv_dpath = [];
# req #0
((defined($args->{"retries"})) ? 1 : (($_sahv_err //= "Required but not specified"),0))
&&
# check type 'int'
((Scalar::Util::Numeric::PP::isint($args->{"retries"})) ? 1 : (($_sahv_err //= "Not of type integer"),0))
; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
} # if date arg exists
( run in 0.484 second using v1.01-cache-2.11-cpan-39bf76dae61 )