| 1 | package TUI::toolkit::boolean; | ||||||||||
| 2 | # ABSTRACT: Boolean constants for Perl | ||||||||||
| 3 | |||||||||||
| 4 | 133 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 133 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 133 | our $VERSION = '0.04'; | |||||||||
| 8 | |||||||||||
| 9 | 133 | ▶ | use Exporter 'import'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 133 | our @EXPORT = qw( | |||||||||
| 12 | true | ||||||||||
| 13 | false | ||||||||||
| 14 | ); | ||||||||||
| 15 | |||||||||||
| 16 | sub true () { !!1 } | ||||||||||
| 17 | sub false () { !!0 } | ||||||||||
| 18 | |||||||||||
| 19 | # Perl v5.36 and later have a built-in boolean type, | ||||||||||
| 20 | # so if it's available, use it. | ||||||||||
| 21 | 133 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=3 SCAR=13.6
| |||||||||||
| 22 | 133 | ▶ | no strict 'refs'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | 133 | for my $sub ( @EXPORT ) { | |||||||||
| 24 | 0 | ▶ | if ( defined &{ 'builtin::' . $sub } ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 133 | ▶ | no warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | 0 | *$sub = \&{ 'builtin::' . $sub }; | |||||||||
| 27 | } | ||||||||||
| 28 | } | ||||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 133 | 1 | |||||||||
| 32 | |||||||||||
| 33 | |||||||||||
| 34 | __END__ | ||||||||||