[pve-devel] r4996 - pve-common/trunk

svn-commits at proxmox.com svn-commits at proxmox.com
Fri Aug 13 10:38:03 CEST 2010


Author: dietmar
Date: 2010-08-13 08:38:03 +0000 (Fri, 13 Aug 2010)
New Revision: 4996

Modified:
   pve-common/trunk/Tools.pm
Log:
add split_list


Modified: pve-common/trunk/Tools.pm
===================================================================
--- pve-common/trunk/Tools.pm	2010-08-13 08:17:57 UTC (rev 4995)
+++ pve-common/trunk/Tools.pm	2010-08-13 08:38:03 UTC (rev 4996)
@@ -8,7 +8,13 @@
 use Fcntl qw(:DEFAULT :flock);
 use base 'Exporter';
 
-our @EXPORT_OK = qw(lock_file run_command file_set_contents file_get_contents);
+our @EXPORT_OK = qw(
+lock_file 
+run_command 
+file_set_contents 
+file_get_contents
+split_list
+);
 
 # flock: we use one file handle per process, so lock file
 # can be called multiple times and succeeds for the same process.
@@ -304,5 +310,15 @@
     }
 }
 
+sub split_list {
+    my $listtxt = shift || '';
 
+    $listtxt =~ s/[,;]/ /g;
+    $listtxt =~ s/^\s+//;
+
+    my @data = split (/\s+/, $listtxt);
+
+    return @data;
+}
+
 1;




More information about the pve-devel mailing list