| 1 | package Zuzu::Module::Internals; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 10 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 10 | our $VERSION = '0.007002'; | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 10 | ▶ | use Scalar::Util qw( blessed refaddr ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 10 | ▶ | use Zuzu::Error; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 10 | ▶ | use Zuzu::Util::NativeHelpers qw( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | native_function | ||||||||||||||||||||||||||||
| 12 | perl_to_zuzu | ||||||||||||||||||||||||||||
| 13 | 10 | ); | |||||||||||||||||||||||||||
| 14 | 10 | ▶ | use Zuzu::Weak qw( slot_value ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 73 | ▶ | sub IMPORT { | ||||||||||||||||||||||||||
|
Subroutine
IMPORT: called CC=1 SCAR=3.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 17 | 73 | my ( $class, $runtime ) = @_; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | my $class_name = native_function( | ||||||||||||||||||||||||||||
| 20 | name => 'class_name', | ||||||||||||||||||||||||||||
| 21 | 1 | ▶ | native => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.6
| |||||||||||||||||||||||||||||
| 22 | 1 | my ( $value ) = @_; | |||||||||||||||||||||||||||
| 23 | 1 | ▶ | return undef if not blessed($value); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | 1 | ▶ | return undef if not $value->isa('Zuzu::Value::Object'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | 1 | ▶ | return undef if not blessed( $value->class ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | 1 | return $value->class->name; | |||||||||||||||||||||||||||
| 27 | }, | ||||||||||||||||||||||||||||
| 28 | 73 | ); | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | my $classof = native_function( | ||||||||||||||||||||||||||||
| 31 | name => 'classof', | ||||||||||||||||||||||||||||
| 32 | 0 | ▶ | native => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 33 | 0 | my ( $value ) = @_; | |||||||||||||||||||||||||||
| 34 | 0 | ▶ | return undef if !defined $value; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 0 | ▶ | if ( blessed($value) and $value->isa('Zuzu::Value::Object') ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
builtin::blessed($value) and $value->isa("Zuzu::Value::Object")
MC/DC0%0/2
builtin::blessed($value) and $value->isa("Zuzu::Value::Object")
builtin::blessed($value)
$value->isa("Zuzu::Value::Object")
Truth table0%0/3
A and B
A= builtin::blessed($value)B= $value->isa("Zuzu::Value::Object")
| |||||||||||||||||||||||||||||
| 37 | 0 | ▶ | return $value->class if blessed( $value->class ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 38 | 0 | return undef; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 0 | my $type = $runtime->_type_name($value); | |||||||||||||||||||||||||||
| 42 | 0 | ▶ | return undef if $type =~ /\A(?:Null|Boolean|Number|String|Method)\z/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 0 | return $runtime->{_builtin_classes}{$type}; | |||||||||||||||||||||||||||
| 45 | }, | ||||||||||||||||||||||||||||
| 46 | 73 | ); | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | my $object_slots = native_function( | ||||||||||||||||||||||||||||
| 49 | name => 'object_slots', | ||||||||||||||||||||||||||||
| 50 | 3 | ▶ | native => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=18.7
| |||||||||||||||||||||||||||||
| 51 | 3 | my ( $value ) = @_; | |||||||||||||||||||||||||||
| 52 | 3 | ▶ | return undef if not blessed($value); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | 3 | ▶ | return undef if not $value->isa('Zuzu::Value::Object'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 3 | my %out; | |||||||||||||||||||||||||||
| 56 | 3 | ▶ | for my $key ( sort CORE::keys %{ $value->slots // {} } ) { | ||||||||||||||||||||||||||
|
Condition50%1/2
$value->slots // {}
MC/DC0%0/1
$value->slots // {}
$value->slots
Truth table50%1/2
A
A= $value->slots
| |||||||||||||||||||||||||||||
| 57 | 3 | ▶ | next if $key =~ /^_/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | 3 | $out{$key} = slot_value( \$value->slots->{$key} ); | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | 3 | return perl_to_zuzu(\%out); | |||||||||||||||||||||||||||
| 61 | }, | ||||||||||||||||||||||||||||
| 62 | 73 | ); | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | my $ansi_esc = native_function( | ||||||||||||||||||||||||||||
| 66 | name => 'ansi_esc', | ||||||||||||||||||||||||||||
| 67 | 21 | ▶ | native => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 68 | 21 | return chr 27; | |||||||||||||||||||||||||||
| 69 | }, | ||||||||||||||||||||||||||||
| 70 | 73 | ); | |||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | my $ref_id = native_function( | ||||||||||||||||||||||||||||
| 73 | name => 'ref_id', | ||||||||||||||||||||||||||||
| 74 | 120 | ▶ | native => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||
| 75 | 120 | my ( $value ) = @_; | |||||||||||||||||||||||||||
| 76 | 120 | ▶ | return undef if not defined $value; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 77 | 120 | ▶ | return undef if not ref $value; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 78 | 120 | return refaddr($value); | |||||||||||||||||||||||||||
| 79 | }, | ||||||||||||||||||||||||||||
| 80 | 73 | ); | |||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | my $to_String = native_function( | ||||||||||||||||||||||||||||
| 83 | name => 'to_String', | ||||||||||||||||||||||||||||
| 84 | 0 | ▶ | native => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 85 | 0 | my ( $value ) = @_; | |||||||||||||||||||||||||||
| 86 | 0 | ▶ | my $file = $runtime->{_native_call_file} // '<std/internals>'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$runtime->{"_native_call_file"} // "<std/internals>"
MC/DC0%0/1
$runtime->{"_native_call_file"} // "<std/internals>"
$runtime->{"_native_call_file"}
Truth table0%0/2
A
A= $runtime->{"_native_call_file"}
| |||||||||||||||||||||||||||||
| 87 | 0 | ▶ | my $line = $runtime->{_native_call_line} // 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$runtime->{"_native_call_line"} // 0
MC/DC0%0/1
$runtime->{"_native_call_line"} // 0
$runtime->{"_native_call_line"}
Truth table0%0/2
A
A= $runtime->{"_native_call_line"}
| |||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 0 | return $runtime->_to_OperatorString( $value, $file, $line ); | |||||||||||||||||||||||||||
| 90 | }, | ||||||||||||||||||||||||||||
| 91 | 73 | ); | |||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | my $to_Number = native_function( | ||||||||||||||||||||||||||||
| 94 | name => 'to_Number', | ||||||||||||||||||||||||||||
| 95 | 0 | ▶ | native => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 96 | 0 | my ( $value ) = @_; | |||||||||||||||||||||||||||
| 97 | 0 | ▶ | my $file = $runtime->{_native_call_file} // '<std/internals>'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$runtime->{"_native_call_file"} // "<std/internals>"
MC/DC0%0/1
$runtime->{"_native_call_file"} // "<std/internals>"
$runtime->{"_native_call_file"}
Truth table0%0/2
A
A= $runtime->{"_native_call_file"}
| |||||||||||||||||||||||||||||
| 98 | 0 | ▶ | my $line = $runtime->{_native_call_line} // 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$runtime->{"_native_call_line"} // 0
MC/DC0%0/1
$runtime->{"_native_call_line"} // 0
$runtime->{"_native_call_line"}
Truth table0%0/2
A
A= $runtime->{"_native_call_line"}
| |||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 0 | return $runtime->_to_Number( $value, $file, $line ); | |||||||||||||||||||||||||||
| 101 | }, | ||||||||||||||||||||||||||||
| 102 | 73 | ); | |||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | my $to_Boolean = native_function( | ||||||||||||||||||||||||||||
| 105 | name => 'to_Boolean', | ||||||||||||||||||||||||||||
| 106 | 0 | ▶ | native => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 107 | 0 | my ( $value ) = @_; | |||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 0 | ▶ | return $runtime->_to_Boolean($value) ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | }, | ||||||||||||||||||||||||||||
| 111 | 73 | ); | |||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | my $to_Regexp = native_function( | ||||||||||||||||||||||||||||
| 114 | name => 'to_Regexp', | ||||||||||||||||||||||||||||
| 115 | 0 | ▶ | native => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 116 | 0 | my ( $value ) = @_; | |||||||||||||||||||||||||||
| 117 | 0 | ▶ | my $file = $runtime->{_native_call_file} // '<std/internals>'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$runtime->{"_native_call_file"} // "<std/internals>"
MC/DC0%0/1
$runtime->{"_native_call_file"} // "<std/internals>"
$runtime->{"_native_call_file"}
Truth table0%0/2
A
A= $runtime->{"_native_call_file"}
| |||||||||||||||||||||||||||||
| 118 | 0 | ▶ | my $line = $runtime->{_native_call_line} // 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$runtime->{"_native_call_line"} // 0
MC/DC0%0/1
$runtime->{"_native_call_line"} // 0
$runtime->{"_native_call_line"}
Truth table0%0/2
A
A= $runtime->{"_native_call_line"}
| |||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 0 | return $runtime->_to_RegexpValue( $value, $file, $line ); | |||||||||||||||||||||||||||
| 121 | }, | ||||||||||||||||||||||||||||
| 122 | 73 | ); | |||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | my $to_Regexp_with_flags = native_function( | ||||||||||||||||||||||||||||
| 125 | name => 'to_Regexp_with_flags', | ||||||||||||||||||||||||||||
| 126 | 0 | ▶ | native => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 127 | 0 | my ( $value, $flags ) = @_; | |||||||||||||||||||||||||||
| 128 | 0 | ▶ | my $file = $runtime->{_native_call_file} // '<std/internals>'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$runtime->{"_native_call_file"} // "<std/internals>"
MC/DC0%0/1
$runtime->{"_native_call_file"} // "<std/internals>"
$runtime->{"_native_call_file"}
Truth table0%0/2
A
A= $runtime->{"_native_call_file"}
| |||||||||||||||||||||||||||||
| 129 | 0 | ▶ | my $line = $runtime->{_native_call_line} // 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$runtime->{"_native_call_line"} // 0
MC/DC0%0/1
$runtime->{"_native_call_line"} // 0
$runtime->{"_native_call_line"}
Truth table0%0/2
A
A= $runtime->{"_native_call_line"}
| |||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 0 | return $runtime->_to_RegexpValue_with_flags( $value, $flags, $file, $line ); | |||||||||||||||||||||||||||
| 132 | }, | ||||||||||||||||||||||||||||
| 133 | 73 | ); | |||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | my $make_instance = native_function( | ||||||||||||||||||||||||||||
| 136 | name => 'make_instance', | ||||||||||||||||||||||||||||
| 137 | 0 | ▶ | native => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 138 | 0 | my ( $klass, $slot_values ) = @_; | |||||||||||||||||||||||||||
| 139 | 0 | ▶ | die "make_instance expects a Class" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
builtin::blessed($klass) and $klass->isa("Zuzu::Value::Class")
MC/DC0%0/2
builtin::blessed($klass) and $klass->isa("Zuzu::Value::Class")
builtin::blessed($klass)
$klass->isa("Zuzu::Value::Class")
Truth table0%0/3
A and B
A= builtin::blessed($klass)B= $klass->isa("Zuzu::Value::Class")
| |||||||||||||||||||||||||||||
| 140 | if !blessed($klass) or !$klass->isa('Zuzu::Value::Class'); | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | 0 | my $slots = {}; | |||||||||||||||||||||||||||
| 143 | 0 | ▶ | if ( defined $slot_values ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | 0 | my $dict = $runtime->_unwrap_builtin_collection( | |||||||||||||||||||||||||||
| 145 | $slot_values, | ||||||||||||||||||||||||||||
| 146 | 'Dict', | ||||||||||||||||||||||||||||
| 147 | ); | ||||||||||||||||||||||||||||
| 148 | 0 | ▶ | die "make_instance slot values must be Dict" if !$dict; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | 0 | $slots = { %{ $dict->map } }; | |||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | 0 | return $runtime->_make_instance_without_build( | |||||||||||||||||||||||||||
| 153 | $klass, | ||||||||||||||||||||||||||||
| 154 | $slots, | ||||||||||||||||||||||||||||
| 155 | '<std/internals>', | ||||||||||||||||||||||||||||
| 156 | 0, | ||||||||||||||||||||||||||||
| 157 | ); | ||||||||||||||||||||||||||||
| 158 | }, | ||||||||||||||||||||||||||||
| 159 | 73 | ); | |||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | my $load_module = native_function( | ||||||||||||||||||||||||||||
| 162 | name => 'load_module', | ||||||||||||||||||||||||||||
| 163 | 0 | ▶ | native => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=14 SCAR=53.5
| |||||||||||||||||||||||||||||
| 164 | 0 | ▶ | my $file = $runtime->{_native_call_file} // '<std/internals>'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$runtime->{"_native_call_file"} // "<std/internals>"
MC/DC0%0/1
$runtime->{"_native_call_file"} // "<std/internals>"
$runtime->{"_native_call_file"}
Truth table0%0/2
A
A= $runtime->{"_native_call_file"}
| |||||||||||||||||||||||||||||
| 165 | 0 | ▶ | my $line = $runtime->{_native_call_line} // 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$runtime->{"_native_call_line"} // 0
MC/DC0%0/1
$runtime->{"_native_call_line"} // 0
$runtime->{"_native_call_line"}
Truth table0%0/2
A
A= $runtime->{"_native_call_line"}
| |||||||||||||||||||||||||||||
| 166 | 0 | ▶ | my $throw = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 167 | 0 | my ( $message ) = @_; | |||||||||||||||||||||||||||
| 168 | 0 | die Zuzu::Error->new_runtime( | |||||||||||||||||||||||||||
| 169 | message => $message, | ||||||||||||||||||||||||||||
| 170 | file => $file, | ||||||||||||||||||||||||||||
| 171 | line => $line, | ||||||||||||||||||||||||||||
| 172 | ); | ||||||||||||||||||||||||||||
| 173 | 0 | }; | |||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 0 | ▶ | $throw->( "load_module expects 1 to 2 arguments" ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ < 1 or @_ > 2
MC/DC0%0/2
@_ < 1 or @_ > 2
@_ < 1
@_ > 2
Truth table0%0/3
A or B
A= @_ < 1B= @_ > 2
| |||||||||||||||||||||||||||||
| 176 | if @_ < 1 or @_ > 2; | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 0 | my ( $module, $symbol ) = @_; | |||||||||||||||||||||||||||
| 179 | 0 | ▶ | $throw->( "load_module module must be String" ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 180 | if ref($module); | ||||||||||||||||||||||||||||
| 181 | 0 | ▶ | $throw->( "load_module symbol must be String" ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $symbol and ref $symbol
MC/DC0%0/2
defined $symbol and ref $symbol
defined $symbol
ref $symbol
Truth table0%0/3
A and B
A= defined $symbolB= ref $symbol
| |||||||||||||||||||||||||||||
| 182 | if defined $symbol and ref($symbol); | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 0 | my $env = $runtime->_load_module( $module, $file, $line ); | |||||||||||||||||||||||||||
| 185 | 0 | ▶ | my $exports = $runtime->{_module_exports}{$module} // {}; | ||||||||||||||||||||||||||
|
Condition0%0/2
$runtime->{"_module_exports"}{$module} // {}
MC/DC0%0/1
$runtime->{"_module_exports"}{$module} // {}
$runtime->{"_module_exports"}{$module}
Truth table0%0/2
A
A= $runtime->{"_module_exports"}{$module}
| |||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | 0 | ▶ | if ( defined $symbol ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 188 | $throw->( "Module '$module' has no export '$symbol'" ) | ||||||||||||||||||||||||||||
| 189 | 0 | ▶ | if !$exports->{$symbol}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 190 | 0 | my $ref = $env->find_ref($symbol); | |||||||||||||||||||||||||||
| 191 | 0 | ▶ | $throw->( "Module '$module' has no export '$symbol'" ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 192 | if !$ref; | ||||||||||||||||||||||||||||
| 193 | 0 | return slot_value($ref); | |||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | 0 | my %out; | |||||||||||||||||||||||||||
| 197 | 0 | for my $name ( sort CORE::keys %{ $exports } ) { | |||||||||||||||||||||||||||
| 198 | 0 | my $ref = $env->find_ref($name); | |||||||||||||||||||||||||||
| 199 | 0 | ▶ | next if !$ref; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 200 | 0 | $out{$name} = slot_value($ref); | |||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | 0 | return perl_to_zuzu(\%out); | |||||||||||||||||||||||||||
| 204 | }, | ||||||||||||||||||||||||||||
| 205 | 73 | ); | |||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | my $setprop = native_function( | ||||||||||||||||||||||||||||
| 208 | name => 'setprop', | ||||||||||||||||||||||||||||
| 209 | 3 | ▶ | native => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 210 | 3 | my ( $key, $value ) = @_; | |||||||||||||||||||||||||||
| 211 | 3 | return $runtime->env_set_special_prop( $key, $value ); | |||||||||||||||||||||||||||
| 212 | }, | ||||||||||||||||||||||||||||
| 213 | 73 | ); | |||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | my $getprop = native_function( | ||||||||||||||||||||||||||||
| 216 | name => 'getprop', | ||||||||||||||||||||||||||||
| 217 | 0 | ▶ | native => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 218 | 0 | my ( $key ) = @_; | |||||||||||||||||||||||||||
| 219 | 0 | return $runtime->env_get_special_prop( $key ); | |||||||||||||||||||||||||||
| 220 | }, | ||||||||||||||||||||||||||||
| 221 | 73 | ); | |||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | my $setupperprop = native_function( | ||||||||||||||||||||||||||||
| 224 | name => 'setupperprop', | ||||||||||||||||||||||||||||
| 225 | 0 | ▶ | native => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 226 | 0 | my ( $level, $key, $value ) = @_; | |||||||||||||||||||||||||||
| 227 | 0 | return $runtime->env_set_upper_special_prop( $level, $key, $value ); | |||||||||||||||||||||||||||
| 228 | }, | ||||||||||||||||||||||||||||
| 229 | 73 | ); | |||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | my $getupperprop = native_function( | ||||||||||||||||||||||||||||
| 232 | name => 'getupperprop', | ||||||||||||||||||||||||||||
| 233 | 0 | ▶ | native => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 234 | 0 | my ( $level, $key ) = @_; | |||||||||||||||||||||||||||
| 235 | 0 | return $runtime->env_get_upper_special_prop( $level, $key ); | |||||||||||||||||||||||||||
| 236 | }, | ||||||||||||||||||||||||||||
| 237 | 73 | ); | |||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | return { | ||||||||||||||||||||||||||||
| 240 | 73 | class_name => $class_name, | |||||||||||||||||||||||||||
| 241 | classof => $classof, | ||||||||||||||||||||||||||||
| 242 | object_slots => $object_slots, | ||||||||||||||||||||||||||||
| 243 | ansi_esc => $ansi_esc, | ||||||||||||||||||||||||||||
| 244 | ref_id => $ref_id, | ||||||||||||||||||||||||||||
| 245 | to_String => $to_String, | ||||||||||||||||||||||||||||
| 246 | to_Number => $to_Number, | ||||||||||||||||||||||||||||
| 247 | to_Boolean => $to_Boolean, | ||||||||||||||||||||||||||||
| 248 | to_Regexp => $to_Regexp, | ||||||||||||||||||||||||||||
| 249 | to_Regexp_with_flags => $to_Regexp_with_flags, | ||||||||||||||||||||||||||||
| 250 | make_instance => $make_instance, | ||||||||||||||||||||||||||||
| 251 | load_module => $load_module, | ||||||||||||||||||||||||||||
| 252 | setprop => $setprop, | ||||||||||||||||||||||||||||
| 253 | getprop => $getprop, | ||||||||||||||||||||||||||||
| 254 | setupperprop => $setupperprop, | ||||||||||||||||||||||||||||
| 255 | getupperprop => $getupperprop, | ||||||||||||||||||||||||||||
| 256 | }; | ||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | 10 | 1; | |||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | =pod | ||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | =head1 COPYRIGHT AND LICENCE | ||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | B<< Zuzu::Module::Internals >> is copyright Toby Inkster. | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | It is free software; you may redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 268 | the terms of either the Artistic License 1.0 or the GNU General Public | ||||||||||||||||||||||||||||
| 269 | License version 2. | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | =cut | ||||||||||||||||||||||||||||