3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-04 18:38:47 +02:00

Minor refactor of HashObject initialize sub

This commit is contained in:
Pragmatic Software 2014-03-05 19:30:37 +00:00
parent 21bec3b1e4
commit 8cecad56d2
2 changed files with 4 additions and 20 deletions

View File

@ -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) = @_;

View File

@ -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",
};