Fix part of circular links (related to #1990)

Moo
Xavier Guimard 5 years ago
parent 91ba11b898
commit c9e7f3a1b0
  1. 2
      lemonldap-ng-common/lib/Lemonldap/NG/Common/Logger/_Duplicate.pm
  2. 15
      lemonldap-ng-common/lib/Lemonldap/NG/Common/Module.pm
  3. 2
      lemonldap-ng-common/lib/Lemonldap/NG/Common/PSGI/Router.pm
  4. 2
      lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Main/Reload.pm
  5. 21
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Init.pm

@ -1,6 +1,7 @@
package Lemonldap::NG::Common::Logger::_Duplicate;
use strict;
use Scalar::Util 'weaken';
our $VERSION = '2.0.6';
@ -11,6 +12,7 @@ sub new {
die $@ if ($@);
$self->{logger} = $args{logger}->new(@_);
$self->{dup} = $args{dup} or die 'Missing dup';
weaken($self->{dup});
return $self;
}

@ -11,9 +11,18 @@ has p => ( is => 'rw', weak_ref => 1 );
# Lemonldap::NG configuration hash ref
has conf => ( is => 'rw', weak_ref => 1 );
has logger => ( is => 'rw', lazy => 1, default => sub { $_[0]->{p}->logger } );
has userLogger =>
( is => 'rw', lazy => 1, default => sub { $_[0]->{p}->userLogger } );
has logger => (
is => 'rw',
lazy => 1,
weak_ref => 1,
default => sub { $_[0]->{p}->logger }
);
has userLogger => (
is => 'rw',
lazy => 1,
weak_ref => 1,
default => sub { $_[0]->{p}->userLogger }
);
sub error {
my $self = shift;

@ -3,6 +3,7 @@ package Lemonldap::NG::Common::PSGI::Router;
use Mouse;
use Lemonldap::NG::Common::PSGI;
use Lemonldap::NG::Common::PSGI::Constants;
use Scalar::Util 'weaken';
our $VERSION = '2.0.8';
@ -93,6 +94,7 @@ sub genRoute {
}
}
elsif ( $self->can($dest) ) {
weaken($self);
$routes->{$word} = sub { shift; $self->$dest(@_) };
}
else {

@ -19,8 +19,8 @@ our @_onReload;
sub onReload {
my ( $class, $obj, $sub ) = @_;
weaken($obj);
push @_onReload, [ $obj, $sub ];
weaken($_onReload[$#_onReload]->[0]);
}
# CONFIGURATION UPDATE

@ -15,6 +15,7 @@ package Lemonldap::NG::Portal::Main;
use strict;
use Mouse;
use Regexp::Assemble;
use Scalar::Util 'weaken';
# PROPERTIES
@ -92,13 +93,16 @@ has cors => ( is => 'rw' );
sub init {
my ( $self, $args ) = @_;
$args ||= {};
$self->localConfig( {
%{ Lemonldap::NG::Common::Conf->new( $args->{configStorage} )
->getLocalConf('portal')
},
%$args
$self->localConfig( {} );
{
my $h = Lemonldap::NG::Common::Conf->new( $args->{configStorage} )
->getLocalConf('portal');
foreach ( keys %$h ) {
$self->localConfig->{$_} = $h->{$_};
weaken( $self->localConfig->{$_} ) if ref $self->localConfig->{$_};
}
);
}
$self->localConfig->{$_} = $args->{$_} foreach ( keys %$args );
# Load override messages from lemonldap-ng.ini
foreach my $k ( keys %{ $self->localConfig } ) {
@ -179,7 +183,10 @@ sub reloadConf {
my ( $self, $conf ) = @_;
# Reinitialize $self->conf
%{ $self->{conf} } = %{ $self->localConfig };
foreach ( keys %{ $self->localConfig } ) {
$self->{conf}->{$_} = $self->localConfig->{$_};
weaken( $self->{conf}->{$_} ) if ref $self->{conf}->{$_};
}
# Reinitialize arrays
foreach ( qw(_macros _groups), @entryPoints ) {

Loading…
Cancel
Save