Skip to content

Instantly share code, notes, and snippets.

@tobyink
Created April 17, 2013 09:49
Show Gist options
  • Select an option

  • Save tobyink/5403101 to your computer and use it in GitHub Desktop.

Select an option

Save tobyink/5403101 to your computer and use it in GitHub Desktop.
use v5.14;
package XYZ {
use Moo;
has attr1 => (
is => "ro",
isa => sub { $_[0] = __FILE__ if $_[0] eq '1' },
);
}
say XYZ->new(attr1 => 1)->attr1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment