diff options
author | Matteo Pasotti <matteo.pasotti@gmail.com> | 2014-01-19 01:11:21 +0100 |
---|---|---|
committer | Matteo Pasotti <matteo.pasotti@gmail.com> | 2014-01-19 01:11:21 +0100 |
commit | 97d9107d09e7112c012bd3637e30e0821b5f6885 (patch) | |
tree | a6591e00c239b8324aeab92a0169a1f8143c70ef /Category.pm | |
parent | 03509ca6ac225c921d5f15479198908eac6df605 (diff) | |
parent | 8be4c570361e4df7a3e319e9b9bd029d7520fb7b (diff) | |
download | manatools-97d9107d09e7112c012bd3637e30e0821b5f6885.tar manatools-97d9107d09e7112c012bd3637e30e0821b5f6885.tar.gz manatools-97d9107d09e7112c012bd3637e30e0821b5f6885.tar.bz2 manatools-97d9107d09e7112c012bd3637e30e0821b5f6885.tar.xz manatools-97d9107d09e7112c012bd3637e30e0821b5f6885.zip |
Merge branch 'master' of ssh://git.mageia.org/software/adminpanel
Diffstat (limited to 'Category.pm')
-rw-r--r-- | Category.pm | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Category.pm b/Category.pm index 7191fabe..b43a4c1a 100644 --- a/Category.pm +++ b/Category.pm @@ -69,7 +69,7 @@ sub new { sub loadModule { my ($self, $module) = @_; - if (!$self->moduleLoaded($module)) { + if (!$self->moduleLoaded($module->{name})) { push ( @{$self->{modules}}, $module ); return 1; @@ -83,8 +83,8 @@ sub loadModule { =head3 INPUT - $self: this object - $module: module to look for + $self: this object + $module_name or -CLASS => name : module/CLASS name to look for =head3 OUTPUT @@ -98,15 +98,22 @@ sub loadModule { #============================================================= sub moduleLoaded { - my ($self, $module) = @_; + my $self = shift; + my (%params) = @_; + my ($module_name) = @_; + my $present = 0; - if (!$module) { + if (!$module_name) { return $present; } foreach my $mod (@{$self->{modules}}) { - if ($mod->{name} eq $module->name) { + if (exists $params{-CLASS} && ref($mod) eq $params{-CLASS}) { + $present = 1; + last; + } + elsif ($mod->{name} eq $module_name) { $present = 1; last; } |