| 1 | package OpenSky::API::Core; | ||
| 2 | |||
| 3 | use Moose; | ||
| 4 | use OpenSky::API::Types qw( | ||
| 5 | ArrayRef | ||
| 6 | Defined | ||
| 7 | InstanceOf | ||
| 8 | Num | ||
| 9 | PositiveOrZeroInt | ||
| 10 | Str | ||
| 11 | Undef | ||
| 12 | ); | ||
| 13 | our $VERSION = '0.002'; | ||
| 14 | use experimental qw(signatures); | ||
| 15 | |||
| 16 | around 'BUILDARGS' => sub ( $orig, $class, $state ) { | ||
| 17 | my %value_for; | ||
| 18 | @value_for{ $class->_get_params } = @$state; | ||
| 19 | return $class->$orig(%value_for); | ||
| 20 | }; | ||
| 21 | |||
| 22 | sub _get_params ($class) { | ||
| 23 | croak("You must override _get_params in $class"); | ||
| 24 | } | ||
| 25 | |||
| 26 | 1; | ||
| 27 | |||
| 28 | __END__ | ||
| 29 | |||
| 30 | =pod | ||
| 31 | |||
| 32 | =encoding UTF-8 | ||
| 33 | |||
| 34 | =head1 NAME | ||
| 35 | |||
| 36 | OpenSky::API::Core | ||
| 37 | |||
| 38 | =head1 VERSION | ||
| 39 | |||
| 40 | version 0.002 | ||
| 41 | |||
| 42 | =head1 AUTHOR | ||
| 43 | |||
| 44 | Curtis "Ovid" Poe <curtis.poe@gmail.com> | ||
| 45 | |||
| 46 | =head1 COPYRIGHT AND LICENSE | ||
| 47 | |||
| 48 | This software is Copyright (c) 2023 by Curtis "Ovid" Poe. | ||
| 49 | |||
| 50 | This is free software, licensed under: | ||
| 51 | |||
| 52 | The Artistic License 2.0 (GPL Compatible) | ||
| 53 | |||
| 54 | =cut |