From: Dietmar Maurer Date: Tue, 5 Jun 2018 07:33:43 +0000 (+0200) Subject: add PVE::Tools::extract_param helper X-Git-Url: https://git.proxmox.com/?p=pve-client.git;a=commitdiff_plain;h=cff6d4f9a35be25b57b722d4fbcd434be8d696db add PVE::Tools::extract_param helper --- diff --git a/PVE/Tools.pm b/PVE/Tools.pm index 2d0b727..cd55932 100644 --- a/PVE/Tools.pm +++ b/PVE/Tools.pm @@ -14,6 +14,7 @@ $IPV4RE split_list file_set_contents file_get_contents +extract_param ); my $IPV4OCTET = "(?:25[0-5]|(?:2[0-4]|1[0-9]|[1-9])?[0-9])"; @@ -134,4 +135,13 @@ sub split_args { return $str ? [ Text::ParseWords::shellwords($str) ] : []; } +sub extract_param { + my ($param, $key) = @_; + + my $res = $param->{$key}; + delete $param->{$key}; + + return $res; +} + 1;