summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-07-04 12:49:38 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-07-04 12:49:38 +0200
commit8cffad05c11af59975137aa6dc2981ccc510f48d (patch)
treef9866225e34b1be5fde4a842495a28f6879badf2
parentdc9f255ebfe2aa022264f4c2a53f80a98f392122 (diff)
Raps2.pm: new: Add master_password option
-rw-r--r--Changelog1
-rw-r--r--lib/App/Raps2.pm26
2 files changed, 16 insertions, 11 deletions
diff --git a/Changelog b/Changelog
index 10fba16..c70d749 100644
--- a/Changelog
+++ b/Changelog
@@ -9,6 +9,7 @@ git HEAD
* Allow password to be passed as argument to get_master_password
* Add pw_load_info method
* The 'salt' argument to pw_add is now optional
+ * Add the 'master_password' option to the 'new' method
App::Raps2 0.4 - Sun Jul 03 2011
diff --git a/lib/App/Raps2.pm b/lib/App/Raps2.pm
index 8971dd0..96698d8 100644
--- a/lib/App/Raps2.pm
+++ b/lib/App/Raps2.pm
@@ -14,24 +14,28 @@ use File::Slurp qw(slurp write_file);
our $VERSION = '0.4';
sub new {
- my ( $obj, %conf ) = @_;
- my $ref = {};
+ my ( $class, %opt ) = @_;
+ my $self = {};
- $ref->{xdg_conf} = config_home('raps2');
- $ref->{xdg_data} = data_home('raps2');
+ $self->{xdg_opt} = config_home('raps2');
+ $self->{xdg_data} = data_home('raps2');
- $ref->{ui} = App::Raps2::UI->new();
+ $self->{ui} = App::Raps2::UI->new();
- $ref->{default} = \%conf;
+ $self->{default} = \%opt;
- bless( $ref, $obj );
+ bless( $self, $class );
- if ( not $conf{dont_touch_fs} ) {
- $ref->sanity_check();
- $ref->load_config();
+ if ( not $opt{dont_touch_fs} ) {
+ $self->sanity_check();
+ $self->load_optig();
}
- return $ref;
+ if ( $opt{master_password} ) {
+ $self->get_master_password( $opt{master_password} );
+ }
+
+ return $self;
}
sub file_to_hash {