PM/Password.pm

44 lines
663 B
Perl
Raw Normal View History

2014-04-27 03:46:32 +04:00
package Password;
use strict;
use warnings;
use utf8;
2014-04-27 23:11:52 +04:00
use Database;
2014-04-27 03:46:32 +04:00
2014-04-28 12:04:17 +04:00
use PasswordSave;
use PasswordShow;
2014-04-27 03:46:32 +04:00
sub new {
2014-04-28 12:17:17 +04:00
my $class = shift;
2014-04-27 03:46:32 +04:00
2014-04-28 12:17:17 +04:00
my $db = Database->new();
2014-04-28 12:04:17 +04:00
2014-04-28 12:17:17 +04:00
my $p_save = PasswordSave->new();
my $p_show = PasswordShow->new();
2014-04-28 12:04:17 +04:00
2014-04-28 12:17:17 +04:00
my $self = {
_db => $db,
_p_save => $p_save,
_p_show => $p_show,
2014-04-27 03:46:32 +04:00
};
2014-04-28 12:17:17 +04:00
2014-04-27 03:46:32 +04:00
bless $self, $class;
return $self;
}
2014-04-28 12:04:17 +04:00
# Check configuration. If it doesn't exist create it.
sub check_config {
2014-04-28 12:17:17 +04:00
my ($self) = @_;
if ( -e $ENV->{HOME} . "/.PM/db.sqlite" ) {
return 0;
}
else {
my $db = $self->{_db};
$db->create_base();
}
return 0;
2014-04-28 12:04:17 +04:00
}
2014-04-28 12:17:17 +04:00
1;