aboutsummaryrefslogtreecommitdiffstats
path: root/Category.pm
diff options
context:
space:
mode:
authorMatteo Pasotti <matteo.pasotti@gmail.com>2014-01-19 01:11:21 +0100
committerMatteo Pasotti <matteo.pasotti@gmail.com>2014-01-19 01:11:21 +0100
commit97d9107d09e7112c012bd3637e30e0821b5f6885 (patch)
treea6591e00c239b8324aeab92a0169a1f8143c70ef /Category.pm
parent03509ca6ac225c921d5f15479198908eac6df605 (diff)
parent8be4c570361e4df7a3e319e9b9bd029d7520fb7b (diff)
downloadmanatools-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.pm19
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;
}