diff options
author | Angelo Naselli <anaselli@linux.it> | 2014-09-04 23:05:48 +0200 |
---|---|---|
committer | Angelo Naselli <anaselli@linux.it> | 2014-09-04 23:05:48 +0200 |
commit | 791f736950dd63ff239e7fd743f4675ccb9c865f (patch) | |
tree | 6b1f9ed4878fc91008d0d2d2274cbc4ed7ce11ea | |
parent | bbb1d76c94e634bedc3a2243a32448ba5b961b81 (diff) | |
download | colin-keep-791f736950dd63ff239e7fd743f4675ccb9c865f.tar colin-keep-791f736950dd63ff239e7fd743f4675ccb9c865f.tar.gz colin-keep-791f736950dd63ff239e7fd743f4675ccb9c865f.tar.bz2 colin-keep-791f736950dd63ff239e7fd743f4675ccb9c865f.tar.xz colin-keep-791f736950dd63ff239e7fd743f4675ccb9c865f.zip |
Cleaned constructor code
-rw-r--r-- | lib/AdminPanel/Category.pm | 10 | ||||
-rw-r--r-- | lib/AdminPanel/ConfigReader.pm | 12 | ||||
-rw-r--r-- | lib/AdminPanel/MainDisplay.pm | 41 | ||||
-rw-r--r-- | lib/AdminPanel/SettingsReader.pm | 3 |
4 files changed, 32 insertions, 34 deletions
diff --git a/lib/AdminPanel/Category.pm b/lib/AdminPanel/Category.pm index 825e6cd..63c23b1 100644 --- a/lib/AdminPanel/Category.pm +++ b/lib/AdminPanel/Category.pm @@ -51,10 +51,10 @@ use yui; sub new { my ($class, $newName, $newIcon) = @_; my $self = { - my $name = 0, - my $button = 0, - my $icon = 0, - my $modules = 0 + name => 0, + button => 0, + icon => 0, + modules => [], }; bless $self, 'AdminPanel::Category'; @@ -128,7 +128,7 @@ sub moduleLoaded { my $present = 0; - if (!$module_name) { + if (!$module_name || ! $self->{modules}) { return $present; } diff --git a/lib/AdminPanel/ConfigReader.pm b/lib/AdminPanel/ConfigReader.pm index 718a381..1c905c9 100644 --- a/lib/AdminPanel/ConfigReader.pm +++ b/lib/AdminPanel/ConfigReader.pm @@ -30,12 +30,12 @@ sub new { my ($class, $fileName) = @_; my $self = { - my $data = 0, - my $catLen = 0, - my $currCat = 0, - my $modLen = 0, - my $currMod = 0, - my $placeHolder = 0 + data => 0, + catLen => 0, + currCat => 0, + modLen => 0, + currMod => 0, + placeHolder => 0, }; bless $self, 'AdminPanel::ConfigReader'; diff --git a/lib/AdminPanel/MainDisplay.pm b/lib/AdminPanel/MainDisplay.pm index 118fc78..72dd9b6 100644 --- a/lib/AdminPanel/MainDisplay.pm +++ b/lib/AdminPanel/MainDisplay.pm @@ -114,27 +114,26 @@ the startup GUI. sub new { my $self = { - my $categories = 0, - my $event = 0, - my $factory = 0, - my $mainWin = 0, - my $mainLayout = 0, - my $menuLayout = 0, - my $menus = { - my $file = 0, - my $help = 0 + categories => 0, + event => 0, + factory => 0, + mainWin => 0, + mainLayout => 0, + menuLayout => 0, + menus => { + file => 0, + help => 0 }, - my $layout = 0, - my $leftPane = 0, - my $rightPane = 0, - my $currCategory = 0, - my $confDir = 0, - my $title = 0, - my $settings = 0, - my $exitButton = 0, - my $loc = 0, - my $justToGetRidOfERROR = 0, - my $replacePoint = 0 + layout => 0, + leftPane => 0, + rightPane => 0, + currCategory => 0, + confDir => 0, + title => 0, + settings => 0, + exitButton => 0, + loc => 0, + replacePoint => 0, }; bless $self, 'AdminPanel::MainDisplay'; @@ -570,6 +569,7 @@ sub _loadCategories { $tmp = $inFile->getNextMod(); my $tmpMod; my $loaded = 0; + if (exists $tmp->{title}) { if (not $currCategory->moduleLoaded($tmp->{title})) { $tmpMod = AdminPanel::Module->create(name => $tmp->{title}, @@ -588,7 +588,6 @@ sub _loadCategories { undef $tmpMod if !$loaded; } $hasNextMod = $inFile->hasNextMod(); - } } } diff --git a/lib/AdminPanel/SettingsReader.pm b/lib/AdminPanel/SettingsReader.pm index 33099bd..ebd7a0e 100644 --- a/lib/AdminPanel/SettingsReader.pm +++ b/lib/AdminPanel/SettingsReader.pm @@ -85,8 +85,7 @@ sub new { my ($class, $fileName) = @_; my $self = { - my $settings = 0, - my $justToGetRidOfERROR = 0 + settings => 0, }; bless $self, 'AdminPanel::SettingsReader'; |