Skip to content

Instantly share code, notes, and snippets.

@kan
Created March 7, 2014 06:35
Show Gist options
  • Save kan/9406402 to your computer and use it in GitHub Desktop.
Save kan/9406402 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
{
package Foo;
use Mouse;
has 'foo' => ( is => 'rw', isa => 'Str', lazy_build => 1 );
sub _build_foo { 'Foo!!' }
1;
}
my $foo = Foo->new;
warn $foo->foo;
$foo->foo('Bar');
warn $foo->foo;
$foo->clear_foo;
warn $foo->foo;
__END__
Foo!! at hoge.pl line 21.
Bar at hoge.pl line 25.
Foo!! at hoge.pl line 29.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment