Lemonldap/Config/Parameters version 0.01
========================================
SYNOPSIS
#!/usr/bin/perl
use strict;
use Lemonldap::Config::Parameters;
use Data::Dumper;
my $nconfig= Lemonldap::Config::Parameters->new(
file =>'applications.xml',
cache => 'CONF' );
my $conf= $nconfig->getAllConfig;
my $cg=$nconfig->getDomain('appli.cp');
my $ligne= $cg;
print Dumper( $ligne);
my $e = $cg->{templates_options} ;
my $opt= "templates_dir";
my $va = $cg->{$opt};
my $ligne= $nconfig->formateLineHash($e,$opt,$va) ;
or by API :
Lemonldap::Config::Parameters::f_delete('CONF');
or by command line
perl -e "use Lemonldap::Config::Parameters;Lemonldap::Config::Parameters::f_delete('CONF');"
DESCRIPTION
Lemonldap is a SSO system under GPL.
Login page , handlers must retrieve their configs in an unique file eg :"applications.xml"
This file has a XML structrure . The parsing phase may be heavy . So lemonldap can cache the result of parsing in memory with IPC.
For activing the cache you must have in the config :
with : name='CONF' it's the GLUE value : four letters (see IPC::Shareable documentation) .
ttl: time to live in second ( 0 for not reload )
if ttl is too short the config file will be reload very offen .
You can force the reload by command line
perl -e "use Lemonldap::Config::Parameters;Parameters::f_delete('CONF');"
or perl -e "use Lemonldap::Config::Parameters;Parameters::f_reload('CONF');"
WITHOUT CACHE SPECIFICATION , LEMONLDAP DOESN'T USE CACHE ! It will read and parse config file each time.
METHODS
new (file =>'/foo/my_xml_file.xml' ,
cache => 'CONF' ); # with IPC cache
or
new(file =>'/foo/my_xml_file.xml'); # without IPC cache
getAllConfig
Return the reference of hash storing whole the config.
getDomain('foo.bar')
Return the reference of hash of config for domain
If the config file has only one domain , domain may bo omit .
eg :
for the xml config file :
my $cg = $nconfig->getDomain();
DB<2> x $cg
0 HASH(0x89b108c)
'DnManager' => 'cn=Directory Manager'
'branch_people' => 'ou=mefi,dc=foo,dc=bar'
'cookie' => '.foo.bar'
'ldap_port' => 389
'ldap_server' => 'cpldap.foo.bar'
'login' => 'http://cportail.foo.bar/portail/accueil.pl'
'menu' => 'http://cportail.foo.bar/portail/application.pl'
'passwordManager' => 'secret'
'path' => '/'
'session' => 'memcached'
'templates_dir' => '/opt/apache/portail/templates'
'templates_options' => 'ABSOLUTE => \'1\', INCLUDE_PATH => \'templates_dir\'
ref_of_hash : formateLineHash(string:line);
or formateLineHash(string:line,string:motif,string:key);
Return a anonyme reference on hash and may replace the motif in the value of key by the value of another key :
eg
my $e = $cg->{templates_options} ;
my $opt= "templates_dir";
my $va = $cg->{$opt};
my $ligne= $nconfig->formateLineHash($e,$opt,$va) ;
gives :
DB<1> x $ligne
0 HASH(0x848b778)
'ABSOLUTE' => 1
'INCLUDE_PATH' => '/opt/apache/portail/templates'
$ligne can be use directly like option for somes instructions
ref_of_array : formateLineArray(string:line);
or formateLineArray(string:line,string:motif,string:key);
Return a anonyme reference on array and may replace the motif in the element by the value of another key :
the return value can be use directly like option for somes instructions
findParagraph(chapter[,section])
Find and return a reference of chapter finds in xml file , a section can be specified.
Functions
Lemonldap::Config::Parameters::f_delete('CONF');
Delete the cache and the restore segment
Lemonldap::Config::Parameters::f_reload('CONF');
The next acces on cache will need to read file before .
Lemonldap::Config::Parameters::f_dump('CONF');
Dump of the config
SEE ALSO
Lemonldap(3), Lemonldap::Handler::Intrusion(3)
http://lemonldap.sourceforge.net/
"Writing Apache Modules with Perl and C" by Lincoln Stein E Doug
MacEachern - O'REILLY
See the examples directory
AUTHORS
Eric German, Egermanlinux@yahoo.frE
Xavier Guimard, Ex.guimard@free.frE
INSTALLATION
To install this module type the following:
perl Makefile.PL
make
make test
make install
DEPENDENCIES
Data::Dumper
XML::Simple
IPC::Shareable
COPYRIGHT AND LICENSE
Copyright (C) 2004 by Eric German E Xavier Guimard
Lemonldap originaly written by Eric german who decided to publish him in 2003
under the terms of the GNU General Public License version 2.
This package is under the GNU General Public License, Version 2.
The primary copyright holder is Eric German.
Portions are copyrighted under the same license as Perl itself.
Portions are copyrighted by Doug MacEachern and Lincoln Stein.
This library is under the GNU General Public License, Version 2.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 dated June, 1991.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
A copy of the GNU General Public License is available in the source tree;
if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.