Done. Not all. Not tested.

This commit is contained in:
Difrex 2014-05-05 23:51:31 +04:00
parent a7b4f7bf8e
commit ea307156d8

19
pm.pl
View File

@ -7,7 +7,7 @@ use ClipPass;
# Debug # Debug
use Data::Dumper; use Data::Dumper;
our $VERSION = '0.0.1b'; our $VERSION = '0.0.1c';
sub usage() { sub usage() {
print STDERR << "EOF"; print STDERR << "EOF";
@ -95,6 +95,14 @@ elsif ( defined($opt_w)
{ {
# Generate password and store it into DB # Generate password and store it into DB
print "$opt_w, $opt_n, $opt_l, $opt_p\n"; 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) elsif ( defined($opt_w)
and defined($opt_n) and defined($opt_n)
@ -103,6 +111,15 @@ elsif ( defined($opt_w)
{ {
# Store new password into DB # Store new password into DB
print "$opt_w, $opt_n, $opt_l, $opt_p\n"; 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 { else {
print "FAIL\n" and usage; print "FAIL\n" and usage;