Common.pm
branchfoerste-hhsp
changeset 75 63b7c7fcd0cb
parent 64 6a6c18cddf46
--- a/Common.pm	Tue Apr 14 14:47:51 2015 +0200
+++ b/Common.pm	Fri Feb 24 14:31:58 2017 +0100
@@ -91,4 +91,21 @@
 
 );
 
+{
+    my @pw;
+
+    sub mkpw($) {
+        my $in = $_[0];
+
+        return $in unless $in and $in eq "{pwgen}";
+
+        if ( !@pw ) {
+            chomp( @pw = `pwgen -nc 12 1 2>/dev/null` );
+            die "pwgen: $!" if $?;
+        }
+        return shift @pw;
+
+    }
+}
+
 1;