From 3f2a49b697a6eb5ff8db78c05c65070b46bb75a6 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 3 Apr 2011 16:54:40 +0200 Subject: Use confess instead of return undef, Test::Exception for App::Raps2::Password test --- lib/App/Raps2.pm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lib/App/Raps2.pm') diff --git a/lib/App/Raps2.pm b/lib/App/Raps2.pm index 4746e5a..8078653 100644 --- a/lib/App/Raps2.pm +++ b/lib/App/Raps2.pm @@ -12,6 +12,7 @@ use base 'Exporter'; use App::Raps2::Password; use App::Raps2::UI; +use Carp q(confess); use File::Path qw(make_path); use File::Slurp qw(slurp write_file); @@ -82,9 +83,7 @@ sub get_master_password { passphrase => $pass, ); - if (not $self->{'pass'}->verify($self->{'master_hash'})) { - return undef; - } + $self->{'pass'}->verify($self->{'master_hash'}); } sub create_config { @@ -122,7 +121,7 @@ sub cmd_add { my $ui = $self->{'ui'}; if (-e $pwfile) { - return undef; + confess('Password file already exists'); } $self->get_master_password(); @@ -157,7 +156,7 @@ sub cmd_dump { my $pwfile = $self->{'xdg_data'} . "/${name}"; if (not -e $pwfile) { - return undef; + confess('Password file does not exist'); } my %key = file_to_hash($pwfile); @@ -182,7 +181,7 @@ sub cmd_info { my $pwfile = $self->{'xdg_data'} . "/${name}"; if (not -e $pwfile) { - return undef; + confess('Password file does not exist'); } my %key = file_to_hash($pwfile); -- cgit v1.2.3