Last active
August 29, 2015 14:05
-
-
Save yanick/958333df0e62152ea89a to your computer and use it in GitHub Desktop.
==b o.o and ==q ò.ó operators
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use 5.20.0; | |
use utf8; | |
use experimental 'postderef'; | |
package Approved; | |
sub o { '9.9 oh my... suuuuure, why not?' } | |
sub b { pop } | |
use overload | |
'""' => sub { $_[0]->$* }, | |
'==' => sub { $_[1] > 0 ? $_[0] : !$_[0] }; | |
my( $bad, $good ) = map { bless \$_, 'Approved' } 0..1; | |
say "yay" if $good ==b o.o; | |
say "boo" if $bad ==q ಠ_ಠ ; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment