| 1 | use Renard::Incunabula::Common::Setup; | ||
| 2 | package Intertangle::Punchcard::Attributes; | ||
| 3 | # ABSTRACT: Attributes for constraint variables | ||
| 4 | $Intertangle::Punchcard::Attributes::VERSION = '0.001'; | ||
| 5 | use Moo::_Utils qw(_install_coderef); | ||
| 6 | use Intertangle::Punchcard::Backend::Kiwisolver::Symbolic; | ||
| 7 | |||
| 8 | sub import { | ||
| 9 | my $target = caller; | ||
| 10 | my $has = $target->can( "has" ) or die "Moo not loaded in caller: $target"; | ||
| 11 | _install_coderef $target. "::variable" => my $variable = sub { | ||
| 12 | my ($name, @args) = @_; | ||
| 13 | $has->($name, | ||
| 14 | is => 'lazy', | ||
| 15 | builder => sub { | ||
| 16 | Intertangle::Punchcard::Backend::Kiwisolver::Symbolic->new( name => $name ); | ||
| 17 | }, | ||
| 18 | @args, | ||
| 19 | ); | ||
| 20 | }; | ||
| 21 | |||
| 22 | if (my $info = $Role::Tiny::INFO{$target}) { | ||
| 23 | $info->{not_methods}{$variable} = $variable; | ||
| 24 | } | ||
| 25 | |||
| 26 | undef; | ||
| 27 | } | ||
| 28 | |||
| 29 | 1; | ||
| 30 | |||
| 31 | __END__ | ||
| 32 | |||
| 33 | =pod | ||
| 34 | |||
| 35 | =encoding UTF-8 | ||
| 36 | |||
| 37 | =head1 NAME | ||
| 38 | |||
| 39 | Intertangle::Punchcard::Attributes - Attributes for constraint variables | ||
| 40 | |||
| 41 | =head1 VERSION | ||
| 42 | |||
| 43 | version 0.001 | ||
| 44 | |||
| 45 | =head1 AUTHOR | ||
| 46 | |||
| 47 | Zakariyya Mughal <zmughal@cpan.org> | ||
| 48 | |||
| 49 | =head1 COPYRIGHT AND LICENSE | ||
| 50 | |||
| 51 | This software is copyright (c) 2019 by Zakariyya Mughal. | ||
| 52 | |||
| 53 | This is free software; you can redistribute it and/or modify it under | ||
| 54 | the same terms as the Perl 5 programming language system itself. | ||
| 55 | |||
| 56 | =cut |