[pve-devel] [PATCH pve-client 3/6] add PVE::Tools::extract_param helper
Dietmar Maurer
dietmar at proxmox.com
Tue Jun 5 12:17:41 CEST 2018
Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
PVE/Tools.pm | 10 ++++++++++
1 file changed, 10 insertions(+)
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;
--
2.11.0
More information about the pve-devel
mailing list