NAME

Lemonldap::NG::Handler::SharedConf - Perl extension for adding dynamic configuration to Lemonldap::NG::Handler::Simple. To use for inheritance.

SYNOPSIS

  package My::Package;
  use Lemonldap::NG::Handler::SharedConf;
  @ISA = qw(Lemonldap::NG::Handler::SharedConf);
  
  sub getConf {
    # Write here your configuration download system
    # It has to return a hash reference containing
    # global configuration variables:
    # {
    #  locationRules => { '^/.*$' => '$ou =~ /brh/'},
    #  globalStorage        => 'Apache::Session::MySQL',
    #  globalStorageOptions => {
    #    ...
    #  }
    #  portal               => 'https://portal/',
    # }
    # See L<Lemonldap::NG::Handler::Simple> for more
  }
  
  __PACKAGE__->init ( {
    localStorage        => "Cache::DBFile",
    localStorageOptions => {},
    reloadTime          => 1200, # Default: 600
  } );

The configuration is loaded only at Apache start. Create an URI to force configuration reload, so you don't need to restart Apache at each change :

  # <apache>/conf/httpd.conf
  <Location /location/that/I/ve/choosed>
    Order deny,allow
    Deny from all
    Allow from my.manager.com
    PerlInitHandler My::Package->refresh
  </Location>

DESCRIPTION

This library splits Lemonldap::NG::Handler::Simple initialization into 2 phases: local initialization and global configuration set. It can be used if you want to write a module that can change its global configuration without restarting Apache and that use a central configuration storage (like DBI, see Lemonldap::NG::SharedConf::DBI).

OVERLOADED SUBROUTINES

init

Like Lemonldap::NG::Handler::Simple::init() but read only localStorage related options. You may change default time between two configuration checks with the reloadTime parameter (default 600s).

SUBROUTINE TO WRITE

getConf

Does nothing by default. You've to overload it to write your own configuration download system.

EXPORT

Same as Lemonldap::NG::Handler::Simple.

OPERATION

Each new Apache child checks if there's a configuration stored in the local store. If not, it calls getConf to get one and store it in the local store by calling setconf.

Every 600 seconds, each Apache child checks if the local stored configuration has changed and reload it if it has.

When refresh subroutine is called (by http for example: see synopsis), getConf is called to get the new configuration and setconf is called to store it in the local store.

SEE ALSO

Lemonldap::NG::Handler, Lemonldap::NG::Handler::SharedConf::DBI

AUTHOR

Xavier Guimard, <x.guimard@free.fr>

COPYRIGHT AND LICENSE

Copyright (C) 2005 by Xavier Guimard <x.guimard@free.fr>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 206:

=back without =over