From ea307156d8a3950acc13646cf72637b9119e746b Mon Sep 17 00:00:00 2001 From: Difrex Date: Mon, 5 May 2014 23:51:31 +0400 Subject: [PATCH] Done. Not all. Not tested. --- pm.pl | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pm.pl b/pm.pl index 7b04a1c..4c202d8 100755 --- a/pm.pl +++ b/pm.pl @@ -7,7 +7,7 @@ use ClipPass; # Debug use Data::Dumper; -our $VERSION = '0.0.1b'; +our $VERSION = '0.0.1c'; sub usage() { print STDERR << "EOF"; @@ -95,6 +95,14 @@ elsif ( defined($opt_w) { # Generate password and store it into DB print "$opt_w, $opt_n, $opt_l, $opt_p\n"; + + my $store_h = { + name => $opt_n, + resource => $opt_l, + gen => 1, + }; + + $pass->save($store_h) == 0 or die "Oops! 105: pm.pl. $!\n"; } elsif ( defined($opt_w) and defined($opt_n) @@ -103,6 +111,15 @@ elsif ( defined($opt_w) { # Store new password into DB print "$opt_w, $opt_n, $opt_l, $opt_p\n"; + + my $store_h = { + name => $opt_n, + resource => $opt_l, + password => $opt_p, + gen => 0, + }; + + $pass->save($store_h) == 0 or die "Oops! 122: pm.pl. $!\n"; } else { print "FAIL\n" and usage;