Skip to content

Instantly share code, notes, and snippets.

@yanick
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yanick/958333df0e62152ea89a to your computer and use it in GitHub Desktop.
Save yanick/958333df0e62152ea89a to your computer and use it in GitHub Desktop.
==b o.o and ==q ò.ó operators
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