From 11533544ca01c2c54899af0a00f2c062c1831433 Mon Sep 17 00:00:00 2001 From: Angelo Naselli Date: Mon, 6 Jan 2014 00:59:45 +0100 Subject: - Added a Base class for modules. - Now configuration can be read also int /etc/categories.conf.d/ so that external modules can add their own configuration to be launched and added to admin panel - perl modules can be run by extending Module class, creating a start() method and configuring module entry in categories configuration as class element - Admin User now extends Module --- ConfigReader.pm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ConfigReader.pm') diff --git a/ConfigReader.pm b/ConfigReader.pm index 379d144..d5ec8b1 100644 --- a/ConfigReader.pm +++ b/ConfigReader.pm @@ -41,6 +41,13 @@ sub new { my $xml = new XML::Simple (KeyAttr=>[]); $self->{data} = $xml->XMLin($fileName); + if (ref($self->{data}->{category}) eq "HASH") { + # one element alone + my @categories; + push @categories, $self->{data}->{category}; + $self->{data}->{category} = undef; + push @{$self->{data}->{category}}, @categories; + } $self->{catLen} = scalar(@{$self->{data}->{category}}); $self->{currCat} = -1; -- cgit v1.2.1