| 1 | package cPanel::APIClient::Utils::FormArray; | ||||||||||
| 2 | |||||||||||
| 3 | # Copyright 2020 cPanel, L. L. C. | ||||||||||
| 4 | # All rights reserved. | ||||||||||
| 5 | # http://cpanel.net | ||||||||||
| 6 | # | ||||||||||
| 7 | # This is free software; you can redistribute it and/or modify it under the | ||||||||||
| 8 | # same terms as Perl itself. See L<perlartistic>. | ||||||||||
| 9 | |||||||||||
| 10 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 3 | ▶ | use URI::Escape (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 10 | ▶ | sub to_kv_equals_strings { | ||||||||
|
Subroutine
to_kv_equals_strings: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 16 | 10 | my ($args_hr) = @_; | |||||||||
| 17 | |||||||||||
| 18 | return map { | ||||||||||
| 19 | 10 | ▶ | defined( $args_hr->{$_} ) or die "undef value ($_) is invalid!"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | |||||||||||
| 21 | 10 | ▶ | if ( 'ARRAY' eq ref $args_hr->{$_} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | 2 | my $key_u = URI::Escape::uri_escape($_); | |||||||||
| 23 | 2 | map { "$key_u=" . URI::Escape::uri_escape($_) } @{ $args_hr->{$_} }; | |||||||||
| 24 | } | ||||||||||
| 25 | else { | ||||||||||
| 26 | 8 | URI::Escape::uri_escape($_) . '=' . URI::Escape::uri_escape( $args_hr->{$_} ); | |||||||||
| 27 | } | ||||||||||
| 28 | } keys %$args_hr; | ||||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 3 | 1; | |||||||||