Created
January 20, 2018 06:29
-
-
Save kga/f24a72dfe9b2f58b9fdbc7bd9ec98377 to your computer and use it in GitHub Desktop.
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 strict; | |
use warnings; | |
use utf8; | |
package Foo { | |
use overload ( | |
bool => sub { warn 'this is bool' }, | |
q{""} => sub { warn 'this is stringify' }, | |
); | |
sub new { bless {}, shift } | |
} | |
my $foo = Foo->new; | |
warn 'hi' if $foo; | |
warn 'hoi' if defined $foo; | |
my $bar = $foo; | |
my $baz = $foo . 'fooray'; |
Author
kga
commented
Jan 20, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment