« blib/lib/Lemonldap/NG/Portal/Plugins/OIDC/AuthPkce.pm
↑ Summary
blib/lib/Lemonldap/NG/Portal/Plugins/ForceAuthn.pm »
| 1 | package Lemonldap::NG::Portal::Lib::CustomModule; | ||||||||||
| 2 | |||||||||||
| 3 | # Fake 'new' method here | ||||||||||
| 4 | 176 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=6 SCAR=18.6
Pod
undocumented
| |||||||||||
| 5 | 176 | my ( $class, $self ) = @_; | |||||||||
| 6 | |||||||||||
| 7 | 176 | my $configKey = $class->custom_config_key; | |||||||||
| 8 | 176 | my $name = $class->custom_name; | |||||||||
| 9 | |||||||||||
| 10 | 176 | my $module = $self->{conf}->{$configKey}; | |||||||||
| 11 | 176 | ▶ | unless ($module) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 12 | 0 | die "Custom $name module not defined"; | |||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | 176 | ▶ | $module = "Lemonldap::NG::Portal$module" if ( $module =~ /^::/ ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | |||||||||||
| 17 | 176 | ▶ | unless ( $module->can('new') ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 7 | eval "require $module"; | |||||||||
| 19 | 7 | ▶ | if ($@) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | 0 | die "Custom $name module failed to compile: $@"; | |||||||||
| 21 | } | ||||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 176 | my $obj = eval { $module->new($self); }; | |||||||||
| 25 | 176 | ▶ | if ($@) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 0 | die "Custom $name module failed to create instance: $@"; | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 176 | $self->{p}->logger->debug("Custom $name module loaded"); | |||||||||
| 30 | 176 | return $obj; | |||||||||
| 31 | } | ||||||||||
| 32 | 3 | 1; | |||||||||