]> git.proxmox.com Git - pve-client.git/commitdiff
add PVE::Tools::extract_param helper
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 5 Jun 2018 07:33:43 +0000 (09:33 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 5 Jun 2018 07:33:43 +0000 (09:33 +0200)
PVE/Tools.pm

index 2d0b7276037b28a83559252d86d86e81235eb185..cd55932c8a9cffaa5e96b5bfff0744a89ddeea43 100644 (file)
@@ -14,6 +14,7 @@ $IPV4RE
 split_list
 file_set_contents
 file_get_contents
 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])";
 );
 
 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) ] : [];
 }
 
     return $str ? [ Text::ParseWords::shellwords($str) ] : [];
 }
 
+sub extract_param {
+    my ($param, $key) = @_;
+
+    my $res = $param->{$key};
+    delete $param->{$key};
+
+    return $res;
+}
+
 1;
 1;