Perlito5/Runtime.pm untested

filter: Statementstmt 0.0% 0 / 85 Branchbran 0.0% 0 / 30 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 140 CC 7 SCAR 21.9
CC
7
Cov
0%
test_perl_version
12.0
overloading_flag
12.0
integer_flag
12.0
CRAP 8.9
1 package Perlito5;
2 use Perlito5::Grammar::Scope;
3 use strict;
4  
5 our @PERL_VERSION = ( 5, 26, 0 );
6  
7 $^O = 'perlito5' unless defined $^O;
8 $/ = chr(10) unless defined $/;
9 $" = ' ' unless defined $";
10 $, = undef unless defined $,;
11 $! = '' unless defined $!;
12 $; = chr(28) unless defined $;;
13 $? = 0 unless defined $?;
14 # $[ = 0 unless defined $[; # "assignment to $[ is deprecated"
15 $] = sprintf( "%d.%03d%03d", @PERL_VERSION ) unless $]; # $] is defined(), but ${"main::]"} is not
16 $^V = bless( { 'original' => 'v' . join( ".", @PERL_VERSION ), # v5.26.0
17 'qv' => 1,
18 'version' => [ @PERL_VERSION ]
19 }, 'version' )
20 unless defined $^V;
21 $^H = 0;
22 %^H = ();
23  
24 our $EXPAND_USE = 1;
25 our $EMIT_USE = 0;
26 our $WARNINGS = 0;
27 our $UTF8 = 0;
28 our $BYTES = 0;
29 our @CALLER = ();
30 our %DATA_SECTION = (); # contents of the __DATA__ sections per package
31 our $PKG_NAME = ''; # current package being compiled
32 our $LINE_NUMBER = 0; # current line number being compiled
33 our $FILE_NAME = ''; # current file name being compiled
34 our %FORMAT = (); # 'format' statements - hash of subs
35  
36 # information about the current compilation process
37 our $GLOBAL = {};
38 our @BASE_SCOPE = ( Perlito5::Grammar::Scope->new_base_scope() );
39 our $CLOSURE_SCOPE = 0; # variables that are in scope in the current closure being compiled
40 our @SCOPE_STMT = ();
41 our @END_BLOCK = (); # END block LIFO - array of subs
42 our @INIT_BLOCK = (); # INIT block FIFO - array of subs
43 our @CHECK_BLOCK = (); # CHECK block LIFO - array of subs
44 our @UNITCHECK_BLOCK = (); # UNITCHECK block LIFO - array of subs
45 our %BEGIN_SCRATCHPAD = (); # list of "my" variables captured in BEGIN blocks
46 our $PROTO = {};
47 our %VARS = (); # implements "use vars"
48  
49 # $Perlito5::STRICT_* - See Perlito5X::strict.pm
50  
51 # the Perl-to-Java compiler uses this syntax for "annotations":
52 # package Put { import => 'java.Put' };
53 # annotations are stored as namespace + AST
54 our @ANNOTATION;
55  
56 sub set_global_phase {
57 my $phase = shift;
58 local $@;
59 eval { ${^GLOBAL_PHASE} = $phase };
60 }
61  
62 our $ID = 100; # generic "id" source; increment after use
63  
64 # list of packages that "exist" - this is used by the indirect-object parser
65 our $PACKAGES = {
66 STDERR => 1,
67 STDOUT => 1,
68 STDIN => 1,
69 main => 1,
70 strict => 1,
71 warnings => 1,
72 utf8 => 1,
73 bytes => 1,
74 encoding => 1,
75 UNIVERSAL => 1,
76 CORE => 1,
77 'CORE::GLOBAL' => 1,
78 'Perlito5::IO' => 1,
79 };
80  
81 push @INC, $_
82 for split ":", ($ENV{PERL5LIB} || "");
83  
84 # magic numbers - See lib/integer.pm in perl distribution
85 $Perlito5::INTEGER = 0x01;
86 # magic numbers - See lib/overloading.pm in perl distribution
87 $Perlito5::HINT_NO_AMAGIC = 0x01000000;
88  
89 # these operators change when "use integer" - ( $^H & $Perlito5::INTEGER )
90 %Perlito5::Integer = (
91 '%' => 1,
92 '>>' => 1,
93 '<<' => 1,
94 '^' => 1,
95 '&' => 1,
96 '|' => 1,
97 '+' => 1,
98 '-' => 1,
99 '*' => 1,
100 '/' => 1,
101  
102 '%=' => 1,
103 '>>=' => 1,
104 '<<=' => 1,
105 '^=' => 1,
106 '&=' => 1,
107 '|=' => 1,
108 '+=' => 1,
109 '-=' => 1,
110 '*=' => 1,
111 '/=' => 1,
112  
113 '==' => 1,
114 '!=' => 1,
115 '>' => 1,
116 '>=' => 1,
117 '<' => 1,
118 '<=' => 1,
119 '<=>' => 1,
120 );
121  
122 # the special variables list
123 # obtained with:
124 # $ perldoc -u perlvar | perl -ne ' /^\s*$/ && next; if (/^=item\s+([^\n]+)/) { push @item, $1; print "@item - $_" } else { if (@item) { push @xx, [@item]; print "push\n"; @item = () } }; END {use Data::Dumper; print Dumper \@xx} '
125  
126 our $SPECIAL_VAR = {
127 '$_' => 'ARG',
128 '$&' => '$MATCH',
129 '$`' => '$PREMATCH',
130 '$\'' => '$POSTMATCH',
131 '$+' => '$LAST_PAREN_MATCH',
132 '@+' => '@LAST_MATCH_END',
133 '%+' => '%LAST_PAREN_MATCH',
134  
135 '@-' => '@LAST_MATCH_START',
136 '$|' => 'autoflush',
137 '$/' => '$RS',
138 '@_' => '@ARG',
139 '< $' => '$EUID',
140 '$.' => '$NR',
141 '< $< ' => '$UID',
142 '$(' => '$GID',
143 '$#' => undef,
144 '$@' => '$EVAL_ERROR',
145 '$=' => '$FORMAT_LINES_PER_PAGE',
146 '$,' => '$OFS',
147 '$?' => '$CHILD_ERROR',
148 '$*' => undef,
149 '$[' => undef,
150 '$$' => '$PID',
151 '%-' => undef,
152 '$~' => '$FORMAT_NAME',
153 '$-' => '$FORMAT_LINES_LEFT',
154 '$&' => '$MATCH',
155 '$%' => '$FORMAT_PAGE_NUMBER',
156 '$)' => '$EGID',
157 '$]' => undef,
158 '$!' => '$ERRNO',
159 '$;' => '$SUBSEP',
160 '$\\' => '$ORS',
161 '%!' => undef,
162 '$"' => '$LIST_SEPARATOR',
163 '$_' => '$ARG',
164 '$:' => 'FORMAT_LINE_BREAK_CHARACTERS'
165 };
166  
167 # This list was generated by misc/Perl5/core_redefine.pl
168 #
169 # These builtins can be user-redefined using plain subs.
170 # No other builtins can be redefined (the ones in $Perlito5::CORE_PROTO).
171 # The other builtins can still be used for method names.
172  
173 our $CORE_OVERRIDABLE = {
174 '__FILE__' => 1,
175 '__LINE__' => 1,
176 '__PACKAGE__' => 1,
177 'abs' => 1,
178 'accept' => 1,
179 'alarm' => 1,
180 'and' => 1,
181 'atan2' => 1,
182 'bind' => 1,
183 'binmode' => 1,
184 'bless' => 1,
185 'break' => 1,
186 'caller' => 1,
187 'chdir' => 1,
188 'chmod' => 1,
189 'chomp' => 1,
190 'chop' => 1,
191 'chown' => 1,
192 'chr' => 1,
193 'chroot' => 1,
194 'close' => 1,
195 'closedir' => 1,
196 'cmp' => 1,
197 'connect' => 1,
198 'continue' => 1,
199 'cos' => 1,
200 'crypt' => 1,
201 'dbmclose' => 1,
202 'dbmopen' => 1,
203 'default' => 1,
204 'die' => 1,
205 'do' => 1,
206 'dump' => 1,
207 'each' => 1,
208 'endgrent' => 1,
209 'endhostent' => 1,
210 'endnetent' => 1,
211 'endprotoent' => 1,
212 'endpwent' => 1,
213 'endservent' => 1,
214 'eof' => 1,
215 'exec' => 1,
216 'exit' => 1,
217 'exp' => 1,
218 'fc' => 1,
219 'fcntl' => 1,
220 'fileno' => 1,
221 'flock' => 1,
222 'fork' => 1,
223 'formline' => 1,
224 'getc' => 1,
225 'getgrent' => 1,
226 'getgrgid' => 1,
227 'getgrnam' => 1,
228 'gethostbyaddr' => 1,
229 'gethostbyname' => 1,
230 'gethostent' => 1,
231 'getlogin' => 1,
232 'getnetbyaddr' => 1,
233 'getnetbyname' => 1,
234 'getnetent' => 1,
235 'getpeername' => 1,
236 'getpgrp' => 1,
237 'getppid' => 1,
238 'getpriority' => 1,
239 'getprotobyname' => 1,
240 'getprotobynumber' => 1,
241 'getprotoent' => 1,
242 'getpwent' => 1,
243 'getpwnam' => 1,
244 'getpwuid' => 1,
245 'getservbyname' => 1,
246 'getservbyport' => 1,
247 'getservent' => 1,
248 'getsockname' => 1,
249 'getsockopt' => 1,
250 'given' => 1,
251 'glob' => 1,
252 'gmtime' => 1,
253 'hex' => 1,
254 'index' => 1,
255 'int' => 1,
256 'ioctl' => 1,
257 'join' => 1,
258 'keys' => 1,
259 'kill' => 1,
260 'lc' => 1,
261 'lcfirst' => 1,
262 'length' => 1,
263 'link' => 1,
264 'listen' => 1,
265 'localtime' => 1,
266 'lock' => 1,
267 'log' => 1,
268 'lstat' => 1,
269 'mkdir' => 1,
270 'msgctl' => 1,
271 'msgget' => 1,
272 'msgrcv' => 1,
273 'msgsnd' => 1,
274 'not' => 1,
275 'oct' => 1,
276 'open' => 1,
277 'opendir' => 1,
278 'or' => 1,
279 'ord' => 1,
280 'pack' => 1,
281 'pipe' => 1,
282 'pop' => 1,
283 'push' => 1,
284 'quotemeta' => 1,
285 'rand' => 1,
286 'read' => 1,
287 'readdir' => 1,
288 'readline' => 1,
289 'readlink' => 1,
290 'readpipe' => 1,
291 'recv' => 1,
292 'ref' => 1,
293 'rename' => 1,
294 'require' => 1,
295 'reset' => 1,
296 'reverse' => 1,
297 'rewinddir' => 1,
298 'rindex' => 1,
299 'rmdir' => 1,
300 'say' => 1,
301 'seek' => 1,
302 'seekdir' => 1,
303 'select' => 1,
304 'semctl' => 1,
305 'semget' => 1,
306 'semop' => 1,
307 'send' => 1,
308 'setgrent' => 1,
309 'sethostent' => 1,
310 'setnetent' => 1,
311 'setpgrp' => 1,
312 'setpriority' => 1,
313 'setprotoent' => 1,
314 'setpwent' => 1,
315 'setservent' => 1,
316 'setsockopt' => 1,
317 'shift' => 1,
318 'shmctl' => 1,
319 'shmget' => 1,
320 'shmread' => 1,
321 'shmwrite' => 1,
322 'shutdown' => 1,
323 'sin' => 1,
324 'sleep' => 1,
325 'socket' => 1,
326 'socketpair' => 1,
327 'splice' => 1,
328 'sprintf' => 1,
329 'sqrt' => 1,
330 'srand' => 1,
331 'stat' => 1,
332 'state' => 1,
333 'substr' => 1,
334 'symlink' => 1,
335 'syscall' => 1,
336 'sysopen' => 1,
337 'sysread' => 1,
338 'sysseek' => 1,
339 'system' => 1,
340 'syswrite' => 1,
341 'tell' => 1,
342 'telldir' => 1,
343 'tie' => 1,
344 'tied' => 1,
345 'time' => 1,
346 'times' => 1,
347 'truncate' => 1,
348 'uc' => 1,
349 'ucfirst' => 1,
350 'umask' => 1,
351 'unlink' => 1,
352 'unpack' => 1,
353 'unshift' => 1,
354 'untie' => 1,
355 'utime' => 1,
356 'values' => 1,
357 'vec' => 1,
358 'wait' => 1,
359 'waitpid' => 1,
360 'wantarray' => 1,
361 'warn' => 1,
362 'when' => 1,
363 'write' => 1,
364 'xor' => 1,
365 };
366  
367 # This list was generated by misc/Perl5/core_global_override.pl
368 #
369 # From perlsub:
370 #
371 # The built-ins "do", "require" and "glob" can also be overridden, but due
372 # to special magic, their original syntax is preserved, and you don't have
373 # to define a prototype for their replacements. (You can't override the "do
374 # BLOCK" syntax, though).
375 #
376 # "require" has special additional dark magic: if you invoke your "require"
377 # replacement as "require Foo::Bar", it will actually receive the argument
378 # "Foo/Bar.pm" in @_. See "require" in perlfunc.
379 #
380 # And, as you'll have noticed from the previous example, if you override
381 # "glob", the "<*>" glob operator is overridden as well.
382 #
383 # In a similar fashion, overriding the "readline" function also overrides
384 # the equivalent I/O operator "<FILEHANDLE>". Also, overriding "readpipe"
385 # also overrides the operators `` and "qx//".
386 #
387  
388 our $CORE_GLOBAL_OVERRIDABLE = {
389 '__FILE__' => 1,
390 '__LINE__' => 1,
391 '__PACKAGE__' => 1,
392 'abs' => 1,
393 'accept' => 1,
394 'alarm' => 1,
395 'and' => 1,
396 'atan2' => 1,
397 'bind' => 1,
398 'binmode' => 1,
399 'bless' => 1,
400 'caller' => 1,
401 'chdir' => 1,
402 'chmod' => 1,
403 'chomp' => 1,
404 'chop' => 1,
405 'chown' => 1,
406 'chr' => 1,
407 'chroot' => 1,
408 'close' => 1,
409 'closedir' => 1,
410 'cmp' => 1,
411 'connect' => 1,
412 'continue' => 1,
413 'cos' => 1,
414 'crypt' => 1,
415 'dbmclose' => 1,
416 'dbmopen' => 1,
417 'die' => 1,
418 'do' => 1,
419 'dump' => 1,
420 'each' => 1,
421 'endgrent' => 1,
422 'endhostent' => 1,
423 'endnetent' => 1,
424 'endprotoent' => 1,
425 'endpwent' => 1,
426 'endservent' => 1,
427 'eof' => 1,
428 'exec' => 1,
429 'exit' => 1,
430 'exp' => 1,
431 'fcntl' => 1,
432 'fileno' => 1,
433 'flock' => 1,
434 'fork' => 1,
435 'formline' => 1,
436 'getc' => 1,
437 'getgrent' => 1,
438 'getgrgid' => 1,
439 'getgrnam' => 1,
440 'gethostbyaddr' => 1,
441 'gethostbyname' => 1,
442 'gethostent' => 1,
443 'getlogin' => 1,
444 'getnetbyaddr' => 1,
445 'getnetbyname' => 1,
446 'getnetent' => 1,
447 'getpeername' => 1,
448 'getpgrp' => 1,
449 'getppid' => 1,
450 'getpriority' => 1,
451 'getprotobyname' => 1,
452 'getprotobynumber' => 1,
453 'getprotoent' => 1,
454 'getpwent' => 1,
455 'getpwnam' => 1,
456 'getpwuid' => 1,
457 'getservbyname' => 1,
458 'getservbyport' => 1,
459 'getservent' => 1,
460 'getsockname' => 1,
461 'getsockopt' => 1,
462 'glob' => 1,
463 'gmtime' => 1,
464 'hex' => 1,
465 'index' => 1,
466 'int' => 1,
467 'ioctl' => 1,
468 'join' => 1,
469 'keys' => 1,
470 'kill' => 1,
471 'lc' => 1,
472 'lcfirst' => 1,
473 'length' => 1,
474 'link' => 1,
475 'listen' => 1,
476 'localtime' => 1,
477 'lock' => 1,
478 'log' => 1,
479 'lstat' => 1,
480 'mkdir' => 1,
481 'msgctl' => 1,
482 'msgget' => 1,
483 'msgrcv' => 1,
484 'msgsnd' => 1,
485 'not' => 1,
486 'oct' => 1,
487 'open' => 1,
488 'opendir' => 1,
489 'or' => 1,
490 'ord' => 1,
491 'pack' => 1,
492 'pipe' => 1,
493 'pop' => 1,
494 'push' => 1,
495 'quotemeta' => 1,
496 'rand' => 1,
497 'read' => 1,
498 'readdir' => 1,
499 'readline' => 1,
500 'readlink' => 1,
501 'readpipe' => 1,
502 'recv' => 1,
503 'ref' => 1,
504 'rename' => 1,
505 'require' => 1,
506 'reset' => 1,
507 'reverse' => 1,
508 'rewinddir' => 1,
509 'rindex' => 1,
510 'rmdir' => 1,
511 'seek' => 1,
512 'seekdir' => 1,
513 'select' => 1,
514 'semctl' => 1,
515 'semget' => 1,
516 'semop' => 1,
517 'send' => 1,
518 'setgrent' => 1,
519 'sethostent' => 1,
520 'setnetent' => 1,
521 'setpgrp' => 1,
522 'setpriority' => 1,
523 'setprotoent' => 1,
524 'setpwent' => 1,
525 'setservent' => 1,
526 'setsockopt' => 1,
527 'shift' => 1,
528 'shmctl' => 1,
529 'shmget' => 1,
530 'shmread' => 1,
531 'shmwrite' => 1,
532 'shutdown' => 1,
533 'sin' => 1,
534 'sleep' => 1,
535 'socket' => 1,
536 'socketpair' => 1,
537 'splice' => 1,
538 'sprintf' => 1,
539 'sqrt' => 1,
540 'srand' => 1,
541 'stat' => 1,
542 'substr' => 1,
543 'symlink' => 1,
544 'syscall' => 1,
545 'sysopen' => 1,
546 'sysread' => 1,
547 'sysseek' => 1,
548 'system' => 1,
549 'syswrite' => 1,
550 'tell' => 1,
551 'telldir' => 1,
552 'tie' => 1,
553 'tied' => 1,
554 'time' => 1,
555 'times' => 1,
556 'truncate' => 1,
557 'uc' => 1,
558 'ucfirst' => 1,
559 'umask' => 1,
560 'unlink' => 1,
561 'unpack' => 1,
562 'unshift' => 1,
563 'untie' => 1,
564 'utime' => 1,
565 'values' => 1,
566 'vec' => 1,
567 'wait' => 1,
568 'waitpid' => 1,
569 'wantarray' => 1,
570 'warn' => 1,
571 'write' => 1,
572 'xor' => 1,
573 };
574  
575 # the CORE prototype list
576 # obtained with:
577 # $ perldoc -u PerlFunc | head -n300 | perl -ne ' push @x, /C<([^>]+)/g; END { eval { $p{"CORE::$_"} = prototype("CORE::$_") } for @x; use Data::Dumper; print Dumper \%p } ' > ~/tmp/core.pm
578  
579 our $CORE_PROTO = {
580 'CORE::abs' => '_',
581 'CORE::accept' => '**',
582 'CORE::alarm' => '_',
583 'CORE::atan2' => '$$',
584 'CORE::bind' => '*$',
585 'CORE::binmode' => '*;$',
586 'CORE::bless' => '$;$',
587 'CORE::break' => '',
588 'CORE::caller' => ';$',
589 'CORE::chdir' => ';$',
590 'CORE::chmod' => '@',
591 'CORE::chomp' => '_', # original 'undef',
592 'CORE::chop' => '_', # original 'undef',
593 'CORE::chown' => '@',
594 'CORE::chr' => '_',
595 'CORE::chroot' => '_',
596 'CORE::close' => ';*',
597 'CORE::closedir' => '*',
598 'CORE::connect' => '*$',
599 'CORE::continue' => '',
600 'CORE::cos' => '_',
601 'CORE::crypt' => '$$',
602 'CORE::dbmclose' => '\\%',
603 'CORE::dbmopen' => '\\%$$',
604 'CORE::default' => undef,
605 'CORE::defined' => '_', # original 'undef',
606 'CORE::delete' => '$', # original 'undef'
607 'CORE::die' => '@',
608 'CORE::do' => undef,
609 'CORE::dump' => '',
610 'CORE::each' => '+',
611 'CORE::endgrent' => '',
612 'CORE::endhostent' => '',
613 'CORE::endnetent' => '',
614 'CORE::endprotoent' => '',
615 'CORE::endpwent' => '',
616 'CORE::endservent' => '',
617 'CORE::eof' => ';*',
618 'CORE::eval' => '_', # original undef
619 'CORE::exec' => undef,
620 'CORE::exists' => '$', # original 'undef',
621 'CORE::exit' => ';$',
622 'CORE::exp' => '_',
623 'CORE::fc' => '_',
624 'CORE::fcntl' => '*$$',
625 'CORE::fileno' => '*',
626 'CORE::flock' => '*$',
627 'CORE::fork' => '',
628 'CORE::format' => undef,
629 'CORE::formline' => '$@',
630 'CORE::getc' => ';*',
631 'CORE::getgrent' => '',
632 'CORE::getgrgid' => '$',
633 'CORE::getgrnam' => '$',
634 'CORE::gethostbyaddr' => '$$',
635 'CORE::gethostbyname' => '$',
636 'CORE::gethostent' => '',
637 'CORE::getlogin' => '',
638 'CORE::getnetbyaddr' => '$$',
639 'CORE::getnetbyname' => '$',
640 'CORE::getnetent' => '',
641 'CORE::getpeername' => '*',
642 'CORE::getpgrp' => ';$',
643 'CORE::getppid' => '',
644 'CORE::getpriority' => '$$',
645 'CORE::getprotobyname' => '$',
646 'CORE::getprotobynumber' => '$',
647 'CORE::getprotoent' => '',
648 'CORE::getpwent' => '',
649 'CORE::getpwnam' => '$',
650 'CORE::getpwuid' => '$',
651 'CORE::getservbyname' => '$$',
652 'CORE::getservbyport' => '$$',
653 'CORE::getservent' => '',
654 'CORE::getsockname' => '*',
655 'CORE::getsockopt' => '*$$',
656 'CORE::given' => undef,
657 'CORE::glob' => undef,
658 'CORE::gmtime' => ';$',
659 'CORE::goto' => undef,
660 'CORE::grep' => undef,
661 'CORE::hex' => '_',
662 'CORE::index' => '$$;$',
663 'CORE::int' => '_',
664 'CORE::ioctl' => '*$$',
665 'CORE::join' => '$@',
666 'CORE::keys' => '+',
667 'CORE::kill' => '@',
668 'CORE::last' => undef,
669 'CORE::lc' => '_',
670 'CORE::lcfirst' => '_',
671 'CORE::length' => '_',
672 'CORE::link' => '$$',
673 'CORE::listen' => '*$',
674 'CORE::local' => undef,
675 'CORE::localtime' => ';$',
676 'CORE::lock' => '\\$',
677 'CORE::log' => '_',
678 'CORE::lstat' => '*',
679 'CORE::map' => undef,
680 'CORE::mkdir' => '_;$',
681 'CORE::msgctl' => '$$$',
682 'CORE::msgget' => '$$',
683 'CORE::msgrcv' => '$$$$$',
684 'CORE::msgsnd' => '$$$',
685 'CORE::my' => undef,
686 'CORE::next' => undef,
687 'CORE::no' => undef,
688 'CORE::oct' => '_',
689 'CORE::open' => '*;$@',
690 'CORE::opendir' => '*$',
691 'CORE::ord' => '_',
692 'CORE::our' => undef,
693 'CORE::pack' => '$@',
694 'CORE::pack' => '$@',
695 'CORE::package' => undef,
696 'CORE::pipe' => '**',
697 'CORE::pop' => ';+',
698 'CORE::pos' => undef,
699 'CORE::print' => undef,
700 'CORE::printf' => '$@', # original 'undef',
701 'CORE::prototype' => undef,
702 'CORE::push' => '+@',
703 'CORE::quotemeta' => '_',
704 'CORE::rand' => ';$',
705 'CORE::read' => '*\\$$;$',
706 'CORE::readdir' => '*',
707 'CORE::readline' => ';*',
708 'CORE::readlink' => '_',
709 'CORE::readpipe' => '_',
710 'CORE::recv' => '*\\$$$',
711 'CORE::redo' => undef,
712 'CORE::ref' => '_',
713 'CORE::rename' => '$$',
714 'CORE::require' => undef,
715 'CORE::reset' => ';$',
716 'CORE::return' => undef,
717 'CORE::reverse' => '@',
718 'CORE::rewinddir' => '*',
719 'CORE::rindex' => '$$;$',
720 'CORE::rmdir' => '_',
721 'CORE::say' => undef,
722 'CORE::scalar' => undef,
723 'CORE::seek' => '*$$',
724 'CORE::seekdir' => '*$',
725 'CORE::select' => ';*',
726 'CORE::semctl' => '$$$$',
727 'CORE::semget' => '$$$',
728 'CORE::semop' => '$$',
729 'CORE::send' => '*$$;$',
730 'CORE::setgrent' => '',
731 'CORE::sethostent' => '$',
732 'CORE::setnetent' => '$',
733 'CORE::setpgrp' => ';$$',
734 'CORE::setpriority' => '$$$',
735 'CORE::setprotoent' => '$',
736 'CORE::setpwent' => '',
737 'CORE::setservent' => '$',
738 'CORE::setsockopt' => '*$$$',
739 'CORE::shift' => ';+',
740 'CORE::shmctl' => '$$$',
741 'CORE::shmget' => '$$$',
742 'CORE::shmread' => '$$$$',
743 'CORE::shmwrite' => '$$$$',
744 'CORE::shutdown' => '*$',
745 'CORE::sin' => '_',
746 'CORE::sleep' => ';$',
747 'CORE::socket' => '*$$$',
748 'CORE::socketpair' => '**$$$',
749 'CORE::sort' => undef,
750 'CORE::splice' => '+;$$@',
751 'CORE::split' => undef,
752 'CORE::sprintf' => '$@',
753 'CORE::sqrt' => '_',
754 'CORE::srand' => ';$',
755 'CORE::stat' => '*',
756 'CORE::state' => undef,
757 'CORE::study' => undef,
758 'CORE::sub' => undef,
759 'CORE::substr' => '$$;$$',
760 'CORE::symlink' => '$$',
761 'CORE::syscall' => '$@',
762 'CORE::sysopen' => '*$$;$',
763 'CORE::sysread' => '*\\$$;$',
764 'CORE::sysseek' => '*$$',
765 'CORE::system' => undef,
766 'CORE::syswrite' => '*$;$$',
767 'CORE::tell' => ';*',
768 'CORE::telldir' => '*',
769 'CORE::tie' => '\\[$@%]$;@', # original undef
770 'CORE::tied' => undef,
771 'CORE::time' => '',
772 'CORE::times' => '',
773 'CORE::truncate' => '$$',
774 'CORE::uc' => '_',
775 'CORE::ucfirst' => '_',
776 'CORE::umask' => ';$',
777 'CORE::undef' => ';$', # original undef
778 'CORE::unlink' => '@',
779 'CORE::unpack' => '$;$',
780 'CORE::unshift' => '+@',
781 'CORE::untie' => undef,
782 'CORE::use' => undef,
783 'CORE::utime' => '@',
784 'CORE::values' => '+',
785 'CORE::vec' => '$$$',
786 'CORE::wait' => '',
787 'CORE::waitpid' => '$$',
788 'CORE::wantarray' => '',
789 'CORE::warn' => '@',
790 'CORE::when' => undef,
791 'CORE::write' => ';*',
792  
793 'CORE::m' => undef,
794 'CORE::q' => undef,
795 'CORE::qq' => undef,
796 'CORE::qw' => undef,
797 'CORE::qx' => undef,
798 'CORE::qr' => undef,
799 'CORE::s' => undef,
800 'CORE::tr' => undef,
801 'CORE::y' => undef,
802  
803 'CORE::if' => undef,
804 'CORE::unless' => undef,
805 'CORE::when' => undef,
806 'CORE::for' => undef,
807 'CORE::foreach' => undef,
808 'CORE::while' => undef,
809 'CORE::given' => undef,
810  
811 'CORE::and' => undef,
812 'CORE::or' => undef,
813 'CORE::xor' => undef,
814 'CORE::not' => undef,
815 'CORE::cmp' => undef,
816  
817 'CORE::__FILE__' => '',
818 'CORE::__LINE__' => '',
819 'CORE::__PACKAGE__' => '',
820 'CORE::__END__' => undef,
821 'CORE::__DATA__' => undef,
822 };
823  
824 # this is the routine executed by statements like 'require 5.20' and 'use v5.20'
825 sub test_perl_version {
826 my $version = shift;
827 $version =~ s/^v//;
828 if ($version && ord(substr($version,0,1)) < 10) {
829 # v-string to string
830 my @v = split(//,$version);
831 push @v, chr(0) while @v < 3;
832 $version = sprintf("%d.%03d%03d", map { ord($_) } @v);
833 }
834 else {
835 my @v = split(/\./,$version);
836 $v[1] = $v[1] . '0' while length($v[1]) < 3;
837 $version = join('.', @v);
838 }
839 if ($version gt $]) {
840 die "Perl v$version required--this is only v$]";
841 }
842 }
843  
844 sub get_label {
845 'tmp' . $Perlito5::ID++
846 }
847  
848 sub overloading_flag {
849 my $no_overloading;
850 if ($^H & $Perlito5::HINT_NO_AMAGIC) {
851 # TODO - check operator bit in $^H{overloading}
852 $no_overloading = 1;
853 }
854 return ( $no_overloading ? ( _no_overloading => 1 ) : () );
855 }
856 sub integer_flag {
857 my $op = shift;
858 my $is_integer;
859 if ( ($^H & $Perlito5::INTEGER) && $Perlito5::Integer{$op} ) {
860 $is_integer = 1;
861 }
862 return ( $is_integer ? ( _integer => 1 ) : () );
863 }
864  
865 1;
866