From 8cffad05c11af59975137aa6dc2981ccc510f48d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 4 Jul 2011 12:49:38 +0200 Subject: Raps2.pm: new: Add master_password option --- Changelog | 1 + lib/App/Raps2.pm | 26 +++++++++++++++----------- 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 { -- cgit v1.2.3