| 1 | package Code::Style::Kit::Parts::Mojo; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | our $VERSION = '1.0.3'; # VERSION | ||
| 5 | # ABSTRACT: Mojo-based OO | ||
| 6 | |||
| 7 | |||
| 8 | use Import::Into; | ||
| 9 | use Carp; | ||
| 10 | |||
| 11 | sub feature_class_default { 0 } | ||
| 12 | sub feature_class_takes_arguments { 1 } | ||
| 13 | sub feature_class_export { | ||
| 14 | my ($self, $caller, @arguments) = @_; | ||
| 15 | |||
| 16 | croak "can't be both a class and a role" | ||
| 17 | if $self->is_feature_requested('role'); | ||
| 18 | |||
| 19 | require Mojo::Base; | ||
| 20 | Mojo::Base->import::into( | ||
| 21 | $caller, | ||
| 22 | @arguments ? ( $arguments[0] ) : ( '-base' ), | ||
| 23 | ); | ||
| 24 | } | ||
| 25 | |||
| 26 | sub feature_role_default { 0 } | ||
| 27 | sub feature_role_export { | ||
| 28 | my ($self, $caller) = @_; | ||
| 29 | |||
| 30 | croak "can't be both a class and a role" | ||
| 31 | if $self->is_feature_requested('class'); | ||
| 32 | |||
| 33 | require Mojo::Base; | ||
| 34 | Mojo::Base->import::into( | ||
| 35 | $caller, '-role', | ||
| 36 | ); | ||
| 37 | } | ||
| 38 | |||
| 39 | 1; | ||
| 40 | |||
| 41 | __END__ |