diff options
-rw-r--r-- | Changelog | 1 | ||||
-rw-r--r-- | lib/App/Raps2.pm | 26 |
2 files changed, 16 insertions, 11 deletions
@@ -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 { |