| 1 | package Lemonldap::NG::Handler::Main::Jail; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 29 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 29 | ▶ | use Safe; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 29 | ▶ | 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 | 29 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=4 SCAR=15.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 29 | require Mouse; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 29 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 29 | ▶ | my $v = $Mouse::VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | ? sprintf( "%d.%03d%03d", ( $Mouse::VERSION =~ /(\d+)/g ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 29 | ▶ | 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 | 29 | Mouse->import(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 29 | has customFunctions => ( is => 'rw', isa => 'Maybe[Str]' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 29 | has useSafeJail => ( is => 'rw', isa => 'Maybe[Int]' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 29 | has multiValuesSeparator => ( is => 'rw', isa => 'Maybe[Str]' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 29 | has jail => ( is => 'rw' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 29 | has error => ( is => 'rw' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 29 | our $VERSION = '2.23.0'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 29 | 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 | 56 | ▶ | sub build_jail { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_jail: called CC=18 SCAR=41.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 56 | my ( $self, $api, $require, $dontDie ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 56 | my $build = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 56 | ▶ | 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 | 56 | ▶ | $self->useSafeJail(1) unless defined $self->useSafeJail; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 56 | ▶ | 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 | 56 | ▶ | if ($build) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 56 | ▶ | @builtCustomFunctions = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | $self->customFunctions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | ? split( /[,\s]+/, $self->customFunctions ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 56 | foreach (@builtCustomFunctions) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 29 | ▶ | 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 | 56 | ▶ | if ( $self->useSafeJail ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 54 | $self->jail( Safe->new ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 2 | $self->jail($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | # Share objects with Safe jail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 56 | $self->jail->share_from( 'Lemonldap::NG::Common::Safelib', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | $Lemonldap::NG::Common::Safelib::functions ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # Closure for listMatch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 29 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 9 | ▶ | *listMatch = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 9 | return Lemonldap::NG::Common::Safelib::listMatch( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | $self->multiValuesSeparator, @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 56 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | $self->jail->share_from( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 56 | __PACKAGE__, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | @builtCustomFunctions, '&encrypt', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | '&decrypt', '&token', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | '&listMatch' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 56 | $self->jail->share_from( 'MIME::Base64', ['&encode_base64'] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | #$self->jail->share_from( 'Lemonldap::NG::Handler::Main', ['$_v'] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | # Initialize cryptographic functions to be able to use them in jail. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 56 | eval { token('a') }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 56 | return $self->jail; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | # Import crypto methods for jail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 56 | ▶ | sub encrypt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
encrypt: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 56 | return &Lemonldap::NG::Handler::Main::tsv->{cipher}->encrypt( $_[0], 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | sub decrypt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decrypt: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | return &Lemonldap::NG::Handler::Main::tsv->{cipher}->decrypt( $_[0] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 56 | ▶ | sub token { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
token: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 56 | ▶ | return $_[0] ? encrypt( join( ':', time, @_ ) ) : encrypt(time); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | ## @method reval | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | # Fake reval method if useSafeJail is off | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 24 | ▶ | sub reval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reval: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 24 | my ( $self, $e ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 24 | return eval $e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | ## @method wrap_code_ref | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | # Fake wrap_code_ref method if useSafeJail is off | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | sub wrap_code_ref { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
wrap_code_ref: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | my ( $self, $e ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | return $e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | ## @method share | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | # Fake share method if useSafeJail is off | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | sub share { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
share: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | my ( $self, @vars ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | $self->share_from( scalar(caller), \@vars ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | ## @method share_from | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | # Fake share_from method if useSafeJail is off | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 6 | ▶ | sub share_from { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
share_from: called CC=10 SCAR=32.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 6 | my ( $self, $pkg, $vars ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 29 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 6 | foreach my $arg (@$vars) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 42 | my ( $var, $type ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 42 | ▶ | $type = $1 if ( $var = $arg ) =~ s/^(\W)//; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 42 | for ( 1 .. 2 ) { # assign twice to avoid any 'used once' warnings | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 84 | *{$var} = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | ( !$type ) ? \&{ $pkg . "::$var" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 84 | ▶ | : ( $type eq '&' ) ? \&{ $pkg . "::$var" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | : ( $type eq '$' ) ? \${ $pkg . "::$var" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | : ( $type eq '@' ) ? \@{ $pkg . "::$var" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | : ( $type eq '%' ) ? \%{ $pkg . "::$var" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | : ( $type eq '*' ) ? *{ $pkg . "::$var" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | ## @imethod protected jail_reval() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | # Build and return restricted eval command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | # @return evaluation of $reval or $reval2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 596 | ▶ | sub jail_reval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
jail_reval: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 596 | my ( $self, $reval ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | # If nothing is returned by reval, add the return statement to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | # the "no safe wrap" reval | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 596 | my $res = $self->jail->reval($reval); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 596 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 2 | $self->error($@); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 2 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 594 | return $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 29 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||