use a simple eval
This commit is contained in:
parent
64b3a06edf
commit
2e684886f7
@ -8,8 +8,6 @@ use Dancer2::Plugin::JsonApi::Registry;
|
|||||||
use Dancer2::Plugin;
|
use Dancer2::Plugin;
|
||||||
use Dancer2::Serializer::JsonApi;
|
use Dancer2::Serializer::JsonApi;
|
||||||
|
|
||||||
use experimental qw/ try /;
|
|
||||||
|
|
||||||
has registry => (
|
has registry => (
|
||||||
plugin_keyword => 'jsonapi_registry',
|
plugin_keyword => 'jsonapi_registry',
|
||||||
is => 'ro',
|
is => 'ro',
|
||||||
@ -33,9 +31,8 @@ sub jsonapi : PluginKeyword ( $plugin, $type, $sub ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub BUILD ( $self, @ ) {
|
sub BUILD ( $self, @ ) {
|
||||||
my $serializer = do {
|
my $serializer = eval {
|
||||||
try { $self->app->serializer_engine } catch ($e) {
|
$self->app->serializer_engine
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
unless ($serializer) {
|
unless ($serializer) {
|
||||||
|
Loading…
Reference in New Issue
Block a user