PM/Password.pm

43 lines
644 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
sub new {
my $class = shift;
# Get home dir
$home = $ENV{HOME};
my $self = {
_home => $home,
};
bless $self, $class;
return $self;
}
sub create_base {
my $self = shift;
my $home = $self->{_home};
my $pm_dir = $home."/.PM/";
# Check dir
if !(-d $pm_dir) {
# Create dirrectory
@cmd_string = ("mkdir", "$pm_dir");
system(@cmd_string) == 0 or die "Cannot create dir $pm_dir: $!\n";
# Create database. TODO: write this
my $dbi = DBI->connect("DBD::sqlite");
}
else {
print "dirrectory is exist!\n";
return 0;
}
}
2014-04-27 23:11:52 +04:00
1;