| 1 | package Lemonldap::NG::Handler::Main::Jail; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 26 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 26 | ▶ | use Safe; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 26 | ▶ | use Lemonldap::NG::Common::Safelib; #link protected safe Safe object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # Workaround for another ModPerl/Mouse issue... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 26 | ▶ | require Mouse; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=4 SCAR=15.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 26 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 26 | ▶ | my $v = $Mouse::VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | ? sprintf( "%d.%03d%03d", ( $Mouse::VERSION =~ /(\d+)/g ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 26 | ▶ | if ( $v < 2.005001 and $Lemonldap::NG::Handler::Apache2::Main::VERSION ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$v < "2.005001" and $Lemonldap::NG::Handler::Apache2::Main::VERSION
MC/DC0%0/2
$v < "2.005001" and $Lemonldap::NG::Handler::Apache2::Main::VERSION
$v < "2.005001"
$Lemonldap::NG::Handler::Apache2::Main::VERSION
Truth table33%1/3
A and B
A= $v < "2.005001"B= $Lemonldap::NG::Handler::Apache2::Main::VERSION
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | require Moose; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | Moose->import(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 26 | Mouse->import(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 26 | has customFunctions => ( is => 'rw', isa => 'Maybe[Str]' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 26 | has useSafeJail => ( is => 'rw', isa => 'Maybe[Int]' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 26 | has multiValuesSeparator => ( is => 'rw', isa => 'Maybe[Str]' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 26 | has jail => ( is => 'rw' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 26 | has error => ( is => 'rw' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 26 | our $VERSION = '2.18.0'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 26 | our @builtCustomFunctions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | ## @imethod protected build_jail() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # Build and return the security jail used to compile rules and headers. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # @return Safe object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | sub build_jail { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 52 | ▶ | my ( $self, $api, $require, $dontDie ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_jail: called CC=18 SCAR=41.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 52 | my $build = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 52 | ▶ | return $self->jail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$self->jail and $self->jail->useSafeJail and $self->useSafeJail and $self->jail->useSafeJail == $self->useSafeJail
$self->jail and $self->jail->useSafeJail and $self->useSafeJail
$self->jail and $self->jail->useSafeJail
MC/DC0%0/4
$self->jail and $self->jail->useSafeJail and $self->useSafeJail and $self->jail->useSafeJail == $self->useSafeJail
$self->jail
$self->jail->useSafeJail
$self->useSafeJail
$self->jail->useSafeJail == $self->useSafeJail
Truth table20%1/5
A and B and C and D
A= $self->jailB= $self->jail->useSafeJailC= $self->useSafeJailD= $self->jail->useSafeJail == $self->useSafeJail
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | if ( $self->jail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | and $self->jail->useSafeJail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | and $self->useSafeJail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | and $self->jail->useSafeJail == $self->useSafeJail ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 52 | ▶ | $self->useSafeJail(1) unless defined $self->useSafeJail; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 52 | ▶ | if ($require) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | foreach my $f ( split /[,\s]+/, $require ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | if ( $f =~ /^[\w\:]+$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | eval "require $f"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | eval { require $f; }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | $dontDie | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | ? $api->logger->error($@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | : die "Unable to load '$f': $@"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | undef $build; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 52 | ▶ | if ($build) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 52 | ▶ | @builtCustomFunctions = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | $self->customFunctions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | ? split( /[,\s]+/, $self->customFunctions ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 52 | foreach (@builtCustomFunctions) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 26 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | $api->logger->debug("Custom function: $_"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | my $sub = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | unless (/::/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | $sub = "$self\::$_"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | s/^.*:://; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | next if ( $self->can($_) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | eval "sub $_ { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | return $sub(\@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | }"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | $api->logger->error($@) if ($@); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | $_ = "&$_"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 52 | ▶ | if ( $self->useSafeJail ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 50 | $self->jail( Safe->new ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 2 | $self->jail($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | # Share objects with Safe jail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 52 | $self->jail->share_from( 'Lemonldap::NG::Common::Safelib', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | $Lemonldap::NG::Common::Safelib::functions ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # Closure for listMatch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 26 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | *listMatch = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 6 | ▶ | return Lemonldap::NG::Common::Safelib::listMatch( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | $self->multiValuesSeparator, @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 52 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 52 | $self->jail->share_from( __PACKAGE__, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | [ @builtCustomFunctions, '&encrypt', '&decrypt', '&token', '&listMatch' ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 52 | $self->jail->share_from( 'MIME::Base64', ['&encode_base64'] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | #$self->jail->share_from( 'Lemonldap::NG::Handler::Main', ['$_v'] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | # Initialize cryptographic functions to be able to use them in jail. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 52 | eval { token('a') }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 52 | return $self->jail; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | # Import crypto methods for jail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | sub encrypt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 52 | ▶ | return &Lemonldap::NG::Handler::Main::tsv->{cipher}->encrypt( $_[0], 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
encrypt: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | sub decrypt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | return &Lemonldap::NG::Handler::Main::tsv->{cipher}->decrypt( $_[0] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decrypt: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | sub token { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 52 | ▶ | return $_[0] ? encrypt( join( ':', time, @_ ) ) : encrypt(time); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
token: called CC=2 SCAR=7.6
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | ## @method reval | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | # Fake reval method if useSafeJail is off | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | sub reval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 24 | ▶ | my ( $self, $e ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reval: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 24 | return eval $e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | ## @method wrap_code_ref | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | # Fake wrap_code_ref method if useSafeJail is off | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | sub wrap_code_ref { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | my ( $self, $e ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
wrap_code_ref: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | return $e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | ## @method share | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | # Fake share method if useSafeJail is off | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | sub share { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | my ( $self, @vars ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
share: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $self->share_from( scalar(caller), \@vars ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | ## @method share_from | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | # Fake share_from method if useSafeJail is off | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | sub share_from { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 6 | ▶ | my ( $self, $pkg, $vars ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
share_from: called CC=10 SCAR=32.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 26 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 6 | foreach my $arg (@$vars) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 42 | my ( $var, $type ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 42 | ▶ | $type = $1 if ( $var = $arg ) =~ s/^(\W)//; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 42 | for ( 1 .. 2 ) { # assign twice to avoid any 'used once' warnings | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 84 | *{$var} = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | ( !$type ) ? \&{ $pkg . "::$var" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 84 | ▶ | : ( $type eq '&' ) ? \&{ $pkg . "::$var" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | : ( $type eq '$' ) ? \${ $pkg . "::$var" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | : ( $type eq '@' ) ? \@{ $pkg . "::$var" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | : ( $type eq '%' ) ? \%{ $pkg . "::$var" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 84 | ▶ | : ( $type eq '*' ) ? *{ $pkg . "::$var" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | ## @imethod protected jail_reval() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | # Build and return restricted eval command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | # @return evaluation of $reval or $reval2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | sub jail_reval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 554 | ▶ | my ( $self, $reval ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
jail_reval: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | # If nothing is returned by reval, add the return statement to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | # the "no safe wrap" reval | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 554 | my $res = $self->jail->reval($reval); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 554 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 2 | $self->error($@); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 2 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 552 | return $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 26 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||