| 1 | package Text::Nunjucks::Runtime::None; | ||||||||||||
| 2 | # ABSTRACT: The JS null sentinel (ADR 0006) | ||||||||||||
| 3 | |||||||||||||
| 4 | 23 | our $VERSION = '0.001'; | |||||||||||
| 5 | |||||||||||||
| 6 | 23 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 23 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | # A port addition to runtime.js, at its ADR-designated home beside | ||||||||||||
| 10 | # Text::Nunjucks::Runtime, which hands it out as Text::Nunjucks::Runtime->None. | ||||||||||||
| 11 | # | ||||||||||||
| 12 | # A single immutable process-wide sentinel standing for JS `null`. Perl | ||||||||||||
| 13 | # `undef` is JS `undefined`; a present-but-null value is this object, so the | ||||||||||||
| 14 | # null/undefined distinction (is defined / is none / is undefined, | ||||||||||||
| 15 | # throwOnUndefined) survives set/macros/filters where an exists-check cannot. | ||||||||||||
| 16 | # No stringification/bool overload on purpose: every output/compare/lookup | ||||||||||||
| 17 | # path routes None through suppress_value / op_* / member_lookup, so a raw | ||||||||||||
| 18 | # None that leaked into bare Perl concat should stay visible, not silently ''. | ||||||||||||
| 19 | |||||||||||||
| 20 | 23 | my $INSTANCE; | |||||||||||
| 21 | 567 | ▶ | sub instance { $INSTANCE //= bless \( my $x ), __PACKAGE__ } | ||||||||||
|
Subroutine
instance: called CC=2 SCAR=6.9
Pod
undocumented
Condition100%2/2
$INSTANCE //= bless(\my $x, __PACKAGE__)
MC/DC100%1/1
$INSTANCE //= bless(\my $x, __PACKAGE__)
$INSTANCE
Truth table100%2/2
A
A= $INSTANCE
| |||||||||||||
| 22 | |||||||||||||
| 23 | 23 | 1; | |||||||||||
| 24 | |||||||||||||
| 25 | __END__ | ||||||||||||