Spy/_overload.pm untested

filter: Statementstmt 0.0% 0 / 430 Branchbran 0.0% 0 / 540 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 991 CC 4 SCAR 14.3
CC
4
Cov
0%
isa
6.0
DOES
6.0
can
6.0
CRAP 4.2
1 #
2 # Devel/Spy/_overload.pm
3 #
4 # Copyright (C) ... by Joshua ben Jore
5 #
6 # You may distribute under the terms of either the GNU General Public
7 # License or the Artistic License, as specified in the README file.
8 #
9 # !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
10 # This file is built by overload.PL from its data. Any changes made here
11 # will be lost!
12 #
13  
14 package Devel::Spy::_obj;
15 use strict;
16 use warnings;
17  
18 require Sub::Name;
19 require overload;
20  
21 sub isa {
22 my $self = shift @_;
23  
24 if ( defined Scalar::Util::blessed( $self ) ) {
25 my $followup = $self->[2]->( '->isa' );
26 # Object method call passed onto our stored thing.
27 return Devel::Spy->new( $self->[1]->isa( @_ ),
28 $followup );
29 }
30 else {
31 # Class method call on Devel::Spy::_obj. Just forward
32 # to UNIVERSAL or whatever else is there.
33 return $self->SUPER::isa( @_ );
34 }
35 }
36 sub DOES {
37 my $self = shift @_;
38  
39 if ( defined Scalar::Util::blessed( $self ) ) {
40 my $followup = $self->[2]->( '->DOES' );
41 # Object method call passed onto our stored thing.
42 return Devel::Spy->new( $self->[1]->DOES( @_ ),
43 $followup );
44 }
45 else {
46 # Class method call on Devel::Spy::_obj. Just forward
47 # to UNIVERSAL or whatever else is there.
48 return $self->SUPER::DOES( @_ );
49 }
50 }
51 sub can {
52 my $self = shift @_;
53  
54 if ( defined Scalar::Util::blessed( $self ) ) {
55 my $followup = $self->[2]->( '->can' );
56 # Object method call passed onto our stored thing.
57 return Devel::Spy->new( $self->[1]->can( @_ ),
58 $followup );
59 }
60 else {
61 # Class method call on Devel::Spy::_obj. Just forward
62 # to UNIVERSAL or whatever else is there.
63 return $self->SUPER::can( @_ );
64 }
65 }
66 my @overloading = (
67 'fallback' => 0,
68 '=' => Sub::Name::subname(
69 '=',
70 sub {
71 my $class = CORE::ref $_[0];
72 my $followup = $_[0][2]->(
73 '->(= '
74 . ( defined $_[0][1]
75 ? $_[0][1]
76 : 'undef' )
77 . ') -> ');
78 return Devel::Spy->new( $_[0][1], $followup );
79 }
80 ),
81 'atan2' => Sub::Name::subname(
82 'atan2',
83 sub {
84 my ( $result, $followup );
85 if ( $_[2] ) {
86 $result = atan2 $_[1], $_[0][0];
87 $followup = $_[0][2]->(
88 ' ->(atan2 '
89 . ( defined $_[1]
90 ? $_[1]
91 : 'undef')
92 . ', '
93 . ( defined $_[0][1]
94 ? $_[0][1]
95 : 'undef')
96 . ') ->'
97 . overload::StrVal($result) );
98 }
99 else {
100 $result = atan2 $_[0][0], $_[1];
101 $followup = $_[0][2]->(
102 ' ->(atan2 '
103 . ( defined $_[0][1]
104 ? $_[0][1]
105 : 'undef')
106 . ', '
107 . ( defined $_[1]
108 ? $_[1]
109 : 'undef')
110 . ') ->'
111 . overload::StrVal($result) );
112 }
113 return Devel::Spy->new( $result, $followup );
114 }
115 ),
116 '-X' => Sub::Name::subname(
117 '-X',
118 sub {
119 my $result =
120 $_[2] eq 'r' ? ( -r $_[0][0] ) :
121 $_[2] eq 'w' ? ( -w $_[0][0] ) :
122 $_[2] eq 'x' ? ( -x $_[0][0] ) :
123 $_[2] eq 'o' ? ( -o $_[0][0] ) :
124 $_[2] eq 'R' ? ( -R $_[0][0] ) :
125 $_[2] eq 'W' ? ( -W $_[0][0] ) :
126 $_[2] eq 'X' ? ( -X $_[0][0] ) :
127 $_[2] eq 'O' ? ( -O $_[0][0] ) :
128 $_[2] eq 'e' ? ( -e $_[0][0] ) :
129 $_[2] eq 'z' ? ( -z $_[0][0] ) :
130 $_[2] eq 's' ? ( -s $_[0][0] ) :
131 $_[2] eq 'f' ? ( -f $_[0][0] ) :
132 $_[2] eq 'd' ? ( -d $_[0][0] ) :
133 $_[2] eq 'l' ? ( -l $_[0][0] ) :
134 $_[2] eq 'p' ? ( -p $_[0][0] ) :
135 $_[2] eq 'S' ? ( -S $_[0][0] ) :
136 $_[2] eq 'b' ? ( -b $_[0][0] ) :
137 $_[2] eq 'c' ? ( -c $_[0][0] ) :
138 $_[2] eq 't' ? ( -t $_[0][0] ) :
139 $_[2] eq 'u' ? ( -u $_[0][0] ) :
140 $_[2] eq 'g' ? ( -g $_[0][0] ) :
141 $_[2] eq 'k' ? ( -k $_[0][0] ) :
142 $_[2] eq 'T' ? ( -T $_[0][0] ) :
143 $_[2] eq 'B' ? ( -B $_[0][0] ) :
144 $_[2] eq 'M' ? ( -M $_[0][0] ) :
145 $_[2] eq 'A' ? ( -A $_[0][0] ) :
146 $_[2] eq 'C' ? ( -C $_[0][0] ) :
147 eval( "-$_[2] $_[0][0]" );
148 my $followup = $_[0][2]->(
149 " ->(-$_[2] "
150 . ( defined $_[0][1]
151 ? $_[0][1]
152 : 'undef' )
153 . ') ->'
154 . overload::StrVal($result) );
155 return Devel::Spy->new( $result, $followup );
156 }
157 ),
158 '<>' => Sub::Name::subname(
159 '<>',
160 sub {
161 my $result = readline $_[0][0];
162 my $followup = $_[0][2]->(
163 ' ->(readline '
164 . ( defined $_[0][1]
165 ? $_[0][1]
166 : 'undef' )
167 . ') ->'
168 . overload::StrVal($result) );
169 return Devel::Spy->new( $result, $followup );
170 }
171 ),
172 '${}' => Sub::Name::subname(
173 '${}',
174 sub {
175  
176 # Allow ourselves to access our own guts and let
177 # everyone else have the payload.
178 if ( caller() eq 'Devel::Spy::_obj' ) {
179 return $_[0];
180 }
181 else {
182 # This idea is really dodgy but I found myself in
183 # an infinite loop of some kind when I returned a
184 # plain Devel::Spy object wrapping the
185 # result. Bummer.
186 my $followup = $_[0][2]->( ' ->${}' );
187 my $tied = $_[0][0];
188 my $reftype = CORE::ref( $tied );
189 my $obj =
190 'HASH' eq $reftype ? ( tied %$tied ) :
191 'ARRAY' eq $reftype ? ( tied @$tied ) :
192 $reftype =~ /
193 ^
194 (?:
195 SCALAR
196 | REF
197 | LVALUE
198 | REGEXP
199 | VSTRING
200 | BIND
201 )
202 \z
203 /x
204 ? ( tied $$tied ) :
205 'CODE' eq $reftype ? ( tied &$tied ) :
206 $reftype =~ /
207 ^
208 (?:
209 GLOB
210 | FORMAT
211 | IO
212 )
213 \z
214 /x
215 ? ( tied *$tied ) :
216 die "Unknown reftype $reftype for object $tied";
217 $obj->[1] = $followup;
218 return $tied;
219 }
220 }
221 ),
222 '@{}' => Sub::Name::subname(
223 '@{}',
224 sub {
225  
226 # Allow ourselves to access our own guts and let
227 # everyone else have the payload.
228 if ( caller() eq 'Devel::Spy::_obj' ) {
229 return $_[0];
230 }
231 else {
232 # This idea is really dodgy but I found myself in
233 # an infinite loop of some kind when I returned a
234 # plain Devel::Spy object wrapping the
235 # result. Bummer.
236 my $followup = $_[0][2]->( ' ->@{}' );
237 my $tied = $_[0][0];
238 my $reftype = CORE::ref( $tied );
239 my $obj =
240 'HASH' eq $reftype ? ( tied %$tied ) :
241 'ARRAY' eq $reftype ? ( tied @$tied ) :
242 $reftype =~ /
243 ^
244 (?:
245 SCALAR
246 | REF
247 | LVALUE
248 | REGEXP
249 | VSTRING
250 | BIND
251 )
252 \z
253 /x
254 ? ( tied $$tied ) :
255 'CODE' eq $reftype ? ( tied &$tied ) :
256 $reftype =~ /
257 ^
258 (?:
259 GLOB
260 | FORMAT
261 | IO
262 )
263 \z
264 /x
265 ? ( tied *$tied ) :
266 die "Unknown reftype $reftype for object $tied";
267 $obj->[1] = $followup;
268 return $tied;
269 }
270 }
271 ),
272 '%{}' => Sub::Name::subname(
273 '%{}',
274 sub {
275  
276 # Allow ourselves to access our own guts and let
277 # everyone else have the payload.
278 if ( caller() eq 'Devel::Spy::_obj' ) {
279 return $_[0];
280 }
281 else {
282 # This idea is really dodgy but I found myself in
283 # an infinite loop of some kind when I returned a
284 # plain Devel::Spy object wrapping the
285 # result. Bummer.
286 my $followup = $_[0][2]->( ' ->%{}' );
287 my $tied = $_[0][0];
288 my $reftype = CORE::ref( $tied );
289 my $obj =
290 'HASH' eq $reftype ? ( tied %$tied ) :
291 'ARRAY' eq $reftype ? ( tied @$tied ) :
292 $reftype =~ /
293 ^
294 (?:
295 SCALAR
296 | REF
297 | LVALUE
298 | REGEXP
299 | VSTRING
300 | BIND
301 )
302 \z
303 /x
304 ? ( tied $$tied ) :
305 'CODE' eq $reftype ? ( tied &$tied ) :
306 $reftype =~ /
307 ^
308 (?:
309 GLOB
310 | FORMAT
311 | IO
312 )
313 \z
314 /x
315 ? ( tied *$tied ) :
316 die "Unknown reftype $reftype for object $tied";
317 $obj->[1] = $followup;
318 return $tied;
319 }
320 }
321 ),
322 '&{}' => Sub::Name::subname(
323 '&{}',
324 sub {
325  
326 # Allow ourselves to access our own guts and let
327 # everyone else have the payload.
328 if ( caller() eq 'Devel::Spy::_obj' ) {
329 return $_[0];
330 }
331 else {
332 # This idea is really dodgy but I found myself in
333 # an infinite loop of some kind when I returned a
334 # plain Devel::Spy object wrapping the
335 # result. Bummer.
336 my $followup = $_[0][2]->( ' ->&{}' );
337 my $tied = $_[0][0];
338 my $reftype = CORE::ref( $tied );
339 my $obj =
340 'HASH' eq $reftype ? ( tied %$tied ) :
341 'ARRAY' eq $reftype ? ( tied @$tied ) :
342 $reftype =~ /
343 ^
344 (?:
345 SCALAR
346 | REF
347 | LVALUE
348 | REGEXP
349 | VSTRING
350 | BIND
351 )
352 \z
353 /x
354 ? ( tied $$tied ) :
355 'CODE' eq $reftype ? ( tied &$tied ) :
356 $reftype =~ /
357 ^
358 (?:
359 GLOB
360 | FORMAT
361 | IO
362 )
363 \z
364 /x
365 ? ( tied *$tied ) :
366 die "Unknown reftype $reftype for object $tied";
367 $obj->[1] = $followup;
368 return $tied;
369 }
370 }
371 ),
372 '*{}' => Sub::Name::subname(
373 '*{}',
374 sub {
375  
376 # Allow ourselves to access our own guts and let
377 # everyone else have the payload.
378 if ( caller() eq 'Devel::Spy::_obj' ) {
379 return $_[0];
380 }
381 else {
382 # This idea is really dodgy but I found myself in
383 # an infinite loop of some kind when I returned a
384 # plain Devel::Spy object wrapping the
385 # result. Bummer.
386 my $followup = $_[0][2]->( ' ->*{}' );
387 my $tied = $_[0][0];
388 my $reftype = CORE::ref( $tied );
389 my $obj =
390 'HASH' eq $reftype ? ( tied %$tied ) :
391 'ARRAY' eq $reftype ? ( tied @$tied ) :
392 $reftype =~ /
393 ^
394 (?:
395 SCALAR
396 | REF
397 | LVALUE
398 | REGEXP
399 | VSTRING
400 | BIND
401 )
402 \z
403 /x
404 ? ( tied $$tied ) :
405 'CODE' eq $reftype ? ( tied &$tied ) :
406 $reftype =~ /
407 ^
408 (?:
409 GLOB
410 | FORMAT
411 | IO
412 )
413 \z
414 /x
415 ? ( tied *$tied ) :
416 die "Unknown reftype $reftype for object $tied";
417 $obj->[1] = $followup;
418 return $tied;
419 }
420 }
421 ),
422 'bool' => Sub::Name::subname(
423 'bool',
424 sub {
425 $_[0][2]->(' ->bool');
426 return $_[0][0];
427 }
428 ),
429 '""' => Sub::Name::subname(
430 '""',
431 sub {
432 $_[0][2]->(' ->""');
433 return $_[0][0];
434 }
435 ),
436 '0+' => Sub::Name::subname(
437 '0+',
438 sub {
439 $_[0][2]->(' ->0+');
440 return $_[0][0];
441 }
442 ),
443 'qr' => Sub::Name::subname(
444 'qr',
445 sub {
446 $_[0][2]->(' ->qr');
447 return $_[0][0];
448 }
449 ),
450 '+' => Sub::Name::subname(
451 '+',
452 sub {
453 my ( $result, $followup );
454 if ( $_[2] ) {
455 $result = $_[1] + $_[0][0];
456 $followup = $_[0][2]->(
457 ' ->('
458 . ( defined $_[1]
459 ? $_[1]
460 : 'undef')
461 . ' + '
462 . ( defined $_[0][1]
463 ? $_[0][1]
464 : 'undef')
465 . ') ->'
466 . overload::StrVal($result) );
467 }
468 else {
469 $result = $_[0][0] + $_[1];
470 $followup = $_[0][2]->(
471 ' ->('
472 . ( defined $_[0][1]
473 ? $_[0][1]
474 : 'undef')
475 . ' + '
476 . ( defined $_[1]
477 ? $_[1]
478 : 'undef')
479 . ') ->'
480 . overload::StrVal($result) );
481 }
482 return Devel::Spy->new( $result, $followup );
483 }
484 ),
485 '-' => Sub::Name::subname(
486 '-',
487 sub {
488 my ( $result, $followup );
489 if ( $_[2] ) {
490 $result = $_[1] - $_[0][0];
491 $followup = $_[0][2]->(
492 ' ->('
493 . ( defined $_[1]
494 ? $_[1]
495 : 'undef')
496 . ' - '
497 . ( defined $_[0][1]
498 ? $_[0][1]
499 : 'undef')
500 . ') ->'
501 . overload::StrVal($result) );
502 }
503 else {
504 $result = $_[0][0] - $_[1];
505 $followup = $_[0][2]->(
506 ' ->('
507 . ( defined $_[0][1]
508 ? $_[0][1]
509 : 'undef')
510 . ' - '
511 . ( defined $_[1]
512 ? $_[1]
513 : 'undef')
514 . ') ->'
515 . overload::StrVal($result) );
516 }
517 return Devel::Spy->new( $result, $followup );
518 }
519 ),
520 '*' => Sub::Name::subname(
521 '*',
522 sub {
523 my ( $result, $followup );
524 if ( $_[2] ) {
525 $result = $_[1] * $_[0][0];
526 $followup = $_[0][2]->(
527 ' ->('
528 . ( defined $_[1]
529 ? $_[1]
530 : 'undef')
531 . ' * '
532 . ( defined $_[0][1]
533 ? $_[0][1]
534 : 'undef')
535 . ') ->'
536 . overload::StrVal($result) );
537 }
538 else {
539 $result = $_[0][0] * $_[1];
540 $followup = $_[0][2]->(
541 ' ->('
542 . ( defined $_[0][1]
543 ? $_[0][1]
544 : 'undef')
545 . ' * '
546 . ( defined $_[1]
547 ? $_[1]
548 : 'undef')
549 . ') ->'
550 . overload::StrVal($result) );
551 }
552 return Devel::Spy->new( $result, $followup );
553 }
554 ),
555 '/' => Sub::Name::subname(
556 '/',
557 sub {
558 my ( $result, $followup );
559 if ( $_[2] ) {
560 $result = $_[1] / $_[0][0];
561 $followup = $_[0][2]->(
562 ' ->('
563 . ( defined $_[1]
564 ? $_[1]
565 : 'undef')
566 . ' / '
567 . ( defined $_[0][1]
568 ? $_[0][1]
569 : 'undef')
570 . ') ->'
571 . overload::StrVal($result) );
572 }
573 else {
574 $result = $_[0][0] / $_[1];
575 $followup = $_[0][2]->(
576 ' ->('
577 . ( defined $_[0][1]
578 ? $_[0][1]
579 : 'undef')
580 . ' / '
581 . ( defined $_[1]
582 ? $_[1]
583 : 'undef')
584 . ') ->'
585 . overload::StrVal($result) );
586 }
587 return Devel::Spy->new( $result, $followup );
588 }
589 ),
590 '%' => Sub::Name::subname(
591 '%',
592 sub {
593 my ( $result, $followup );
594 if ( $_[2] ) {
595 $result = $_[1] % $_[0][0];
596 $followup = $_[0][2]->(
597 ' ->('
598 . ( defined $_[1]
599 ? $_[1]
600 : 'undef')
601 . ' % '
602 . ( defined $_[0][1]
603 ? $_[0][1]
604 : 'undef')
605 . ') ->'
606 . overload::StrVal($result) );
607 }
608 else {
609 $result = $_[0][0] % $_[1];
610 $followup = $_[0][2]->(
611 ' ->('
612 . ( defined $_[0][1]
613 ? $_[0][1]
614 : 'undef')
615 . ' % '
616 . ( defined $_[1]
617 ? $_[1]
618 : 'undef')
619 . ') ->'
620 . overload::StrVal($result) );
621 }
622 return Devel::Spy->new( $result, $followup );
623 }
624 ),
625 '**' => Sub::Name::subname(
626 '**',
627 sub {
628 my ( $result, $followup );
629 if ( $_[2] ) {
630 $result = $_[1] ** $_[0][0];
631 $followup = $_[0][2]->(
632 ' ->('
633 . ( defined $_[1]
634 ? $_[1]
635 : 'undef')
636 . ' ** '
637 . ( defined $_[0][1]
638 ? $_[0][1]
639 : 'undef')
640 . ') ->'
641 . overload::StrVal($result) );
642 }
643 else {
644 $result = $_[0][0] ** $_[1];
645 $followup = $_[0][2]->(
646 ' ->('
647 . ( defined $_[0][1]
648 ? $_[0][1]
649 : 'undef')
650 . ' ** '
651 . ( defined $_[1]
652 ? $_[1]
653 : 'undef')
654 . ') ->'
655 . overload::StrVal($result) );
656 }
657 return Devel::Spy->new( $result, $followup );
658 }
659 ),
660 '<<' => Sub::Name::subname(
661 '<<',
662 sub {
663 my ( $result, $followup );
664 if ( $_[2] ) {
665 $result = $_[1] << $_[0][0];
666 $followup = $_[0][2]->(
667 ' ->('
668 . ( defined $_[1]
669 ? $_[1]
670 : 'undef')
671 . ' << '
672 . ( defined $_[0][1]
673 ? $_[0][1]
674 : 'undef')
675 . ') ->'
676 . overload::StrVal($result) );
677 }
678 else {
679 $result = $_[0][0] << $_[1];
680 $followup = $_[0][2]->(
681 ' ->('
682 . ( defined $_[0][1]
683 ? $_[0][1]
684 : 'undef')
685 . ' << '
686 . ( defined $_[1]
687 ? $_[1]
688 : 'undef')
689 . ') ->'
690 . overload::StrVal($result) );
691 }
692 return Devel::Spy->new( $result, $followup );
693 }
694 ),
695 '>>' => Sub::Name::subname(
696 '>>',
697 sub {
698 my ( $result, $followup );
699 if ( $_[2] ) {
700 $result = $_[1] >> $_[0][0];
701 $followup = $_[0][2]->(
702 ' ->('
703 . ( defined $_[1]
704 ? $_[1]
705 : 'undef')
706 . ' >> '
707 . ( defined $_[0][1]
708 ? $_[0][1]
709 : 'undef')
710 . ') ->'
711 . overload::StrVal($result) );
712 }
713 else {
714 $result = $_[0][0] >> $_[1];
715 $followup = $_[0][2]->(
716 ' ->('
717 . ( defined $_[0][1]
718 ? $_[0][1]
719 : 'undef')
720 . ' >> '
721 . ( defined $_[1]
722 ? $_[1]
723 : 'undef')
724 . ') ->'
725 . overload::StrVal($result) );
726 }
727 return Devel::Spy->new( $result, $followup );
728 }
729 ),
730 'x' => Sub::Name::subname(
731 'x',
732 sub {
733 my ( $result, $followup );
734 if ( $_[2] ) {
735 $result = $_[1] x $_[0][0];
736 $followup = $_[0][2]->(
737 ' ->('
738 . ( defined $_[1]
739 ? $_[1]
740 : 'undef')
741 . ' x '
742 . ( defined $_[0][1]
743 ? $_[0][1]
744 : 'undef')
745 . ') ->'
746 . overload::StrVal($result) );
747 }
748 else {
749 $result = $_[0][0] x $_[1];
750 $followup = $_[0][2]->(
751 ' ->('
752 . ( defined $_[0][1]
753 ? $_[0][1]
754 : 'undef')
755 . ' x '
756 . ( defined $_[1]
757 ? $_[1]
758 : 'undef')
759 . ') ->'
760 . overload::StrVal($result) );
761 }
762 return Devel::Spy->new( $result, $followup );
763 }
764 ),
765 '.' => Sub::Name::subname(
766 '.',
767 sub {
768 my ( $result, $followup );
769 if ( $_[2] ) {
770 $result = $_[1] . $_[0][0];
771 $followup = $_[0][2]->(
772 ' ->('
773 . ( defined $_[1]
774 ? $_[1]
775 : 'undef')
776 . ' . '
777 . ( defined $_[0][1]
778 ? $_[0][1]
779 : 'undef')
780 . ') ->'
781 . overload::StrVal($result) );
782 }
783 else {
784 $result = $_[0][0] . $_[1];
785 $followup = $_[0][2]->(
786 ' ->('
787 . ( defined $_[0][1]
788 ? $_[0][1]
789 : 'undef')
790 . ' . '
791 . ( defined $_[1]
792 ? $_[1]
793 : 'undef')
794 . ') ->'
795 . overload::StrVal($result) );
796 }
797 return Devel::Spy->new( $result, $followup );
798 }
799 ),
800 '<' => Sub::Name::subname(
801 '<',
802 sub {
803 my ( $result, $followup );
804 if ( $_[2] ) {
805 $result = $_[1] < $_[0][0];
806 $followup = $_[0][2]->(
807 ' ->('
808 . ( defined $_[1]
809 ? $_[1]
810 : 'undef')
811 . ' < '
812 . ( defined $_[0][1]
813 ? $_[0][1]
814 : 'undef')
815 . ') ->'
816 . overload::StrVal($result) );
817 }
818 else {
819 $result = $_[0][0] < $_[1];
820 $followup = $_[0][2]->(
821 ' ->('
822 . ( defined $_[0][1]
823 ? $_[0][1]
824 : 'undef')
825 . ' < '
826 . ( defined $_[1]
827 ? $_[1]
828 : 'undef')
829 . ') ->'
830 . overload::StrVal($result) );
831 }
832 return Devel::Spy->new( $result, $followup );
833 }
834 ),
835 '<=' => Sub::Name::subname(
836 '<=',
837 sub {
838 my ( $result, $followup );
839 if ( $_[2] ) {
840 $result = $_[1] <= $_[0][0];
841 $followup = $_[0][2]->(
842 ' ->('
843 . ( defined $_[1]
844 ? $_[1]
845 : 'undef')
846 . ' <= '
847 . ( defined $_[0][1]
848 ? $_[0][1]
849 : 'undef')
850 . ') ->'
851 . overload::StrVal($result) );
852 }
853 else {
854 $result = $_[0][0] <= $_[1];
855 $followup = $_[0][2]->(
856 ' ->('
857 . ( defined $_[0][1]
858 ? $_[0][1]
859 : 'undef')
860 . ' <= '
861 . ( defined $_[1]
862 ? $_[1]
863 : 'undef')
864 . ') ->'
865 . overload::StrVal($result) );
866 }
867 return Devel::Spy->new( $result, $followup );
868 }
869 ),
870 '>' => Sub::Name::subname(
871 '>',
872 sub {
873 my ( $result, $followup );
874 if ( $_[2] ) {
875 $result = $_[1] > $_[0][0];
876 $followup = $_[0][2]->(
877 ' ->('
878 . ( defined $_[1]
879 ? $_[1]
880 : 'undef')
881 . ' > '
882 . ( defined $_[0][1]
883 ? $_[0][1]
884 : 'undef')
885 . ') ->'
886 . overload::StrVal($result) );
887 }
888 else {
889 $result = $_[0][0] > $_[1];
890 $followup = $_[0][2]->(
891 ' ->('
892 . ( defined $_[0][1]
893 ? $_[0][1]
894 : 'undef')
895 . ' > '
896 . ( defined $_[1]
897 ? $_[1]
898 : 'undef')
899 . ') ->'
900 . overload::StrVal($result) );
901 }
902 return Devel::Spy->new( $result, $followup );
903 }
904 ),
905 '>=' => Sub::Name::subname(
906 '>=',
907 sub {
908 my ( $result, $followup );
909 if ( $_[2] ) {
910 $result = $_[1] >= $_[0][0];
911 $followup = $_[0][2]->(
912 ' ->('
913 . ( defined $_[1]
914 ? $_[1]
915 : 'undef')
916 . ' >= '
917 . ( defined $_[0][1]
918 ? $_[0][1]
919 : 'undef')
920 . ') ->'
921 . overload::StrVal($result) );
922 }
923 else {
924 $result = $_[0][0] >= $_[1];
925 $followup = $_[0][2]->(
926 ' ->('
927 . ( defined $_[0][1]
928 ? $_[0][1]
929 : 'undef')
930 . ' >= '
931 . ( defined $_[1]
932 ? $_[1]
933 : 'undef')
934 . ') ->'
935 . overload::StrVal($result) );
936 }
937 return Devel::Spy->new( $result, $followup );
938 }
939 ),
940 '==' => Sub::Name::subname(
941 '==',
942 sub {
943 my ( $result, $followup );
944 if ( $_[2] ) {
945 $result = $_[1] == $_[0][0];
946 $followup = $_[0][2]->(
947 ' ->('
948 . ( defined $_[1]
949 ? $_[1]
950 : 'undef')
951 . ' == '
952 . ( defined $_[0][1]
953 ? $_[0][1]
954 : 'undef')
955 . ') ->'
956 . overload::StrVal($result) );
957 }
958 else {
959 $result = $_[0][0] == $_[1];
960 $followup = $_[0][2]->(
961 ' ->('
962 . ( defined $_[0][1]
963 ? $_[0][1]
964 : 'undef')
965 . ' == '
966 . ( defined $_[1]
967 ? $_[1]
968 : 'undef')
969 . ') ->'
970 . overload::StrVal($result) );
971 }
972 return Devel::Spy->new( $result, $followup );
973 }
974 ),
975 '!=' => Sub::Name::subname(
976 '!=',
977 sub {
978 my ( $result, $followup );
979 if ( $_[2] ) {
980 $result = $_[1] != $_[0][0];
981 $followup = $_[0][2]->(
982 ' ->('
983 . ( defined $_[1]
984 ? $_[1]
985 : 'undef')
986 . ' != '
987 . ( defined $_[0][1]
988 ? $_[0][1]
989 : 'undef')
990 . ') ->'
991 . overload::StrVal($result) );
992 }
993 else {
994 $result = $_[0][0] != $_[1];
995 $followup = $_[0][2]->(
996 ' ->('
997 . ( defined $_[0][1]
998 ? $_[0][1]
999 : 'undef')
1000 . ' != '
1001 . ( defined $_[1]
1002 ? $_[1]
1003 : 'undef')
1004 . ') ->'
1005 . overload::StrVal($result) );
1006 }
1007 return Devel::Spy->new( $result, $followup );
1008 }
1009 ),
1010 '<=>' => Sub::Name::subname(
1011 '<=>',
1012 sub {
1013 my ( $result, $followup );
1014 if ( $_[2] ) {
1015 $result = $_[1] <=> $_[0][0];
1016 $followup = $_[0][2]->(
1017 ' ->('
1018 . ( defined $_[1]
1019 ? $_[1]
1020 : 'undef')
1021 . ' <=> '
1022 . ( defined $_[0][1]
1023 ? $_[0][1]
1024 : 'undef')
1025 . ') ->'
1026 . overload::StrVal($result) );
1027 }
1028 else {
1029 $result = $_[0][0] <=> $_[1];
1030 $followup = $_[0][2]->(
1031 ' ->('
1032 . ( defined $_[0][1]
1033 ? $_[0][1]
1034 : 'undef')
1035 . ' <=> '
1036 . ( defined $_[1]
1037 ? $_[1]
1038 : 'undef')
1039 . ') ->'
1040 . overload::StrVal($result) );
1041 }
1042 return Devel::Spy->new( $result, $followup );
1043 }
1044 ),
1045 'cmp' => Sub::Name::subname(
1046 'cmp',
1047 sub {
1048 my ( $result, $followup );
1049 if ( $_[2] ) {
1050 $result = $_[1] cmp $_[0][0];
1051 $followup = $_[0][2]->(
1052 ' ->('
1053 . ( defined $_[1]
1054 ? $_[1]
1055 : 'undef')
1056 . ' cmp '
1057 . ( defined $_[0][1]
1058 ? $_[0][1]
1059 : 'undef')
1060 . ') ->'
1061 . overload::StrVal($result) );
1062 }
1063 else {
1064 $result = $_[0][0] cmp $_[1];
1065 $followup = $_[0][2]->(
1066 ' ->('
1067 . ( defined $_[0][1]
1068 ? $_[0][1]
1069 : 'undef')
1070 . ' cmp '
1071 . ( defined $_[1]
1072 ? $_[1]
1073 : 'undef')
1074 . ') ->'
1075 . overload::StrVal($result) );
1076 }
1077 return Devel::Spy->new( $result, $followup );
1078 }
1079 ),
1080 'lt' => Sub::Name::subname(
1081 'lt',
1082 sub {
1083 my ( $result, $followup );
1084 if ( $_[2] ) {
1085 $result = $_[1] lt $_[0][0];
1086 $followup = $_[0][2]->(
1087 ' ->('
1088 . ( defined $_[1]
1089 ? $_[1]
1090 : 'undef')
1091 . ' lt '
1092 . ( defined $_[0][1]
1093 ? $_[0][1]
1094 : 'undef')
1095 . ') ->'
1096 . overload::StrVal($result) );
1097 }
1098 else {
1099 $result = $_[0][0] lt $_[1];
1100 $followup = $_[0][2]->(
1101 ' ->('
1102 . ( defined $_[0][1]
1103 ? $_[0][1]
1104 : 'undef')
1105 . ' lt '
1106 . ( defined $_[1]
1107 ? $_[1]
1108 : 'undef')
1109 . ') ->'
1110 . overload::StrVal($result) );
1111 }
1112 return Devel::Spy->new( $result, $followup );
1113 }
1114 ),
1115 'le' => Sub::Name::subname(
1116 'le',
1117 sub {
1118 my ( $result, $followup );
1119 if ( $_[2] ) {
1120 $result = $_[1] le $_[0][0];
1121 $followup = $_[0][2]->(
1122 ' ->('
1123 . ( defined $_[1]
1124 ? $_[1]
1125 : 'undef')
1126 . ' le '
1127 . ( defined $_[0][1]
1128 ? $_[0][1]
1129 : 'undef')
1130 . ') ->'
1131 . overload::StrVal($result) );
1132 }
1133 else {
1134 $result = $_[0][0] le $_[1];
1135 $followup = $_[0][2]->(
1136 ' ->('
1137 . ( defined $_[0][1]
1138 ? $_[0][1]
1139 : 'undef')
1140 . ' le '
1141 . ( defined $_[1]
1142 ? $_[1]
1143 : 'undef')
1144 . ') ->'
1145 . overload::StrVal($result) );
1146 }
1147 return Devel::Spy->new( $result, $followup );
1148 }
1149 ),
1150 'gt' => Sub::Name::subname(
1151 'gt',
1152 sub {
1153 my ( $result, $followup );
1154 if ( $_[2] ) {
1155 $result = $_[1] gt $_[0][0];
1156 $followup = $_[0][2]->(
1157 ' ->('
1158 . ( defined $_[1]
1159 ? $_[1]
1160 : 'undef')
1161 . ' gt '
1162 . ( defined $_[0][1]
1163 ? $_[0][1]
1164 : 'undef')
1165 . ') ->'
1166 . overload::StrVal($result) );
1167 }
1168 else {
1169 $result = $_[0][0] gt $_[1];
1170 $followup = $_[0][2]->(
1171 ' ->('
1172 . ( defined $_[0][1]
1173 ? $_[0][1]
1174 : 'undef')
1175 . ' gt '
1176 . ( defined $_[1]
1177 ? $_[1]
1178 : 'undef')
1179 . ') ->'
1180 . overload::StrVal($result) );
1181 }
1182 return Devel::Spy->new( $result, $followup );
1183 }
1184 ),
1185 'ge' => Sub::Name::subname(
1186 'ge',
1187 sub {
1188 my ( $result, $followup );
1189 if ( $_[2] ) {
1190 $result = $_[1] ge $_[0][0];
1191 $followup = $_[0][2]->(
1192 ' ->('
1193 . ( defined $_[1]
1194 ? $_[1]
1195 : 'undef')
1196 . ' ge '
1197 . ( defined $_[0][1]
1198 ? $_[0][1]
1199 : 'undef')
1200 . ') ->'
1201 . overload::StrVal($result) );
1202 }
1203 else {
1204 $result = $_[0][0] ge $_[1];
1205 $followup = $_[0][2]->(
1206 ' ->('
1207 . ( defined $_[0][1]
1208 ? $_[0][1]
1209 : 'undef')
1210 . ' ge '
1211 . ( defined $_[1]
1212 ? $_[1]
1213 : 'undef')
1214 . ') ->'
1215 . overload::StrVal($result) );
1216 }
1217 return Devel::Spy->new( $result, $followup );
1218 }
1219 ),
1220 'eq' => Sub::Name::subname(
1221 'eq',
1222 sub {
1223 my ( $result, $followup );
1224 if ( $_[2] ) {
1225 $result = $_[1] eq $_[0][0];
1226 $followup = $_[0][2]->(
1227 ' ->('
1228 . ( defined $_[1]
1229 ? $_[1]
1230 : 'undef')
1231 . ' eq '
1232 . ( defined $_[0][1]
1233 ? $_[0][1]
1234 : 'undef')
1235 . ') ->'
1236 . overload::StrVal($result) );
1237 }
1238 else {
1239 $result = $_[0][0] eq $_[1];
1240 $followup = $_[0][2]->(
1241 ' ->('
1242 . ( defined $_[0][1]
1243 ? $_[0][1]
1244 : 'undef')
1245 . ' eq '
1246 . ( defined $_[1]
1247 ? $_[1]
1248 : 'undef')
1249 . ') ->'
1250 . overload::StrVal($result) );
1251 }
1252 return Devel::Spy->new( $result, $followup );
1253 }
1254 ),
1255 'ne' => Sub::Name::subname(
1256 'ne',
1257 sub {
1258 my ( $result, $followup );
1259 if ( $_[2] ) {
1260 $result = $_[1] ne $_[0][0];
1261 $followup = $_[0][2]->(
1262 ' ->('
1263 . ( defined $_[1]
1264 ? $_[1]
1265 : 'undef')
1266 . ' ne '
1267 . ( defined $_[0][1]
1268 ? $_[0][1]
1269 : 'undef')
1270 . ') ->'
1271 . overload::StrVal($result) );
1272 }
1273 else {
1274 $result = $_[0][0] ne $_[1];
1275 $followup = $_[0][2]->(
1276 ' ->('
1277 . ( defined $_[0][1]
1278 ? $_[0][1]
1279 : 'undef')
1280 . ' ne '
1281 . ( defined $_[1]
1282 ? $_[1]
1283 : 'undef')
1284 . ') ->'
1285 . overload::StrVal($result) );
1286 }
1287 return Devel::Spy->new( $result, $followup );
1288 }
1289 ),
1290 '&' => Sub::Name::subname(
1291 '&',
1292 sub {
1293 my ( $result, $followup );
1294 if ( $_[2] ) {
1295 $result = $_[1] & $_[0][0];
1296 $followup = $_[0][2]->(
1297 ' ->('
1298 . ( defined $_[1]
1299 ? $_[1]
1300 : 'undef')
1301 . ' & '
1302 . ( defined $_[0][1]
1303 ? $_[0][1]
1304 : 'undef')
1305 . ') ->'
1306 . overload::StrVal($result) );
1307 }
1308 else {
1309 $result = $_[0][0] & $_[1];
1310 $followup = $_[0][2]->(
1311 ' ->('
1312 . ( defined $_[0][1]
1313 ? $_[0][1]
1314 : 'undef')
1315 . ' & '
1316 . ( defined $_[1]
1317 ? $_[1]
1318 : 'undef')
1319 . ') ->'
1320 . overload::StrVal($result) );
1321 }
1322 return Devel::Spy->new( $result, $followup );
1323 }
1324 ),
1325 '|' => Sub::Name::subname(
1326 '|',
1327 sub {
1328 my ( $result, $followup );
1329 if ( $_[2] ) {
1330 $result = $_[1] | $_[0][0];
1331 $followup = $_[0][2]->(
1332 ' ->('
1333 . ( defined $_[1]
1334 ? $_[1]
1335 : 'undef')
1336 . ' | '
1337 . ( defined $_[0][1]
1338 ? $_[0][1]
1339 : 'undef')
1340 . ') ->'
1341 . overload::StrVal($result) );
1342 }
1343 else {
1344 $result = $_[0][0] | $_[1];
1345 $followup = $_[0][2]->(
1346 ' ->('
1347 . ( defined $_[0][1]
1348 ? $_[0][1]
1349 : 'undef')
1350 . ' | '
1351 . ( defined $_[1]
1352 ? $_[1]
1353 : 'undef')
1354 . ') ->'
1355 . overload::StrVal($result) );
1356 }
1357 return Devel::Spy->new( $result, $followup );
1358 }
1359 ),
1360 '^' => Sub::Name::subname(
1361 '^',
1362 sub {
1363 my ( $result, $followup );
1364 if ( $_[2] ) {
1365 $result = $_[1] ^ $_[0][0];
1366 $followup = $_[0][2]->(
1367 ' ->('
1368 . ( defined $_[1]
1369 ? $_[1]
1370 : 'undef')
1371 . ' ^ '
1372 . ( defined $_[0][1]
1373 ? $_[0][1]
1374 : 'undef')
1375 . ') ->'
1376 . overload::StrVal($result) );
1377 }
1378 else {
1379 $result = $_[0][0] ^ $_[1];
1380 $followup = $_[0][2]->(
1381 ' ->('
1382 . ( defined $_[0][1]
1383 ? $_[0][1]
1384 : 'undef')
1385 . ' ^ '
1386 . ( defined $_[1]
1387 ? $_[1]
1388 : 'undef')
1389 . ') ->'
1390 . overload::StrVal($result) );
1391 }
1392 return Devel::Spy->new( $result, $followup );
1393 }
1394 ),
1395 '&.' => Sub::Name::subname(
1396 '&.',
1397 sub {
1398 my ( $result, $followup );
1399 if ( $_[2] ) {
1400 $result = $_[1] &. $_[0][0];
1401 $followup = $_[0][2]->(
1402 ' ->('
1403 . ( defined $_[1]
1404 ? $_[1]
1405 : 'undef')
1406 . ' &. '
1407 . ( defined $_[0][1]
1408 ? $_[0][1]
1409 : 'undef')
1410 . ') ->'
1411 . overload::StrVal($result) );
1412 }
1413 else {
1414 $result = $_[0][0] &. $_[1];
1415 $followup = $_[0][2]->(
1416 ' ->('
1417 . ( defined $_[0][1]
1418 ? $_[0][1]
1419 : 'undef')
1420 . ' &. '
1421 . ( defined $_[1]
1422 ? $_[1]
1423 : 'undef')
1424 . ') ->'
1425 . overload::StrVal($result) );
1426 }
1427 return Devel::Spy->new( $result, $followup );
1428 }
1429 ),
1430 '&.=' => Sub::Name::subname(
1431 '&.=',
1432 sub {
1433 my ( $result, $followup );
1434 if ( $_[2] ) {
1435 $result = $_[1] &.= $_[0][0];
1436 $followup = $_[0][2]->(
1437 ' ->('
1438 . ( defined $_[1]
1439 ? $_[1]
1440 : 'undef')
1441 . ' &.= '
1442 . ( defined $_[0][1]
1443 ? $_[0][1]
1444 : 'undef')
1445 . ') ->'
1446 . overload::StrVal($result) );
1447 }
1448 else {
1449 $result = $_[0][0] &.= $_[1];
1450 $followup = $_[0][2]->(
1451 ' ->('
1452 . ( defined $_[0][1]
1453 ? $_[0][1]
1454 : 'undef')
1455 . ' &.= '
1456 . ( defined $_[1]
1457 ? $_[1]
1458 : 'undef')
1459 . ') ->'
1460 . overload::StrVal($result) );
1461 }
1462 return Devel::Spy->new( $result, $followup );
1463 }
1464 ),
1465 '|.' => Sub::Name::subname(
1466 '|.',
1467 sub {
1468 my ( $result, $followup );
1469 if ( $_[2] ) {
1470 $result = $_[1] |. $_[0][0];
1471 $followup = $_[0][2]->(
1472 ' ->('
1473 . ( defined $_[1]
1474 ? $_[1]
1475 : 'undef')
1476 . ' |. '
1477 . ( defined $_[0][1]
1478 ? $_[0][1]
1479 : 'undef')
1480 . ') ->'
1481 . overload::StrVal($result) );
1482 }
1483 else {
1484 $result = $_[0][0] |. $_[1];
1485 $followup = $_[0][2]->(
1486 ' ->('
1487 . ( defined $_[0][1]
1488 ? $_[0][1]
1489 : 'undef')
1490 . ' |. '
1491 . ( defined $_[1]
1492 ? $_[1]
1493 : 'undef')
1494 . ') ->'
1495 . overload::StrVal($result) );
1496 }
1497 return Devel::Spy->new( $result, $followup );
1498 }
1499 ),
1500 '|.=' => Sub::Name::subname(
1501 '|.=',
1502 sub {
1503 my ( $result, $followup );
1504 if ( $_[2] ) {
1505 $result = $_[1] |.= $_[0][0];
1506 $followup = $_[0][2]->(
1507 ' ->('
1508 . ( defined $_[1]
1509 ? $_[1]
1510 : 'undef')
1511 . ' |.= '
1512 . ( defined $_[0][1]
1513 ? $_[0][1]
1514 : 'undef')
1515 . ') ->'
1516 . overload::StrVal($result) );
1517 }
1518 else {
1519 $result = $_[0][0] |.= $_[1];
1520 $followup = $_[0][2]->(
1521 ' ->('
1522 . ( defined $_[0][1]
1523 ? $_[0][1]
1524 : 'undef')
1525 . ' |.= '
1526 . ( defined $_[1]
1527 ? $_[1]
1528 : 'undef')
1529 . ') ->'
1530 . overload::StrVal($result) );
1531 }
1532 return Devel::Spy->new( $result, $followup );
1533 }
1534 ),
1535 '^.' => Sub::Name::subname(
1536 '^.',
1537 sub {
1538 my ( $result, $followup );
1539 if ( $_[2] ) {
1540 $result = $_[1] ^. $_[0][0];
1541 $followup = $_[0][2]->(
1542 ' ->('
1543 . ( defined $_[1]
1544 ? $_[1]
1545 : 'undef')
1546 . ' ^. '
1547 . ( defined $_[0][1]
1548 ? $_[0][1]
1549 : 'undef')
1550 . ') ->'
1551 . overload::StrVal($result) );
1552 }
1553 else {
1554 $result = $_[0][0] ^. $_[1];
1555 $followup = $_[0][2]->(
1556 ' ->('
1557 . ( defined $_[0][1]
1558 ? $_[0][1]
1559 : 'undef')
1560 . ' ^. '
1561 . ( defined $_[1]
1562 ? $_[1]
1563 : 'undef')
1564 . ') ->'
1565 . overload::StrVal($result) );
1566 }
1567 return Devel::Spy->new( $result, $followup );
1568 }
1569 ),
1570 '^.=' => Sub::Name::subname(
1571 '^.=',
1572 sub {
1573 my ( $result, $followup );
1574 if ( $_[2] ) {
1575 $result = $_[1] ^.= $_[0][0];
1576 $followup = $_[0][2]->(
1577 ' ->('
1578 . ( defined $_[1]
1579 ? $_[1]
1580 : 'undef')
1581 . ' ^.= '
1582 . ( defined $_[0][1]
1583 ? $_[0][1]
1584 : 'undef')
1585 . ') ->'
1586 . overload::StrVal($result) );
1587 }
1588 else {
1589 $result = $_[0][0] ^.= $_[1];
1590 $followup = $_[0][2]->(
1591 ' ->('
1592 . ( defined $_[0][1]
1593 ? $_[0][1]
1594 : 'undef')
1595 . ' ^.= '
1596 . ( defined $_[1]
1597 ? $_[1]
1598 : 'undef')
1599 . ') ->'
1600 . overload::StrVal($result) );
1601 }
1602 return Devel::Spy->new( $result, $followup );
1603 }
1604 ),
1605 '~~' => Sub::Name::subname(
1606 '~~',
1607 sub {
1608 my ( $result, $followup );
1609 if ( $_[2] ) {
1610 $result = $_[1] ~~ $_[0][0];
1611 $followup = $_[0][2]->(
1612 ' ->('
1613 . ( defined $_[1]
1614 ? $_[1]
1615 : 'undef')
1616 . ' ~~ '
1617 . ( defined $_[0][1]
1618 ? $_[0][1]
1619 : 'undef')
1620 . ') ->'
1621 . overload::StrVal($result) );
1622 }
1623 else {
1624 $result = $_[0][0] ~~ $_[1];
1625 $followup = $_[0][2]->(
1626 ' ->('
1627 . ( defined $_[0][1]
1628 ? $_[0][1]
1629 : 'undef')
1630 . ' ~~ '
1631 . ( defined $_[1]
1632 ? $_[1]
1633 : 'undef')
1634 . ') ->'
1635 . overload::StrVal($result) );
1636 }
1637 return Devel::Spy->new( $result, $followup );
1638 }
1639 ),
1640 '++' => Sub::Name::subname(
1641 '++',
1642 sub {
1643 my $result = ++ $_[0][0];
1644 my $followup = $_[0][2]->(
1645 ' ->(++ '
1646 . ( defined $_[0][1]
1647 ? $_[0][1]
1648 : 'undef' )
1649 . ') ->'
1650 . overload::StrVal($result) );
1651 return Devel::Spy->new( $result, $followup );
1652 }
1653 ),
1654 '--' => Sub::Name::subname(
1655 '--',
1656 sub {
1657 my $result = -- $_[0][0];
1658 my $followup = $_[0][2]->(
1659 ' ->(-- '
1660 . ( defined $_[0][1]
1661 ? $_[0][1]
1662 : 'undef' )
1663 . ') ->'
1664 . overload::StrVal($result) );
1665 return Devel::Spy->new( $result, $followup );
1666 }
1667 ),
1668 '+=' => Sub::Name::subname(
1669 '+=',
1670 sub {
1671 $_[0][0] += $_[1];
1672 my $followup = $_[0][2]->(
1673 '->(+= '
1674 . ( defined $_[1]
1675 ? $_[1]
1676 : 'undef' )
1677 . ') ->'
1678 . overload::StrVal($_[0][1]) );
1679 $_[0] = Devel::Spy->new( $_[0][1], $followup );
1680 }
1681 ),
1682 '-=' => Sub::Name::subname(
1683 '-=',
1684 sub {
1685 $_[0][0] -= $_[1];
1686 my $followup = $_[0][2]->(
1687 '->(-= '
1688 . ( defined $_[1]
1689 ? $_[1]
1690 : 'undef' )
1691 . ') ->'
1692 . overload::StrVal($_[0][1]) );
1693 $_[0] = Devel::Spy->new( $_[0][1], $followup );
1694 }
1695 ),
1696 '*=' => Sub::Name::subname(
1697 '*=',
1698 sub {
1699 $_[0][0] *= $_[1];
1700 my $followup = $_[0][2]->(
1701 '->(*= '
1702 . ( defined $_[1]
1703 ? $_[1]
1704 : 'undef' )
1705 . ') ->'
1706 . overload::StrVal($_[0][1]) );
1707 $_[0] = Devel::Spy->new( $_[0][1], $followup );
1708 }
1709 ),
1710 '/=' => Sub::Name::subname(
1711 '/=',
1712 sub {
1713 $_[0][0] /= $_[1];
1714 my $followup = $_[0][2]->(
1715 '->(/= '
1716 . ( defined $_[1]
1717 ? $_[1]
1718 : 'undef' )
1719 . ') ->'
1720 . overload::StrVal($_[0][1]) );
1721 $_[0] = Devel::Spy->new( $_[0][1], $followup );
1722 }
1723 ),
1724 '%=' => Sub::Name::subname(
1725 '%=',
1726 sub {
1727 $_[0][0] %= $_[1];
1728 my $followup = $_[0][2]->(
1729 '->(%= '
1730 . ( defined $_[1]
1731 ? $_[1]
1732 : 'undef' )
1733 . ') ->'
1734 . overload::StrVal($_[0][1]) );
1735 $_[0] = Devel::Spy->new( $_[0][1], $followup );
1736 }
1737 ),
1738 '**=' => Sub::Name::subname(
1739 '**=',
1740 sub {
1741 $_[0][0] **= $_[1];
1742 my $followup = $_[0][2]->(
1743 '->(**= '
1744 . ( defined $_[1]
1745 ? $_[1]
1746 : 'undef' )
1747 . ') ->'
1748 . overload::StrVal($_[0][1]) );
1749 $_[0] = Devel::Spy->new( $_[0][1], $followup );
1750 }
1751 ),
1752 '<<=' => Sub::Name::subname(
1753 '<<=',
1754 sub {
1755 $_[0][0] <<= $_[1];
1756 my $followup = $_[0][2]->(
1757 '->(<<= '
1758 . ( defined $_[1]
1759 ? $_[1]
1760 : 'undef' )
1761 . ') ->'
1762 . overload::StrVal($_[0][1]) );
1763 $_[0] = Devel::Spy->new( $_[0][1], $followup );
1764 }
1765 ),
1766 '>>=' => Sub::Name::subname(
1767 '>>=',
1768 sub {
1769 $_[0][0] >>= $_[1];
1770 my $followup = $_[0][2]->(
1771 '->(>>= '
1772 . ( defined $_[1]
1773 ? $_[1]
1774 : 'undef' )
1775 . ') ->'
1776 . overload::StrVal($_[0][1]) );
1777 $_[0] = Devel::Spy->new( $_[0][1], $followup );
1778 }
1779 ),
1780 'x=' => Sub::Name::subname(
1781 'x=',
1782 sub {
1783 $_[0][0] x= $_[1];
1784 my $followup = $_[0][2]->(
1785 '->(x= '
1786 . ( defined $_[1]
1787 ? $_[1]
1788 : 'undef' )
1789 . ') ->'
1790 . overload::StrVal($_[0][1]) );
1791 $_[0] = Devel::Spy->new( $_[0][1], $followup );
1792 }
1793 ),
1794 '.=' => Sub::Name::subname(
1795 '.=',
1796 sub {
1797 $_[0][0] .= $_[1];
1798 my $followup = $_[0][2]->(
1799 '->(.= '
1800 . ( defined $_[1]
1801 ? $_[1]
1802 : 'undef' )
1803 . ') ->'
1804 . overload::StrVal($_[0][1]) );
1805 $_[0] = Devel::Spy->new( $_[0][1], $followup );
1806 }
1807 ),
1808 '&=' => Sub::Name::subname(
1809 '&=',
1810 sub {
1811 $_[0][0] &= $_[1];
1812 my $followup = $_[0][2]->(
1813 '->(&= '
1814 . ( defined $_[1]
1815 ? $_[1]
1816 : 'undef' )
1817 . ') ->'
1818 . overload::StrVal($_[0][1]) );
1819 $_[0] = Devel::Spy->new( $_[0][1], $followup );
1820 }
1821 ),
1822 '|=' => Sub::Name::subname(
1823 '|=',
1824 sub {
1825 $_[0][0] |= $_[1];
1826 my $followup = $_[0][2]->(
1827 '->(|= '
1828 . ( defined $_[1]
1829 ? $_[1]
1830 : 'undef' )
1831 . ') ->'
1832 . overload::StrVal($_[0][1]) );
1833 $_[0] = Devel::Spy->new( $_[0][1], $followup );
1834 }
1835 ),
1836 '^=' => Sub::Name::subname(
1837 '^=',
1838 sub {
1839 $_[0][0] ^= $_[1];
1840 my $followup = $_[0][2]->(
1841 '->(^= '
1842 . ( defined $_[1]
1843 ? $_[1]
1844 : 'undef' )
1845 . ') ->'
1846 . overload::StrVal($_[0][1]) );
1847 $_[0] = Devel::Spy->new( $_[0][1], $followup );
1848 }
1849 ),
1850 '&.=' => Sub::Name::subname(
1851 '&.=',
1852 sub {
1853 $_[0][0] &.= $_[1];
1854 my $followup = $_[0][2]->(
1855 '->(&.= '
1856 . ( defined $_[1]
1857 ? $_[1]
1858 : 'undef' )
1859 . ') ->'
1860 . overload::StrVal($_[0][1]) );
1861 $_[0] = Devel::Spy->new( $_[0][1], $followup );
1862 }
1863 ),
1864 '|.=' => Sub::Name::subname(
1865 '|.=',
1866 sub {
1867 $_[0][0] |.= $_[1];
1868 my $followup = $_[0][2]->(
1869 '->(|.= '
1870 . ( defined $_[1]
1871 ? $_[1]
1872 : 'undef' )
1873 . ') ->'
1874 . overload::StrVal($_[0][1]) );
1875 $_[0] = Devel::Spy->new( $_[0][1], $followup );
1876 }
1877 ),
1878 '^.=' => Sub::Name::subname(
1879 '^.=',
1880 sub {
1881 $_[0][0] ^.= $_[1];
1882 my $followup = $_[0][2]->(
1883 '->(^.= '
1884 . ( defined $_[1]
1885 ? $_[1]
1886 : 'undef' )
1887 . ') ->'
1888 . overload::StrVal($_[0][1]) );
1889 $_[0] = Devel::Spy->new( $_[0][1], $followup );
1890 }
1891 ),
1892 'neg' => Sub::Name::subname(
1893 'neg',
1894 sub {
1895 my $result = ! $_[0][0];
1896 my $followup = $_[0][2]->(
1897 " ->(neg"
1898 . ( defined $_[0][1]
1899 ? $_[0][1]
1900 : 'undef')
1901 . ') ->'
1902 . overload::StrVal($result) );
1903 return Devel::Spy->new( $result, $followup );
1904 }
1905 ),
1906 '!' => Sub::Name::subname(
1907 '!',
1908 sub {
1909 my $result = ! $_[0][0];
1910 my $followup = $_[0][2]->(
1911 " ->(!"
1912 . ( defined $_[0][1]
1913 ? $_[0][1]
1914 : 'undef')
1915 . ') ->'
1916 . overload::StrVal($result) );
1917 return Devel::Spy->new( $result, $followup );
1918 }
1919 ),
1920 '~' => Sub::Name::subname(
1921 '~',
1922 sub {
1923 my $result = ~ $_[0][0];
1924 my $followup = $_[0][2]->(
1925 " ->(~"
1926 . ( defined $_[0][1]
1927 ? $_[0][1]
1928 : 'undef')
1929 . ') ->'
1930 . overload::StrVal($result) );
1931 return Devel::Spy->new( $result, $followup );
1932 }
1933 ),
1934 '~.' => Sub::Name::subname(
1935 '~.',
1936 sub {
1937 my $result = ~. $_[0][0];
1938 my $followup = $_[0][2]->(
1939 " ->(~."
1940 . ( defined $_[0][1]
1941 ? $_[0][1]
1942 : 'undef')
1943 . ') ->'
1944 . overload::StrVal($result) );
1945 return Devel::Spy->new( $result, $followup );
1946 }
1947 ),
1948 'cos' => Sub::Name::subname(
1949 'cos',
1950 sub {
1951 my $result = cos $_[0][0];
1952 my $followup = $_[0][2]->(
1953 " ->(cos"
1954 . ( defined $_[0][1]
1955 ? $_[0][1]
1956 : 'undef')
1957 . ') ->'
1958 . overload::StrVal($result) );
1959 return Devel::Spy->new( $result, $followup );
1960 }
1961 ),
1962 'sin' => Sub::Name::subname(
1963 'sin',
1964 sub {
1965 my $result = sin $_[0][0];
1966 my $followup = $_[0][2]->(
1967 " ->(sin"
1968 . ( defined $_[0][1]
1969 ? $_[0][1]
1970 : 'undef')
1971 . ') ->'
1972 . overload::StrVal($result) );
1973 return Devel::Spy->new( $result, $followup );
1974 }
1975 ),
1976 'exp' => Sub::Name::subname(
1977 'exp',
1978 sub {
1979 my $result = exp $_[0][0];
1980 my $followup = $_[0][2]->(
1981 " ->(exp"
1982 . ( defined $_[0][1]
1983 ? $_[0][1]
1984 : 'undef')
1985 . ') ->'
1986 . overload::StrVal($result) );
1987 return Devel::Spy->new( $result, $followup );
1988 }
1989 ),
1990 'abs' => Sub::Name::subname(
1991 'abs',
1992 sub {
1993 my $result = abs $_[0][0];
1994 my $followup = $_[0][2]->(
1995 " ->(abs"
1996 . ( defined $_[0][1]
1997 ? $_[0][1]
1998 : 'undef')
1999 . ') ->'
2000 . overload::StrVal($result) );
2001 return Devel::Spy->new( $result, $followup );
2002 }
2003 ),
2004 'log' => Sub::Name::subname(
2005 'log',
2006 sub {
2007 my $result = log $_[0][0];
2008 my $followup = $_[0][2]->(
2009 " ->(log"
2010 . ( defined $_[0][1]
2011 ? $_[0][1]
2012 : 'undef')
2013 . ') ->'
2014 . overload::StrVal($result) );
2015 return Devel::Spy->new( $result, $followup );
2016 }
2017 ),
2018 'sqrt' => Sub::Name::subname(
2019 'sqrt',
2020 sub {
2021 my $result = sqrt $_[0][0];
2022 my $followup = $_[0][2]->(
2023 " ->(sqrt"
2024 . ( defined $_[0][1]
2025 ? $_[0][1]
2026 : 'undef')
2027 . ') ->'
2028 . overload::StrVal($result) );
2029 return Devel::Spy->new( $result, $followup );
2030 }
2031 ),
2032 'int' => Sub::Name::subname(
2033 'int',
2034 sub {
2035 my $result = int $_[0][0];
2036 my $followup = $_[0][2]->(
2037 " ->(int"
2038 . ( defined $_[0][1]
2039 ? $_[0][1]
2040 : 'undef')
2041 . ') ->'
2042 . overload::StrVal($result) );
2043 return Devel::Spy->new( $result, $followup );
2044 }
2045 ),
2046 );
2047  
2048 overload->import( @overloading );
2049  
2050 # TEST: Verify that all overloadable operations have been overloaded
2051 for my $category ( sort keys %overload::ops ) {
2052 my @ops = split ' ', $overload::ops{$category};
2053 for my $op ( @ops ) {
2054 next if $category eq 'special' && $op eq 'nomethod';
2055 next if $category eq 'special' && $op eq 'fallback';
2056  
2057 no strict 'refs';
2058  
2059 next if defined &{"Devel::Spy::_obj::($op"};
2060  
2061 warn "Missing op [$op] from category [$category]";
2062 }
2063 }
2064  
2065 # Clean up the few things I've generated in this namespace
2066 delete @Devel::Spy::_obj::{qw(
2067 BEGIN
2068 __ANON__
2069 )};
2070  
2071 1;