blib/lib/SPVM/Bool.pm untested

filter: Statementstmt n/a Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a SCAR -
1 package SPVM::Bool;
2  
3 1;
4  
5 =head1 Name
6  
7 SPVM::Bool - A Boolean value as An Object
8  
9 =head1 Description
10  
11 The Bool class in L<SPVM> represents a boolean value as an object.
12  
13 =head1 Usage
14  
15 use Bool;
16
17 my $true = Bool->TRUE;
18 my $false = Bool->FALSE;
19
20 my $true_value = $true->value;
21 my $false_value = $false->value;
22  
23 =head1 Details
24  
25 This class is immutable.
26  
27 This class is automatically loaded.
28  
29 The Bool object is different behavior in bool context.
30  
31 If L</"value"> field is 1, it is evaluated as true.
32  
33 if (Bool->TRUE) {
34 # Run
35 }
36  
37 If L</"value"> field is 0, it is evaluated as false.
38  
39 if (Bool->FALSE) {
40 # Not run
41 }
42  
43 The C<true> keyword is the same as C<Bool-E<gt>TRUE>.
44  
45 if (true) {
46 # Run
47 }
48  
49 The C<false> keyword is the same as C<Bool-E<gt>FALSE>.
50
51 if (false) {
52 # Not run
53 }
54  
55 =head1 Fields
56  
57 =head2 value
58  
59 C<has value : ro byte;>
60  
61 The value.
62  
63 =head1 Class Methods
64  
65 =head2 TRUE
66  
67 C<static method TRUE : L<Bool|SPVM::Bool> ();>
68  
69 Returns the true singleton object.
70  
71 =head2 FALSE
72  
73 C<static method FALSE : L<Bool|SPVM::Bool> ();>
74  
75 Returns the false singleton object.
76  
77 =head1 Copyright & License
78  
79 Copyright (c) 2023 Yuki Kimoto
80  
81 MIT License