PerlDancer / Dancer2

Perl Dancer Next Generation (rewrite of Perl Dancer)
http://perldancer.org/
Other
543 stars 273 forks source link

Serializer::Mutable doesn't (auto) load other serializers. #1568

Closed veryrusty closed 3 years ago

veryrusty commented 3 years ago

Advent driven development: The mutable serializer has a couple of class loading bugs. YAML isn't loaded, nor are any serializer classes in configured mapping. Serializers also eat errors, making chasing this down unfriendly.

The simple app below highlights the problem. Both these requests return no output and no errors :(`

#!/usr/bin/env perl
use warnings;
use strict;

{
    package Example::App;
    use Dancer2;
    # Serializer loading bugs
    # use YAML;
    # use Dancer2::Serializer::XML;

    set engines => {
        serializer => {
            Mutable => {
                mapping => {
                    'text/x-yaml'      => 'YAML',
                    'text/html'        => 'YAML',
                    'text/x-json'      => 'JSON',
                    'application/json' => 'JSON',
                    'text/xml'         => 'XML',
                }
            }
        }
    };
    set serializer => 'Mutable';

    get '/' => sub {
        return { some => 'data' };
    };
}

Example::App->psgi_app;
cromedome commented 3 years ago

Well, crap. Ping me in Slack later, I have some questions, and can post any relevant notes that come from them here.

cromedome commented 3 years ago

Merged! Thanks!