mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-26 22:09:26 +01:00
Minor refactor of HashObject initialize sub
This commit is contained in:
parent
21bec3b1e4
commit
8cecad56d2
@ -30,28 +30,12 @@ sub new {
|
||||
sub initialize {
|
||||
my ($self, %conf) = @_;
|
||||
|
||||
my $name = delete $conf{name};
|
||||
if(not defined $name) {
|
||||
$name = "hash object";
|
||||
}
|
||||
|
||||
my $filename = delete $conf{filename};
|
||||
if(not defined $filename) {
|
||||
Carp::carp("Missing filename to HashObject, will not be able to save to or load from file.");
|
||||
}
|
||||
|
||||
my $pbot = delete $conf{pbot};
|
||||
if(not defined $pbot) {
|
||||
Carp::croak("Missing pbot reference to HashObject");
|
||||
}
|
||||
|
||||
$self->{name} = $name;
|
||||
$self->{filename} = $filename;
|
||||
$self->{pbot} = $pbot;
|
||||
$self->{name} = delete $conf{name} // 'hash object';
|
||||
$self->{filename} = delete $conf{filename} // Carp::carp("Missing filename to HashObject, will not be able to save to or load from file.");
|
||||
$self->{pbot} = delete $conf{pbot} // Carp::croak("Missing pbot reference to HashObject");
|
||||
$self->{hash} = {};
|
||||
}
|
||||
|
||||
|
||||
sub load_hash_add {
|
||||
my ($self, $index_key, $hash, $i, $filename) = @_;
|
||||
|
||||
|
@ -13,7 +13,7 @@ use warnings;
|
||||
# These are set automatically by the build/commit script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 507,
|
||||
BUILD_REVISION => 508,
|
||||
BUILD_DATE => "2014-03-05",
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user