Last active
December 17, 2015 07:08
-
-
Save sycobuny/5569967 to your computer and use it in GitHub Desktop.
Kinda sad that this doesn't actually work :-(
This file contains hidden or 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
#!/usr/bin/env perl | |
use v5.18; | |
use warnings; | |
no warnings qw(experimental::lexical_subs); | |
use feature qw(lexical_subs); | |
package MyObject { | |
sub new { bless({}, __PACKAGE__) } | |
sub print_hello { shift->print("Hello, World") } | |
my sub print { | |
my ($self, $str) = @_; | |
say $str; | |
} | |
} | |
my ($obj) = MyObject->new(); | |
$obj->print_hello(); | |
__END__ | |
% perl lexical_subs_sad.pl | |
Can't locate object method "print" via package "MyObject" at lexical_subs_sad.pl line 12. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment