Skip to content

Instantly share code, notes, and snippets.

@dur-randir
Created October 25, 2018 10:02
Show Gist options
  • Save dur-randir/bb09082b1663410e8029c6420a87b208 to your computer and use it in GitHub Desktop.
Save dur-randir/bb09082b1663410e8029c6420a87b208 to your computer and use it in GitHub Desktop.
package Foo;
use overload '&{}' => sub { \&call_cplusplus };
sub call_cplusplus { warn 42 }
sub new {return bless sub {}, shift}
package main;
my $obj = Foo->new;
use Scalar::Util qw/reftype/;
warn reftype $obj;
$obj->();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment