blib/lib/Venus/Role/Comparable.pm

filter: Statementstmt 86.3% 76 / 88 Branchbran 75.6% 56 / 74 Conditioncond 71.4% 15 / 21 MC/DCmcdc 0.0% 0 / 14 Subroutinesub 100% 16 / 16 Podpod 91.6% 11 / 12 totaltotal 77.3% 174 / 225 SCAR 41.0
CC
45
Cov
80%
lt
18.1
gt
14.9
eq
10.8
CRAP 60.4
« blib/lib/Venus/Space.pm ↑ Summary blib/lib/Venus/Log.pm »
1 package Venus::Role::Comparable;
2  
3 96 ▶use 5.018;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 96 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 96 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 96 ▶use Venus::Role 'with';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 96 require Scalar::Util;
11 96 require Venus::Type;
12  
13 # METHODS
14  
15 sub eq {
16 440 ▶ my ($self, $data) = @_;
Subroutine eq: called CC=10 SCAR=23.8
Pod documented
17  
18 440 $data = Venus::Type->new(value => $data)->deduce;
19  
20 440 ▶ if (Scalar::Util::refaddr($self) eq Scalar::Util::refaddr($data)) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::refaddr($self) eq builtin::refaddr($data)) 2 438 440
21 2 return true;
22 }
23 438 ▶ if (Scalar::Util::blessed($data) && !$data->isa('Venus::Kind')) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($data) and not $data->isa("Venus::Kind")) 0 438 438
Condition33%1/3
builtin::blessed($data) and not $data->isa("Venus::Kind")
!ll&&!rl&&r
04380
MC/DC0%0/2
builtin::blessed($data) and not $data->isa("Venus::Kind")
builtin::blessed($data) not $data->isa("Venus::Kind")
Truth table33%1/3
A and not(B)
A= builtin::blessed($data)B= not $data->isa("Venus::Kind")
ABresult
0X0
100
111
24 0 return false;
25 }
26 438 ▶ if ($self->comparer('eq') eq 'numified') {
Branch: 3 branches
BranchTrueFalseTotal
if ($self->comparer('eq') eq 'numified') { } 186 252 438
elsif ($self->comparer('eq') eq 'stringified') { } 80 172 252
elsif (my $method = $self->comparer('eq')) { } 172 0 172
27 186 ▶ return $self->numified == $data->numified ? true : false;
Branch: 1 branch
BranchTrueFalseTotal
$self->numified == $data->numified ? : 106 80 186
28 }
29 elsif ($self->comparer('eq') eq 'stringified') {
30 80 ▶ return $self->stringified eq $data->stringified ? true : false;
Branch: 1 branch
BranchTrueFalseTotal
$self->stringified eq $data->stringified ? : 19 61 80
31 }
32 elsif (my $method = $self->comparer('eq')) {
33 172 ▶ return $self->$method eq $data->$method ? true : false;
Branch: 1 branch
BranchTrueFalseTotal
$self->$method eq $data->$method ? : 25 147 172
34 }
35 else {
36 0 return false;
37 }
38 }
39  
40 sub ge {
41 187 ▶ my ($self, $data) = @_;
Subroutine ge: called CC=3 SCAR=11.0
Pod documented
42  
43 187 ▶ if ($self->gt($data) || $self->eq($data)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->gt($data) or $self->eq($data)) { } 102 85 187
Condition100%3/3
$self->gt($data) or $self->eq($data)
l!l&&r!l&&!r
544885
MC/DC0%0/2
$self->gt($data) or $self->eq($data)
$self->gt($data) $self->eq($data)
Truth table33%1/3
A or B
A= $self->gt($data)B= $self->eq($data)
ABresult
1X1
011
000
44 102 return true;
45 }
46 else {
47 85 return false;
48 }
49 }
50  
51 sub gele {
52 94 ▶ my ($self, $ge, $le) = @_;
Subroutine gele: called CC=3 SCAR=11.0
Pod documented
53  
54 94 ▶ if ($self->ge($ge) && $self->le($le)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->ge($ge) and $self->le($le)) { } 21 73 94
Condition100%3/3
$self->ge($ge) and $self->le($le)
!ll&&!rl&&r
423121
MC/DC0%0/2
$self->ge($ge) and $self->le($le)
$self->ge($ge) $self->le($le)
Truth table33%1/3
A and B
A= $self->ge($ge)B= $self->le($le)
ABresult
0X0
100
111
55 21 return true;
56 }
57 else {
58 73 return false;
59 }
60 }
61  
62 sub gt {
63 388 ▶ my ($self, $data) = @_;
Subroutine gt: called CC=10 SCAR=27.0
Pod documented
64  
65 388 $data = Venus::Type->new(value => $data)->deduce;
66  
67 388 ▶ if (Scalar::Util::refaddr($self) eq Scalar::Util::refaddr($data)) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::refaddr($self) eq builtin::refaddr($data)) 1 387 388
68 1 return false;
69 }
70 387 ▶ if (Scalar::Util::blessed($data) && !$data->isa('Venus::Kind')) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($data) and not $data->isa("Venus::Kind")) 0 387 387
Condition33%1/3
builtin::blessed($data) and not $data->isa("Venus::Kind")
!ll&&!rl&&r
03870
MC/DC0%0/2
builtin::blessed($data) and not $data->isa("Venus::Kind")
builtin::blessed($data) not $data->isa("Venus::Kind")
Truth table33%1/3
A and not(B)
A= builtin::blessed($data)B= not $data->isa("Venus::Kind")
ABresult
0X0
100
111
71 0 return false;
72 }
73 387 ▶ if ($self->comparer('gt') eq 'numified') {
Branch: 3 branches
BranchTrueFalseTotal
if ($self->comparer('gt') eq 'numified') { } 315 72 387
elsif ($self->comparer('gt') eq 'stringified') { } 72 0 72
elsif (my $method = $self->comparer('gt')) { } 0 0 0
74 315 ▶ return $self->numified > $data->numified ? true : false;
Branch: 1 branch
BranchTrueFalseTotal
$self->numified > $data->numified ? : 92 223 315
75 }
76 elsif ($self->comparer('gt') eq 'stringified') {
77 72 ▶ return $self->stringified gt $data->stringified ? true : false;
Branch: 1 branch
BranchTrueFalseTotal
$self->stringified gt $data->stringified ? : 24 48 72
78 }
79 elsif (my $method = $self->comparer('gt')) {
80 0 ▶ return $self->$method gt $data->$method ? true : false;
Branch: 1 branch
BranchTrueFalseTotal
$self->$method gt $data->$method ? : 0 0 0
81 }
82 else {
83 0 return false;
84 }
85 }
86  
87 sub gtlt {
88 94 ▶ my ($self, $gt, $lt) = @_;
Subroutine gtlt: called CC=3 SCAR=11.0
Pod documented
89  
90 94 ▶ if ($self->gt($gt) && $self->lt($lt)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->gt($gt) and $self->lt($lt)) { } 2 92 94
Condition100%3/3
$self->gt($gt) and $self->lt($lt)
!ll&&!rl&&r
66262
MC/DC0%0/2
$self->gt($gt) and $self->lt($lt)
$self->gt($gt) $self->lt($lt)
Truth table33%1/3
A and B
A= $self->gt($gt)B= $self->lt($lt)
ABresult
0X0
100
111
91 2 return true;
92 }
93 else {
94 92 return false;
95 }
96 }
97  
98 sub is {
99 3 ▶ my ($self, $data) = @_;
Subroutine is: called CC=3 SCAR=11.2
Pod documented
100  
101 3 ▶ if (!ref $data) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $data) 0 3 3
102 0 return false;
103 }
104 3 ▶ if (Scalar::Util::refaddr($self) eq Scalar::Util::refaddr($data)) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::refaddr($self) eq builtin::refaddr($data)) { } 1 2 3
105 1 return true;
106 }
107 else {
108 2 return false;
109 }
110 }
111  
112 sub lt {
113 268 ▶ my ($self, $data) = @_;
Subroutine lt: called CC=10 SCAR=29.0
Pod documented
114  
115 268 $data = Venus::Type->new(value => $data)->deduce;
116  
117 268 ▶ if (Scalar::Util::refaddr($self) eq Scalar::Util::refaddr($data)) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::refaddr($self) eq builtin::refaddr($data)) 0 268 268
118 0 return false;
119 }
120 268 ▶ if (Scalar::Util::blessed($data) && !$data->isa('Venus::Kind')) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($data) and not $data->isa("Venus::Kind")) 0 268 268
Condition33%1/3
builtin::blessed($data) and not $data->isa("Venus::Kind")
!ll&&!rl&&r
02680
MC/DC0%0/2
builtin::blessed($data) and not $data->isa("Venus::Kind")
builtin::blessed($data) not $data->isa("Venus::Kind")
Truth table33%1/3
A and not(B)
A= builtin::blessed($data)B= not $data->isa("Venus::Kind")
ABresult
0X0
100
111
121 0 return false;
122 }
123 268 ▶ if ($self->comparer('lt') eq 'numified') {
Branch: 3 branches
BranchTrueFalseTotal
if ($self->comparer('lt') eq 'numified') { } 217 51 268
elsif ($self->comparer('lt') eq 'stringified') { } 51 0 51
elsif (my $method = $self->comparer('lt')) { } 0 0 0
124 217 ▶ return $self->numified < $data->numified ? true : false;
Branch: 1 branch
BranchTrueFalseTotal
$self->numified < $data->numified ? : 60 157 217
125 }
126 elsif ($self->comparer('lt') eq 'stringified') {
127 51 ▶ return $self->stringified lt $data->stringified ? true : false;
Branch: 1 branch
BranchTrueFalseTotal
$self->stringified lt $data->stringified ? : 18 33 51
128 }
129 elsif (my $method = $self->comparer('lt')) {
130 0 ▶ return $self->$method lt $data->$method ? true : false;
Branch: 1 branch
BranchTrueFalseTotal
$self->$method lt $data->$method ? : 0 0 0
131 }
132 else {
133 0 return false;
134 }
135 }
136  
137 sub le {
138 146 ▶ my ($self, $data) = @_;
Subroutine le: called CC=3 SCAR=11.0
Pod documented
139  
140 146 ▶ if ($self->lt($data) || $self->eq($data)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->lt($data) or $self->eq($data)) { } 82 64 146
Condition100%3/3
$self->lt($data) or $self->eq($data)
l!l&&r!l&&!r
394364
MC/DC0%0/2
$self->lt($data) or $self->eq($data)
$self->lt($data) $self->eq($data)
Truth table33%1/3
A or B
A= $self->lt($data)B= $self->eq($data)
ABresult
1X1
011
000
141 82 return true;
142 }
143 else {
144 64 return false;
145 }
146 }
147  
148 sub ne {
149 94 ▶ my ($self, $data) = @_;
Subroutine ne: called CC=2 SCAR=6.9
Pod documented
150  
151 94 ▶ return $self->eq($data) ? false : true;
Branch: 1 branch
BranchTrueFalseTotal
$self->eq($data) ? : 24 70 94
152 }
153  
154 sub st {
155 4 ▶ my ($self, $data) = @_;
Subroutine st: called CC=4 SCAR=14.0
Pod documented
156  
157 4 ▶ if (!Scalar::Util::blessed($data)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (builtin::blessed($data)) 0 4 4
158 0 return false;
159 }
160 4 ▶ if (Scalar::Util::refaddr($self) eq Scalar::Util::refaddr($data)) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::refaddr($self) eq builtin::refaddr($data)) 1 3 4
161 1 return true;
162 }
163 3 ▶ if ($data->isa($self->class)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($data->isa($self->class)) { } 1 2 3
164 1 return true;
165 }
166 else {
167 2 return false;
168 }
169 }
170  
171 sub tv {
172 95 ▶ my ($self, $data) = @_;
Subroutine tv: called CC=4 SCAR=14.0
Pod documented
173  
174 95 ▶ if (!Scalar::Util::blessed($data)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (builtin::blessed($data)) 0 95 95
175 0 return false;
176 }
177 95 ▶ if (Scalar::Util::refaddr($self) eq Scalar::Util::refaddr($data)) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::refaddr($self) eq builtin::refaddr($data)) 1 94 95
178 1 return true;
179 }
180 94 ▶ if ($data->isa($self->class)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($data->isa($self->class)) { } 12 82 94
181 12 return $self->eq($data);
182 }
183 else {
184 82 return false;
185 }
186 }
187  
188 # EXPORTS
189  
190 sub EXPORT {
191 97 ▶ ['eq', 'ge', 'gele', 'gt', 'gtlt', 'is', 'lt', 'le', 'ne', 'st', 'tv']
Subroutine EXPORT: called CC=1 SCAR=0.0
Pod undocumented
192 }
193  
194 96 1;
195  
196  
197  
198 =head1 NAME
199  
200 Venus::Role::Comparable - Comparable Role
201  
202 =cut
203  
204 =head1 ABSTRACT
205  
206 Comparable Role for Perl 5
207  
208 =cut
209  
210 =head1 SYNOPSIS
211  
212 package Example;
213  
214 use Venus::Class;
215  
216 base 'Venus::Kind';
217  
218 with 'Venus::Role::Comparable';
219  
220 sub numified {
221 return 2;
222 }
223  
224 package main;
225  
226 my $example = Example->new;
227  
228 # my $result = $example->eq(2);
229  
230 =cut
231  
232 =head1 DESCRIPTION
233  
234 This package modifies the consuming package and provides methods for performing
235 numerical and stringwise comparision operations or any object or raw data type.
236  
237 =cut
238  
239 =head1 METHODS
240  
241 This package provides the following methods:
242  
243 =cut
244  
245 =head2 eq
246  
247 eq(any $arg) (boolean)
248  
249 The eq method performs an I<"equals"> operation using the invocant and the
250 argument provided. The operation will be performed as either a numerical or
251 stringwise operation based upon the preference (i.e. the return value of the
252 L</comparer> method) of the invocant.
253  
254 I<Since C<0.08>>
255  
256 =over 4
257  
258 =item eq example 1
259  
260 package main;
261  
262 my $example = Example->new;
263  
264 my $result = $example->eq($example);
265  
266 # 1
267  
268 =back
269  
270 =over 4
271  
272 =item eq example 2
273  
274 package main;
275  
276 my $example = Example->new;
277  
278 my $result = $example->eq([1,2]);
279  
280 # 0
281  
282 =back
283  
284 =over 4
285  
286 =item eq example 3
287  
288 package main;
289  
290 my $example = Example->new;
291  
292 my $result = $example->eq({1..4});
293  
294 # 0
295  
296 =back
297  
298 =cut
299  
300 =head2 ge
301  
302 ge(any $arg) (boolean)
303  
304 The ge method performs a I<"greater-than-or-equal-to"> operation using the
305 invocant and argument provided. The operation will be performed as either a
306 numerical or stringwise operation based upon the preference (i.e. the return
307 value of the L</comparer> method) of the invocant.
308  
309 I<Since C<0.08>>
310  
311 =over 4
312  
313 =item ge example 1
314  
315 package main;
316  
317 my $example = Example->new;
318  
319 my $result = $example->ge(3);
320  
321 # 0
322  
323 =back
324  
325 =over 4
326  
327 =item ge example 2
328  
329 package main;
330  
331 my $example = Example->new;
332  
333 my $result = $example->ge($example);
334  
335 # 1
336  
337 =back
338  
339 =over 4
340  
341 =item ge example 3
342  
343 package main;
344  
345 my $example = Example->new;
346  
347 my $result = $example->ge([1,2,3]);
348  
349 # 0
350  
351 =back
352  
353 =cut
354  
355 =head2 gele
356  
357 gele(any $arg1, any $arg2) (boolean)
358  
359 The gele method performs a I<"greater-than-or-equal-to"> operation on the 1st
360 argument, and I<"lesser-than-or-equal-to"> operation on the 2nd argument. The
361 operation will be performed as either a numerical or stringwise operation based
362 upon the preference (i.e. the return value of the L</comparer> method) of the
363 invocant.
364  
365 I<Since C<0.08>>
366  
367 =over 4
368  
369 =item gele example 1
370  
371 package main;
372  
373 my $example = Example->new;
374  
375 my $result = $example->gele(1, 3);
376  
377 # 1
378  
379 =back
380  
381 =over 4
382  
383 =item gele example 2
384  
385 package main;
386  
387 my $example = Example->new;
388  
389 my $result = $example->gele(2, []);
390  
391 # 0
392  
393 =back
394  
395 =over 4
396  
397 =item gele example 3
398  
399 package main;
400  
401 my $example = Example->new;
402  
403 my $result = $example->gele(0, '3');
404  
405 # 1
406  
407 =back
408  
409 =cut
410  
411 =head2 gt
412  
413 gt(any $arg) (boolean)
414  
415 The gt method performs a I<"greater-than"> operation using the invocant and
416 argument provided. The operation will be performed as either a numerical or
417 stringwise operation based upon the preference (i.e. the return value of the
418 L</comparer> method) of the invocant.
419  
420 I<Since C<0.08>>
421  
422 =over 4
423  
424 =item gt example 1
425  
426 package main;
427  
428 my $example = Example->new;
429  
430 my $result = $example->gt({1..2});
431  
432 # 0
433  
434 =back
435  
436 =over 4
437  
438 =item gt example 2
439  
440 package main;
441  
442 my $example = Example->new;
443  
444 my $result = $example->gt(1.9998);
445  
446 # 1
447  
448 =back
449  
450 =over 4
451  
452 =item gt example 3
453  
454 package main;
455  
456 my $example = Example->new;
457  
458 my $result = $example->gt(\1_000_000);
459  
460 # 0
461  
462 =back
463  
464 =cut
465  
466 =head2 gtlt
467  
468 gtlt(any $arg1, any $arg2) (boolean)
469  
470 The gtlt method performs a I<"greater-than"> operation on the 1st argument, and
471 I<"lesser-than"> operation on the 2nd argument. The operation will be performed
472 as either a numerical or stringwise operation based upon the preference (i.e.
473 the return value of the L</comparer> method) of the invocant.
474  
475 I<Since C<0.08>>
476  
477 =over 4
478  
479 =item gtlt example 1
480  
481 package main;
482  
483 my $example = Example->new;
484  
485 my $result = $example->gtlt('1', 3);
486  
487 # 1
488  
489 =back
490  
491 =over 4
492  
493 =item gtlt example 2
494  
495 package main;
496  
497 my $example = Example->new;
498  
499 my $result = $example->gtlt({1..2}, {1..4});
500  
501 # 0
502  
503 =back
504  
505 =over 4
506  
507 =item gtlt example 3
508  
509 package main;
510  
511 my $example = Example->new;
512  
513 my $result = $example->gtlt('.', ['.']);
514  
515 # 1
516  
517 =back
518  
519 =cut
520  
521 =head2 is
522  
523 is(any $arg) (boolean)
524  
525 The is method performs an I<"is-exactly"> operation using the invocant and the
526 argument provided. If the argument provided is blessed and exactly the same as
527 the invocant (i.e. shares the same address space) the operation will return
528 truthy.
529  
530 I<Since C<1.80>>
531  
532 =over 4
533  
534 =item is example 1
535  
536 package main;
537  
538 my $example = Example->new;
539  
540 my $result = $example->is($example);
541  
542 # 1
543  
544 =back
545  
546 =over 4
547  
548 =item is example 2
549  
550 package main;
551  
552 my $example = Example->new;
553  
554 my $result = $example->is([1,2]);
555  
556 # 0
557  
558 =back
559  
560 =over 4
561  
562 =item is example 3
563  
564 package main;
565  
566 my $example = Example->new;
567  
568 my $result = $example->is(Example->new);
569  
570 # 0
571  
572 =back
573  
574 =cut
575  
576 =head2 le
577  
578 le(any $arg) (boolean)
579  
580 The le method performs a I<"lesser-than-or-equal-to"> operation using the
581 invocant and argument provided. The operation will be performed as either a
582 numerical or stringwise operation based upon the preference (i.e. the return
583 value of the L</comparer> method) of the invocant.
584  
585 I<Since C<0.08>>
586  
587 =over 4
588  
589 =item le example 1
590  
591 package main;
592  
593 my $example = Example->new;
594  
595 my $result = $example->le('9');
596  
597 # 1
598  
599 =back
600  
601 =over 4
602  
603 =item le example 2
604  
605 package main;
606  
607 my $example = Example->new;
608  
609 my $result = $example->le([1..2]);
610  
611 # 1
612  
613 =back
614  
615 =over 4
616  
617 =item le example 3
618  
619 package main;
620  
621 my $example = Example->new;
622  
623 my $result = $example->le(\1);
624  
625 # 0
626  
627 =back
628  
629 =cut
630  
631 =head2 lt
632  
633 lt(any $arg) (boolean)
634  
635 The lt method performs a I<"lesser-than"> operation using the invocant and
636 argument provided. The operation will be performed as either a numerical or
637 stringwise operation based upon the preference (i.e. the return value of the
638 L</comparer> method) of the invocant.
639  
640 I<Since C<0.08>>
641  
642 =over 4
643  
644 =item lt example 1
645  
646 package main;
647  
648 my $example = Example->new;
649  
650 my $result = $example->lt(qr/.*/);
651  
652 # 1
653  
654 =back
655  
656 =over 4
657  
658 =item lt example 2
659  
660 package main;
661  
662 my $example = Example->new;
663  
664 my $result = $example->lt('.*');
665  
666 # 0
667  
668 =back
669  
670 =over 4
671  
672 =item lt example 3
673  
674 package main;
675  
676 my $example = Example->new;
677  
678 my $result = $example->lt('5');
679  
680 # 1
681  
682 =back
683  
684 =cut
685  
686 =head2 ne
687  
688 ne(any $arg) (boolean)
689  
690 The ne method performs a I<"not-equal-to"> operation using the invocant and
691 argument provided. The operation will be performed as either a numerical or
692 stringwise operation based upon the preference (i.e. the return value of the
693 L</comparer> method) of the invocant.
694  
695 I<Since C<0.08>>
696  
697 =over 4
698  
699 =item ne example 1
700  
701 package main;
702  
703 my $example = Example->new;
704  
705 my $result = $example->ne([1,2]);
706  
707 # 1
708  
709 =back
710  
711 =over 4
712  
713 =item ne example 2
714  
715 package main;
716  
717 my $example = Example->new;
718  
719 my $result = $example->ne([2]);
720  
721 # 1
722  
723 =back
724  
725 =over 4
726  
727 =item ne example 3
728  
729 package main;
730  
731 my $example = Example->new;
732  
733 my $result = $example->ne(qr/2/);
734  
735 # 1
736  
737 =back
738  
739 =cut
740  
741 =head2 st
742  
743 st(object $arg) (boolean)
744  
745 The st method performs a I<"same-type"> operation using the invocant and
746 argument provided. If the argument provided is an instance of the invocant, or
747 a subclass, the operation will return truthy.
748  
749 I<Since C<1.80>>
750  
751 =over 4
752  
753 =item st example 1
754  
755 package main;
756  
757 my $example = Example->new;
758  
759 my $result = $example->st($example);
760  
761 # 1
762  
763 =back
764  
765 =over 4
766  
767 =item st example 2
768  
769 package main;
770  
771 use Venus::Number;
772  
773 my $example = Example->new;
774  
775 my $result = $example->st(Venus::Number->new(2));
776  
777 # 0
778  
779 =back
780  
781 =over 4
782  
783 =item st example 3
784  
785 package main;
786  
787 use Venus::String;
788  
789 my $example = Example->new;
790  
791 my $result = $example->st(Venus::String->new('2'));
792  
793 # 0
794  
795 =back
796  
797 =over 4
798  
799 =item st example 4
800  
801 package Example2;
802  
803 use base 'Example';
804  
805 package main;
806  
807 use Venus::String;
808  
809 my $example = Example2->new;
810  
811 my $result = $example->st(Example2->new);
812  
813 # 1
814  
815 =back
816  
817 =cut
818  
819 =head2 tv
820  
821 tv(any $arg) (boolean)
822  
823 The tv method performs a I<"type-and-value-equal-to"> operation using the
824 invocant and argument provided. The operation will be performed as either a
825 numerical or stringwise operation based upon the preference (i.e. the return
826 value of the L</comparer> method) of the invocant.
827  
828 I<Since C<0.08>>
829  
830 =over 4
831  
832 =item tv example 1
833  
834 package main;
835  
836 my $example = Example->new;
837  
838 my $result = $example->tv($example);
839  
840 # 1
841  
842 =back
843  
844 =over 4
845  
846 =item tv example 2
847  
848 package main;
849  
850 use Venus::Number;
851  
852 my $example = Example->new;
853  
854 my $result = $example->tv(Venus::Number->new(2));
855  
856 # 0
857  
858 =back
859  
860 =over 4
861  
862 =item tv example 3
863  
864 package main;
865  
866 use Venus::String;
867  
868 my $example = Example->new;
869  
870 my $result = $example->tv(Venus::String->new('2'));
871  
872 # 0
873  
874 =back
875  
876 =over 4
877  
878 =item tv example 4
879  
880 package main;
881  
882 use Venus::String;
883  
884 my $example = Example->new;
885  
886 my $result = $example->tv(Example->new);
887  
888 # 1
889  
890 =back
891  
892 =cut
893  
894 =head1 AUTHORS
895  
896 Awncorp, C<awncorp@cpan.org>
897  
898 =cut
899  
900 =head1 LICENSE
901  
902 Copyright (C) 2000, Awncorp, C<awncorp@cpan.org>.
903  
904 This program is free software, you can redistribute it and/or modify it under
905 the terms of the Apache license version 2.0.
906  
907 =cut
« blib/lib/Venus/Space.pm ↑ Summary blib/lib/Venus/Log.pm »