Skip to content

Instantly share code, notes, and snippets.

@tadzik
Created September 9, 2011 17:09
Show Gist options
  • Save tadzik/1206761 to your computer and use it in GitHub Desktop.
Save tadzik/1206761 to your computer and use it in GitHub Desktop.
┌─[tadzik@yavin4]─[~/src/mo-pm] (master)
└─[%]─> cat foo.pl
use 5.014;
package Foo {
use Mo;
has 'foo', default => sub { say 'defaulting!'; 5 }
}
my $a = Foo->new;
say $a->foo;
$a->foo(undef);
say $a->foo;
┌─[tadzik@yavin4]─[~/src/mo-pm] (master)
└─[%]─> PERL5LIB=lib perl foo.pl
defaulting!
5
defaulting!
5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment