Skip to content

Instantly share code, notes, and snippets.

@tene
Created December 13, 2010 09:31
Show Gist options
  • Save tene/738830 to your computer and use it in GitHub Desktop.
Save tene/738830 to your computer and use it in GitHub Desktop.
[sweeks@sweeks-laptop treed-enum]$ perl -MLogger -E '$l = Logger->new(rgb=>"red"); say $l->rgb; Log->rawr'
red
lol ohai
use MooseX::Declare;
use feature ':5.10';
class Log {
use Moose::Util::TypeConstraints;
our $foo;
BEGIN {
enum 'RGB' => qw/red green blue/;
$foo = "lol ohai";
}
use Logger;
sub rawr {
say $foo;
}
}
use MooseX::Declare;
class Logger {
use Log;
has 'rgb' => ( isa => 'RGB', is => 'rw' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment