line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# This file was autogenerated. |
2
|
2
|
|
|
2
|
|
227999
|
use 5.008001; |
|
2
|
|
|
|
|
12
|
|
3
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
40
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
51
|
|
5
|
2
|
|
|
2
|
|
10
|
no warnings qw( void once ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
53
|
|
6
|
2
|
|
|
2
|
|
393
|
use Hydrogen (); |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
168
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package Hydrogen::Topic::Number; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
11
|
|
|
|
|
|
|
our $VERSION = '0.018'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Hydrogen::Topic::Number - functions from Hydrogen::Number applied to C<$_> |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 VERSION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
This documentation is for Hydrogen::Topic::Number 0.018, |
20
|
|
|
|
|
|
|
which is based on Sub::HandlesVia::HandlerLibrary::Number 0.046. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 FUNCTIONS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Each function implicitly operates on C<< $_ >>, expecting it to be a numeric scalar. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
2
|
|
|
|
|
11
|
use Exporter::Shiny qw( |
31
|
|
|
|
|
|
|
abs |
32
|
|
|
|
|
|
|
add |
33
|
|
|
|
|
|
|
cmp |
34
|
|
|
|
|
|
|
div |
35
|
|
|
|
|
|
|
eq |
36
|
|
|
|
|
|
|
ge |
37
|
|
|
|
|
|
|
get |
38
|
|
|
|
|
|
|
gt |
39
|
|
|
|
|
|
|
le |
40
|
|
|
|
|
|
|
lt |
41
|
|
|
|
|
|
|
mod |
42
|
|
|
|
|
|
|
mul |
43
|
|
|
|
|
|
|
ne |
44
|
|
|
|
|
|
|
set |
45
|
|
|
|
|
|
|
sub |
46
|
2
|
|
|
2
|
|
13
|
); |
|
2
|
|
|
|
|
4
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 C<< abs() >> |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Operates on C<< $_ >>, which must be a numeric scalar. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Finds the absolute value of the current number, updating the original value. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub abs { |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
59
|
1
|
50
|
|
1
|
1
|
7628
|
@_ == 0 |
60
|
|
|
|
|
|
|
or Hydrogen::croak( "Wrong number of parameters for abs; usage: " |
61
|
|
|
|
|
|
|
. "Hydrogen::Topic::Number::abs()" ); |
62
|
1
|
|
|
|
|
3
|
1; |
63
|
1
|
|
|
|
|
4
|
( $_ = abs($_) ); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 C<< add( $addend ) >> |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Operates on C<< $_ >>, which must be a numeric scalar. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Arguments: B<< Num >>. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Adds a number to the existing number, updating the original value. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub add { |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
79
|
1
|
|
|
1
|
1
|
4471
|
@_ = do { |
80
|
1
|
|
|
|
|
3
|
my ( %tmp, $tmp ); |
81
|
|
|
|
|
|
|
|
82
|
1
|
50
|
|
|
|
5
|
@_ == 1 |
83
|
|
|
|
|
|
|
or Hydrogen::croak( |
84
|
|
|
|
|
|
|
"Wrong number of parameters in signature for %s: got %d, %s", |
85
|
|
|
|
|
|
|
"add", scalar(@_), "expected exactly 1 parameters" ); |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# Parameter $_[0] (type: Num) |
88
|
|
|
|
|
|
|
( |
89
|
1
|
50
|
|
|
|
3
|
do { |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
92
|
2
|
|
|
2
|
|
353
|
use Scalar::Util (); |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
228
|
|
93
|
1
|
50
|
33
|
|
|
15
|
defined( $_[0] ) |
94
|
|
|
|
|
|
|
&& !ref( $_[0] ) |
95
|
|
|
|
|
|
|
&& Scalar::Util::looks_like_number( $_[0] ); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
) |
98
|
|
|
|
|
|
|
or Hydrogen::croak( |
99
|
|
|
|
|
|
|
"Type check failed in signature for add: %s should be %s", |
100
|
|
|
|
|
|
|
"\$_[0]", "Num" ); |
101
|
|
|
|
|
|
|
|
102
|
1
|
|
|
|
|
4
|
(@_); |
103
|
|
|
|
|
|
|
}; |
104
|
|
|
|
|
|
|
( |
105
|
1
|
|
|
|
|
2
|
$_ = do { |
106
|
1
|
|
|
|
|
3
|
my $shv_final_unchecked = $_ + $_[0]; |
107
|
1
|
|
|
|
|
2
|
do { |
108
|
|
|
|
|
|
|
( |
109
|
1
|
50
|
|
|
|
2
|
do { |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
112
|
2
|
|
|
2
|
|
15
|
use Scalar::Util (); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
311
|
|
113
|
1
|
50
|
33
|
|
|
10
|
defined($shv_final_unchecked) |
114
|
|
|
|
|
|
|
&& !ref($shv_final_unchecked) |
115
|
|
|
|
|
|
|
&& Scalar::Util::looks_like_number( |
116
|
|
|
|
|
|
|
$shv_final_unchecked); |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
) |
119
|
|
|
|
|
|
|
or Hydrogen::croak( |
120
|
|
|
|
|
|
|
"Type check failed for add: expected %s, got value %s", |
121
|
|
|
|
|
|
|
"Num", $shv_final_unchecked ); |
122
|
1
|
|
|
|
|
3
|
$shv_final_unchecked; |
123
|
|
|
|
|
|
|
}; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 C<< cmp( $num ) >> |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Operates on C<< $_ >>, which must be a numeric scalar. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Arguments: B<< Num >>. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Returns C<< $_ <=> $num >>. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub cmp { |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
141
|
0
|
|
|
0
|
1
|
0
|
@_ = do { |
142
|
0
|
|
|
|
|
0
|
my ( %tmp, $tmp ); |
143
|
|
|
|
|
|
|
|
144
|
0
|
0
|
|
|
|
0
|
@_ == 1 |
145
|
|
|
|
|
|
|
or Hydrogen::croak( |
146
|
|
|
|
|
|
|
"Wrong number of parameters in signature for %s: got %d, %s", |
147
|
|
|
|
|
|
|
"cmp", scalar(@_), "expected exactly 1 parameters" ); |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
# Parameter $_[0] (type: Num) |
150
|
|
|
|
|
|
|
( |
151
|
0
|
0
|
|
|
|
0
|
do { |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
154
|
2
|
|
|
2
|
|
13
|
use Scalar::Util (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
286
|
|
155
|
0
|
0
|
0
|
|
|
0
|
defined( $_[0] ) |
156
|
|
|
|
|
|
|
&& !ref( $_[0] ) |
157
|
|
|
|
|
|
|
&& Scalar::Util::looks_like_number( $_[0] ); |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
) |
160
|
|
|
|
|
|
|
or Hydrogen::croak( |
161
|
|
|
|
|
|
|
"Type check failed in signature for cmp: %s should be %s", |
162
|
|
|
|
|
|
|
"\$_[0]", "Num" ); |
163
|
|
|
|
|
|
|
|
164
|
0
|
|
|
|
|
0
|
(@_); |
165
|
|
|
|
|
|
|
}; |
166
|
0
|
|
|
|
|
0
|
$_ <=> $_[0]; |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head2 C<< div( $divisor ) >> |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Operates on C<< $_ >>, which must be a numeric scalar. |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Arguments: B<< Num >>. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Divides the existing number by a number, updating the original value. |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=cut |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
sub div { |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
182
|
1
|
|
|
1
|
1
|
5845
|
@_ = do { |
183
|
1
|
|
|
|
|
3
|
my ( %tmp, $tmp ); |
184
|
|
|
|
|
|
|
|
185
|
1
|
50
|
|
|
|
4
|
@_ == 1 |
186
|
|
|
|
|
|
|
or Hydrogen::croak( |
187
|
|
|
|
|
|
|
"Wrong number of parameters in signature for %s: got %d, %s", |
188
|
|
|
|
|
|
|
"div", scalar(@_), "expected exactly 1 parameters" ); |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
# Parameter $_[0] (type: Num) |
191
|
|
|
|
|
|
|
( |
192
|
1
|
50
|
|
|
|
2
|
do { |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
195
|
2
|
|
|
2
|
|
16
|
use Scalar::Util (); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
181
|
|
196
|
1
|
50
|
33
|
|
|
13
|
defined( $_[0] ) |
197
|
|
|
|
|
|
|
&& !ref( $_[0] ) |
198
|
|
|
|
|
|
|
&& Scalar::Util::looks_like_number( $_[0] ); |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
) |
201
|
|
|
|
|
|
|
or Hydrogen::croak( |
202
|
|
|
|
|
|
|
"Type check failed in signature for div: %s should be %s", |
203
|
|
|
|
|
|
|
"\$_[0]", "Num" ); |
204
|
|
|
|
|
|
|
|
205
|
1
|
|
|
|
|
5
|
(@_); |
206
|
|
|
|
|
|
|
}; |
207
|
|
|
|
|
|
|
( |
208
|
1
|
|
|
|
|
1
|
$_ = do { |
209
|
1
|
|
|
|
|
6
|
my $shv_final_unchecked = $_ / $_[0]; |
210
|
1
|
|
|
|
|
2
|
do { |
211
|
|
|
|
|
|
|
( |
212
|
1
|
50
|
|
|
|
2
|
do { |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
215
|
2
|
|
|
2
|
|
12
|
use Scalar::Util (); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
366
|
|
216
|
1
|
50
|
33
|
|
|
10
|
defined($shv_final_unchecked) |
217
|
|
|
|
|
|
|
&& !ref($shv_final_unchecked) |
218
|
|
|
|
|
|
|
&& Scalar::Util::looks_like_number( |
219
|
|
|
|
|
|
|
$shv_final_unchecked); |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
) |
222
|
|
|
|
|
|
|
or Hydrogen::croak( |
223
|
|
|
|
|
|
|
"Type check failed for div: expected %s, got value %s", |
224
|
|
|
|
|
|
|
"Num", $shv_final_unchecked ); |
225
|
1
|
|
|
|
|
3
|
$shv_final_unchecked; |
226
|
|
|
|
|
|
|
}; |
227
|
|
|
|
|
|
|
} |
228
|
|
|
|
|
|
|
); |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=head2 C<< eq( $num ) >> |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
Operates on C<< $_ >>, which must be a numeric scalar. |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
Arguments: B<< Num >>. |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
Returns C<< $_ == $num >>. |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=cut |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
sub eq { |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
244
|
0
|
|
|
0
|
1
|
0
|
@_ = do { |
245
|
0
|
|
|
|
|
0
|
my ( %tmp, $tmp ); |
246
|
|
|
|
|
|
|
|
247
|
0
|
0
|
|
|
|
0
|
@_ == 1 |
248
|
|
|
|
|
|
|
or Hydrogen::croak( |
249
|
|
|
|
|
|
|
"Wrong number of parameters in signature for %s: got %d, %s", |
250
|
|
|
|
|
|
|
"eq", scalar(@_), "expected exactly 1 parameters" ); |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
# Parameter $_[0] (type: Num) |
253
|
|
|
|
|
|
|
( |
254
|
0
|
0
|
|
|
|
0
|
do { |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
257
|
2
|
|
|
2
|
|
14
|
use Scalar::Util (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
294
|
|
258
|
0
|
0
|
0
|
|
|
0
|
defined( $_[0] ) |
259
|
|
|
|
|
|
|
&& !ref( $_[0] ) |
260
|
|
|
|
|
|
|
&& Scalar::Util::looks_like_number( $_[0] ); |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
) |
263
|
|
|
|
|
|
|
or Hydrogen::croak( |
264
|
|
|
|
|
|
|
"Type check failed in signature for eq: %s should be %s", |
265
|
|
|
|
|
|
|
"\$_[0]", "Num" ); |
266
|
|
|
|
|
|
|
|
267
|
0
|
|
|
|
|
0
|
(@_); |
268
|
|
|
|
|
|
|
}; |
269
|
0
|
|
|
|
|
0
|
$_ == $_[0]; |
270
|
|
|
|
|
|
|
} |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=head2 C<< ge( $num ) >> |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
Operates on C<< $_ >>, which must be a numeric scalar. |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
Arguments: B<< Num >>. |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
Returns C<< $_ >= $num >>. |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=cut |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
sub ge { |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
285
|
0
|
|
|
0
|
1
|
0
|
@_ = do { |
286
|
0
|
|
|
|
|
0
|
my ( %tmp, $tmp ); |
287
|
|
|
|
|
|
|
|
288
|
0
|
0
|
|
|
|
0
|
@_ == 1 |
289
|
|
|
|
|
|
|
or Hydrogen::croak( |
290
|
|
|
|
|
|
|
"Wrong number of parameters in signature for %s: got %d, %s", |
291
|
|
|
|
|
|
|
"ge", scalar(@_), "expected exactly 1 parameters" ); |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
# Parameter $_[0] (type: Num) |
294
|
|
|
|
|
|
|
( |
295
|
0
|
0
|
|
|
|
0
|
do { |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
298
|
2
|
|
|
2
|
|
14
|
use Scalar::Util (); |
|
2
|
|
|
|
|
20
|
|
|
2
|
|
|
|
|
365
|
|
299
|
0
|
0
|
0
|
|
|
0
|
defined( $_[0] ) |
300
|
|
|
|
|
|
|
&& !ref( $_[0] ) |
301
|
|
|
|
|
|
|
&& Scalar::Util::looks_like_number( $_[0] ); |
302
|
|
|
|
|
|
|
} |
303
|
|
|
|
|
|
|
) |
304
|
|
|
|
|
|
|
or Hydrogen::croak( |
305
|
|
|
|
|
|
|
"Type check failed in signature for ge: %s should be %s", |
306
|
|
|
|
|
|
|
"\$_[0]", "Num" ); |
307
|
|
|
|
|
|
|
|
308
|
0
|
|
|
|
|
0
|
(@_); |
309
|
|
|
|
|
|
|
}; |
310
|
0
|
|
|
|
|
0
|
$_ >= $_[0]; |
311
|
|
|
|
|
|
|
} |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
=head2 C<< get() >> |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
Operates on C<< $_ >>, which must be a numeric scalar. |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
Returns the current value of the number. |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=cut |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
sub get { |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
324
|
1
|
50
|
|
1
|
1
|
8434
|
@_ == 0 |
325
|
|
|
|
|
|
|
or Hydrogen::croak( "Wrong number of parameters for get; usage: " |
326
|
|
|
|
|
|
|
. "Hydrogen::Topic::Number::get()" ); |
327
|
1
|
|
|
|
|
4
|
$_; |
328
|
|
|
|
|
|
|
} |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
=head2 C<< gt( $num ) >> |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
Operates on C<< $_ >>, which must be a numeric scalar. |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
Arguments: B<< Num >>. |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
Returns C<< $_ > $num >>. |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
=cut |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
sub gt { |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
343
|
0
|
|
|
0
|
1
|
0
|
@_ = do { |
344
|
0
|
|
|
|
|
0
|
my ( %tmp, $tmp ); |
345
|
|
|
|
|
|
|
|
346
|
0
|
0
|
|
|
|
0
|
@_ == 1 |
347
|
|
|
|
|
|
|
or Hydrogen::croak( |
348
|
|
|
|
|
|
|
"Wrong number of parameters in signature for %s: got %d, %s", |
349
|
|
|
|
|
|
|
"gt", scalar(@_), "expected exactly 1 parameters" ); |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
# Parameter $_[0] (type: Num) |
352
|
|
|
|
|
|
|
( |
353
|
0
|
0
|
|
|
|
0
|
do { |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
356
|
2
|
|
|
2
|
|
19
|
use Scalar::Util (); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
330
|
|
357
|
0
|
0
|
0
|
|
|
0
|
defined( $_[0] ) |
358
|
|
|
|
|
|
|
&& !ref( $_[0] ) |
359
|
|
|
|
|
|
|
&& Scalar::Util::looks_like_number( $_[0] ); |
360
|
|
|
|
|
|
|
} |
361
|
|
|
|
|
|
|
) |
362
|
|
|
|
|
|
|
or Hydrogen::croak( |
363
|
|
|
|
|
|
|
"Type check failed in signature for gt: %s should be %s", |
364
|
|
|
|
|
|
|
"\$_[0]", "Num" ); |
365
|
|
|
|
|
|
|
|
366
|
0
|
|
|
|
|
0
|
(@_); |
367
|
|
|
|
|
|
|
}; |
368
|
0
|
|
|
|
|
0
|
$_ > $_[0]; |
369
|
|
|
|
|
|
|
} |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=head2 C<< le( $num ) >> |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
Operates on C<< $_ >>, which must be a numeric scalar. |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
Arguments: B<< Num >>. |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
Returns C<< $_ <= $num >>. |
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
=cut |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
sub le { |
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
384
|
0
|
|
|
0
|
1
|
0
|
@_ = do { |
385
|
0
|
|
|
|
|
0
|
my ( %tmp, $tmp ); |
386
|
|
|
|
|
|
|
|
387
|
0
|
0
|
|
|
|
0
|
@_ == 1 |
388
|
|
|
|
|
|
|
or Hydrogen::croak( |
389
|
|
|
|
|
|
|
"Wrong number of parameters in signature for %s: got %d, %s", |
390
|
|
|
|
|
|
|
"le", scalar(@_), "expected exactly 1 parameters" ); |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
# Parameter $_[0] (type: Num) |
393
|
|
|
|
|
|
|
( |
394
|
0
|
0
|
|
|
|
0
|
do { |
395
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
397
|
2
|
|
|
2
|
|
14
|
use Scalar::Util (); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
283
|
|
398
|
0
|
0
|
0
|
|
|
0
|
defined( $_[0] ) |
399
|
|
|
|
|
|
|
&& !ref( $_[0] ) |
400
|
|
|
|
|
|
|
&& Scalar::Util::looks_like_number( $_[0] ); |
401
|
|
|
|
|
|
|
} |
402
|
|
|
|
|
|
|
) |
403
|
|
|
|
|
|
|
or Hydrogen::croak( |
404
|
|
|
|
|
|
|
"Type check failed in signature for le: %s should be %s", |
405
|
|
|
|
|
|
|
"\$_[0]", "Num" ); |
406
|
|
|
|
|
|
|
|
407
|
0
|
|
|
|
|
0
|
(@_); |
408
|
|
|
|
|
|
|
}; |
409
|
0
|
|
|
|
|
0
|
$_ <= $_[0]; |
410
|
|
|
|
|
|
|
} |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
=head2 C<< lt( $num ) >> |
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
Operates on C<< $_ >>, which must be a numeric scalar. |
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
Arguments: B<< Num >>. |
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
Returns C<< $_ < $num >>. |
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
=cut |
421
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
sub lt { |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
425
|
0
|
|
|
0
|
1
|
0
|
@_ = do { |
426
|
0
|
|
|
|
|
0
|
my ( %tmp, $tmp ); |
427
|
|
|
|
|
|
|
|
428
|
0
|
0
|
|
|
|
0
|
@_ == 1 |
429
|
|
|
|
|
|
|
or Hydrogen::croak( |
430
|
|
|
|
|
|
|
"Wrong number of parameters in signature for %s: got %d, %s", |
431
|
|
|
|
|
|
|
"lt", scalar(@_), "expected exactly 1 parameters" ); |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
# Parameter $_[0] (type: Num) |
434
|
|
|
|
|
|
|
( |
435
|
0
|
0
|
|
|
|
0
|
do { |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
438
|
2
|
|
|
2
|
|
28
|
use Scalar::Util (); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
284
|
|
439
|
0
|
0
|
0
|
|
|
0
|
defined( $_[0] ) |
440
|
|
|
|
|
|
|
&& !ref( $_[0] ) |
441
|
|
|
|
|
|
|
&& Scalar::Util::looks_like_number( $_[0] ); |
442
|
|
|
|
|
|
|
} |
443
|
|
|
|
|
|
|
) |
444
|
|
|
|
|
|
|
or Hydrogen::croak( |
445
|
|
|
|
|
|
|
"Type check failed in signature for lt: %s should be %s", |
446
|
|
|
|
|
|
|
"\$_[0]", "Num" ); |
447
|
|
|
|
|
|
|
|
448
|
0
|
|
|
|
|
0
|
(@_); |
449
|
|
|
|
|
|
|
}; |
450
|
0
|
|
|
|
|
0
|
$_ < $_[0]; |
451
|
|
|
|
|
|
|
} |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
=head2 C<< mod( $divisor ) >> |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
Operates on C<< $_ >>, which must be a numeric scalar. |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
Arguments: B<< Num >>. |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
Finds the current number modulo a divisor, updating the original value. |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
=cut |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
sub mod { |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
466
|
1
|
|
|
1
|
1
|
10537
|
@_ = do { |
467
|
1
|
|
|
|
|
4
|
my ( %tmp, $tmp ); |
468
|
|
|
|
|
|
|
|
469
|
1
|
50
|
|
|
|
4
|
@_ == 1 |
470
|
|
|
|
|
|
|
or Hydrogen::croak( |
471
|
|
|
|
|
|
|
"Wrong number of parameters in signature for %s: got %d, %s", |
472
|
|
|
|
|
|
|
"mod", scalar(@_), "expected exactly 1 parameters" ); |
473
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
# Parameter $_[0] (type: Num) |
475
|
|
|
|
|
|
|
( |
476
|
1
|
50
|
|
|
|
2
|
do { |
477
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
479
|
2
|
|
|
2
|
|
13
|
use Scalar::Util (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
198
|
|
480
|
1
|
50
|
33
|
|
|
21
|
defined( $_[0] ) |
481
|
|
|
|
|
|
|
&& !ref( $_[0] ) |
482
|
|
|
|
|
|
|
&& Scalar::Util::looks_like_number( $_[0] ); |
483
|
|
|
|
|
|
|
} |
484
|
|
|
|
|
|
|
) |
485
|
|
|
|
|
|
|
or Hydrogen::croak( |
486
|
|
|
|
|
|
|
"Type check failed in signature for mod: %s should be %s", |
487
|
|
|
|
|
|
|
"\$_[0]", "Num" ); |
488
|
|
|
|
|
|
|
|
489
|
1
|
|
|
|
|
5
|
(@_); |
490
|
|
|
|
|
|
|
}; |
491
|
|
|
|
|
|
|
( |
492
|
1
|
|
|
|
|
1
|
$_ = do { |
493
|
1
|
|
|
|
|
5
|
my $shv_final_unchecked = $_ % $_[0]; |
494
|
1
|
|
|
|
|
2
|
do { |
495
|
|
|
|
|
|
|
( |
496
|
1
|
50
|
|
|
|
3
|
do { |
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
499
|
2
|
|
|
2
|
|
12
|
use Scalar::Util (); |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
285
|
|
500
|
1
|
50
|
33
|
|
|
11
|
defined($shv_final_unchecked) |
501
|
|
|
|
|
|
|
&& !ref($shv_final_unchecked) |
502
|
|
|
|
|
|
|
&& Scalar::Util::looks_like_number( |
503
|
|
|
|
|
|
|
$shv_final_unchecked); |
504
|
|
|
|
|
|
|
} |
505
|
|
|
|
|
|
|
) |
506
|
|
|
|
|
|
|
or Hydrogen::croak( |
507
|
|
|
|
|
|
|
"Type check failed for mod: expected %s, got value %s", |
508
|
|
|
|
|
|
|
"Num", $shv_final_unchecked ); |
509
|
1
|
|
|
|
|
3
|
$shv_final_unchecked; |
510
|
|
|
|
|
|
|
}; |
511
|
|
|
|
|
|
|
} |
512
|
|
|
|
|
|
|
); |
513
|
|
|
|
|
|
|
} |
514
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
=head2 C<< mul( $factor ) >> |
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
Operates on C<< $_ >>, which must be a numeric scalar. |
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
Arguments: B<< Num >>. |
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
Multiplies the existing number by a number, updating the original value. |
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
=cut |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
sub mul { |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
528
|
1
|
|
|
1
|
1
|
3527
|
@_ = do { |
529
|
1
|
|
|
|
|
2
|
my ( %tmp, $tmp ); |
530
|
|
|
|
|
|
|
|
531
|
1
|
50
|
|
|
|
5
|
@_ == 1 |
532
|
|
|
|
|
|
|
or Hydrogen::croak( |
533
|
|
|
|
|
|
|
"Wrong number of parameters in signature for %s: got %d, %s", |
534
|
|
|
|
|
|
|
"mul", scalar(@_), "expected exactly 1 parameters" ); |
535
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
# Parameter $_[0] (type: Num) |
537
|
|
|
|
|
|
|
( |
538
|
1
|
50
|
|
|
|
2
|
do { |
539
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
541
|
2
|
|
|
2
|
|
13
|
use Scalar::Util (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
185
|
|
542
|
1
|
50
|
33
|
|
|
23
|
defined( $_[0] ) |
543
|
|
|
|
|
|
|
&& !ref( $_[0] ) |
544
|
|
|
|
|
|
|
&& Scalar::Util::looks_like_number( $_[0] ); |
545
|
|
|
|
|
|
|
} |
546
|
|
|
|
|
|
|
) |
547
|
|
|
|
|
|
|
or Hydrogen::croak( |
548
|
|
|
|
|
|
|
"Type check failed in signature for mul: %s should be %s", |
549
|
|
|
|
|
|
|
"\$_[0]", "Num" ); |
550
|
|
|
|
|
|
|
|
551
|
1
|
|
|
|
|
9
|
(@_); |
552
|
|
|
|
|
|
|
}; |
553
|
|
|
|
|
|
|
( |
554
|
1
|
|
|
|
|
3
|
$_ = do { |
555
|
1
|
|
|
|
|
3
|
my $shv_final_unchecked = $_ * $_[0]; |
556
|
1
|
|
|
|
|
2
|
do { |
557
|
|
|
|
|
|
|
( |
558
|
1
|
50
|
|
|
|
2
|
do { |
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
561
|
2
|
|
|
2
|
|
13
|
use Scalar::Util (); |
|
2
|
|
|
|
|
22
|
|
|
2
|
|
|
|
|
365
|
|
562
|
1
|
50
|
33
|
|
|
10
|
defined($shv_final_unchecked) |
563
|
|
|
|
|
|
|
&& !ref($shv_final_unchecked) |
564
|
|
|
|
|
|
|
&& Scalar::Util::looks_like_number( |
565
|
|
|
|
|
|
|
$shv_final_unchecked); |
566
|
|
|
|
|
|
|
} |
567
|
|
|
|
|
|
|
) |
568
|
|
|
|
|
|
|
or Hydrogen::croak( |
569
|
|
|
|
|
|
|
"Type check failed for mul: expected %s, got value %s", |
570
|
|
|
|
|
|
|
"Num", $shv_final_unchecked ); |
571
|
1
|
|
|
|
|
3
|
$shv_final_unchecked; |
572
|
|
|
|
|
|
|
}; |
573
|
|
|
|
|
|
|
} |
574
|
|
|
|
|
|
|
); |
575
|
|
|
|
|
|
|
} |
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
=head2 C<< ne( $num ) >> |
578
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
Operates on C<< $_ >>, which must be a numeric scalar. |
580
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
Arguments: B<< Num >>. |
582
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
Returns C<< $_ != $num >>. |
584
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
=cut |
586
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
sub ne { |
588
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
590
|
0
|
|
|
0
|
1
|
0
|
@_ = do { |
591
|
0
|
|
|
|
|
0
|
my ( %tmp, $tmp ); |
592
|
|
|
|
|
|
|
|
593
|
0
|
0
|
|
|
|
0
|
@_ == 1 |
594
|
|
|
|
|
|
|
or Hydrogen::croak( |
595
|
|
|
|
|
|
|
"Wrong number of parameters in signature for %s: got %d, %s", |
596
|
|
|
|
|
|
|
"ne", scalar(@_), "expected exactly 1 parameters" ); |
597
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
# Parameter $_[0] (type: Num) |
599
|
|
|
|
|
|
|
( |
600
|
0
|
0
|
|
|
|
0
|
do { |
601
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
603
|
2
|
|
|
2
|
|
14
|
use Scalar::Util (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
287
|
|
604
|
0
|
0
|
0
|
|
|
0
|
defined( $_[0] ) |
605
|
|
|
|
|
|
|
&& !ref( $_[0] ) |
606
|
|
|
|
|
|
|
&& Scalar::Util::looks_like_number( $_[0] ); |
607
|
|
|
|
|
|
|
} |
608
|
|
|
|
|
|
|
) |
609
|
|
|
|
|
|
|
or Hydrogen::croak( |
610
|
|
|
|
|
|
|
"Type check failed in signature for ne: %s should be %s", |
611
|
|
|
|
|
|
|
"\$_[0]", "Num" ); |
612
|
|
|
|
|
|
|
|
613
|
0
|
|
|
|
|
0
|
(@_); |
614
|
|
|
|
|
|
|
}; |
615
|
0
|
|
|
|
|
0
|
$_ != $_[0]; |
616
|
|
|
|
|
|
|
} |
617
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
=head2 C<< set( $value ) >> |
619
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
Operates on C<< $_ >>, which must be a numeric scalar. |
621
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
Arguments: B<< Num >>. |
623
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
Sets the number to a new value. |
625
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
=cut |
627
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
sub set { |
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
631
|
1
|
|
|
1
|
1
|
5813
|
@_ = do { |
632
|
1
|
|
|
|
|
3
|
my ( %tmp, $tmp ); |
633
|
|
|
|
|
|
|
|
634
|
1
|
50
|
|
|
|
5
|
@_ == 1 |
635
|
|
|
|
|
|
|
or Hydrogen::croak( |
636
|
|
|
|
|
|
|
"Wrong number of parameters in signature for %s: got %d, %s", |
637
|
|
|
|
|
|
|
"set", scalar(@_), "expected exactly 1 parameters" ); |
638
|
|
|
|
|
|
|
|
639
|
|
|
|
|
|
|
# Parameter $_[0] (type: Num) |
640
|
|
|
|
|
|
|
( |
641
|
1
|
50
|
|
|
|
3
|
do { |
642
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
644
|
2
|
|
|
2
|
|
15
|
use Scalar::Util (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
176
|
|
645
|
1
|
50
|
33
|
|
|
11
|
defined( $_[0] ) |
646
|
|
|
|
|
|
|
&& !ref( $_[0] ) |
647
|
|
|
|
|
|
|
&& Scalar::Util::looks_like_number( $_[0] ); |
648
|
|
|
|
|
|
|
} |
649
|
|
|
|
|
|
|
) |
650
|
|
|
|
|
|
|
or Hydrogen::croak( |
651
|
|
|
|
|
|
|
"Type check failed in signature for set: %s should be %s", |
652
|
|
|
|
|
|
|
"\$_[0]", "Num" ); |
653
|
|
|
|
|
|
|
|
654
|
1
|
|
|
|
|
5
|
(@_); |
655
|
|
|
|
|
|
|
}; |
656
|
|
|
|
|
|
|
( |
657
|
1
|
|
|
|
|
36
|
$_ = do { |
658
|
1
|
|
|
|
|
3
|
my $shv_final_unchecked = $_[0]; |
659
|
1
|
|
|
|
|
20
|
do { |
660
|
|
|
|
|
|
|
( |
661
|
1
|
50
|
|
|
|
4
|
do { |
662
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
664
|
2
|
|
|
2
|
|
22
|
use Scalar::Util (); |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
285
|
|
665
|
1
|
50
|
33
|
|
|
11
|
defined($shv_final_unchecked) |
666
|
|
|
|
|
|
|
&& !ref($shv_final_unchecked) |
667
|
|
|
|
|
|
|
&& Scalar::Util::looks_like_number( |
668
|
|
|
|
|
|
|
$shv_final_unchecked); |
669
|
|
|
|
|
|
|
} |
670
|
|
|
|
|
|
|
) |
671
|
|
|
|
|
|
|
or Hydrogen::croak( |
672
|
|
|
|
|
|
|
"Type check failed for set: expected %s, got value %s", |
673
|
|
|
|
|
|
|
"Num", $shv_final_unchecked ); |
674
|
1
|
|
|
|
|
5
|
$shv_final_unchecked; |
675
|
|
|
|
|
|
|
}; |
676
|
|
|
|
|
|
|
} |
677
|
|
|
|
|
|
|
); |
678
|
|
|
|
|
|
|
} |
679
|
|
|
|
|
|
|
|
680
|
|
|
|
|
|
|
=head2 C<< sub( $subtrahend ) >> |
681
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
Operates on C<< $_ >>, which must be a numeric scalar. |
683
|
|
|
|
|
|
|
|
684
|
|
|
|
|
|
|
Arguments: B<< Num >>. |
685
|
|
|
|
|
|
|
|
686
|
|
|
|
|
|
|
Subtracts a number from the existing number, updating the original value. |
687
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
=cut |
689
|
|
|
|
|
|
|
|
690
|
|
|
|
|
|
|
sub sub { |
691
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
693
|
1
|
|
|
1
|
1
|
3497
|
@_ = do { |
694
|
1
|
|
|
|
|
3
|
my ( %tmp, $tmp ); |
695
|
|
|
|
|
|
|
|
696
|
1
|
50
|
|
|
|
4
|
@_ == 1 |
697
|
|
|
|
|
|
|
or Hydrogen::croak( |
698
|
|
|
|
|
|
|
"Wrong number of parameters in signature for %s: got %d, %s", |
699
|
|
|
|
|
|
|
"sub", scalar(@_), "expected exactly 1 parameters" ); |
700
|
|
|
|
|
|
|
|
701
|
|
|
|
|
|
|
# Parameter $_[0] (type: Num) |
702
|
|
|
|
|
|
|
( |
703
|
1
|
50
|
|
|
|
2
|
do { |
704
|
|
|
|
|
|
|
|
705
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
706
|
2
|
|
|
2
|
|
14
|
use Scalar::Util (); |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
181
|
|
707
|
1
|
50
|
33
|
|
|
12
|
defined( $_[0] ) |
708
|
|
|
|
|
|
|
&& !ref( $_[0] ) |
709
|
|
|
|
|
|
|
&& Scalar::Util::looks_like_number( $_[0] ); |
710
|
|
|
|
|
|
|
} |
711
|
|
|
|
|
|
|
) |
712
|
|
|
|
|
|
|
or Hydrogen::croak( |
713
|
|
|
|
|
|
|
"Type check failed in signature for sub: %s should be %s", |
714
|
|
|
|
|
|
|
"\$_[0]", "Num" ); |
715
|
|
|
|
|
|
|
|
716
|
1
|
|
|
|
|
4
|
(@_); |
717
|
|
|
|
|
|
|
}; |
718
|
|
|
|
|
|
|
( |
719
|
1
|
|
|
|
|
2
|
$_ = do { |
720
|
1
|
|
|
|
|
4
|
my $shv_final_unchecked = $_ - $_[0]; |
721
|
1
|
|
|
|
|
1
|
do { |
722
|
|
|
|
|
|
|
( |
723
|
1
|
50
|
|
|
|
2
|
do { |
724
|
|
|
|
|
|
|
|
725
|
|
|
|
|
|
|
package Hydrogen::Number::__SANDBOX__; |
726
|
2
|
|
|
2
|
|
16
|
use Scalar::Util (); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
194
|
|
727
|
1
|
50
|
33
|
|
|
28
|
defined($shv_final_unchecked) |
728
|
|
|
|
|
|
|
&& !ref($shv_final_unchecked) |
729
|
|
|
|
|
|
|
&& Scalar::Util::looks_like_number( |
730
|
|
|
|
|
|
|
$shv_final_unchecked); |
731
|
|
|
|
|
|
|
} |
732
|
|
|
|
|
|
|
) |
733
|
|
|
|
|
|
|
or Hydrogen::croak( |
734
|
|
|
|
|
|
|
"Type check failed for sub: expected %s, got value %s", |
735
|
|
|
|
|
|
|
"Num", $shv_final_unchecked ); |
736
|
1
|
|
|
|
|
5
|
$shv_final_unchecked; |
737
|
|
|
|
|
|
|
}; |
738
|
|
|
|
|
|
|
} |
739
|
|
|
|
|
|
|
); |
740
|
|
|
|
|
|
|
} |
741
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
1; |
743
|
|
|
|
|
|
|
|
744
|
|
|
|
|
|
|
=head1 EXPORT |
745
|
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
No functions are exported by this module by default. To import them all (this is usually a bad idea), use: |
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
use Hydrogen::Topic::Number -all; |
749
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
To import a particular function, use: |
751
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
use Hydrogen::Topic::Number 'cmp'; |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
To rename functions: |
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
use Hydrogen::Topic::Number 'cmp' => { -as => 'myfunc' }; |
757
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
On Perl 5.37.2+, you can import lexically: |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
use Hydrogen::Topic::Number -lexical, 'cmp'; |
761
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
See L for more hints on importing. |
763
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
=head1 BUGS |
765
|
|
|
|
|
|
|
|
766
|
|
|
|
|
|
|
Please report any bugs to |
767
|
|
|
|
|
|
|
L. |
768
|
|
|
|
|
|
|
|
769
|
|
|
|
|
|
|
=head1 SEE ALSO |
770
|
|
|
|
|
|
|
|
771
|
|
|
|
|
|
|
L, |
772
|
|
|
|
|
|
|
L, |
773
|
|
|
|
|
|
|
L, |
774
|
|
|
|
|
|
|
L. |
775
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
=head1 AUTHOR |
777
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
Toby Inkster Etobyink@cpan.orgE. |
779
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
781
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
This software is copyright (c) 2022 by Toby Inkster. |
783
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
785
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
786
|
|
|
|
|
|
|
|
787
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTIES |
788
|
|
|
|
|
|
|
|
789
|
|
|
|
|
|
|
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
790
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
791
|
|
|
|
|
|
|
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
792
|
|
|
|
|
|
|
|