PerlDancer / Dancer2

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

Unable to use send_as in template #1712

Closed abeverley closed 2 months ago

abeverley commented 3 months ago

This is a follow-on problem as a result of #1622 and its fix 3331ad7062

In the highly unlikely event that send_as is called during the render of a template, the error Unable to load serializer class for plain: Can't locate Dancer2/Serializer/plain.pm will be experienced. This is because 3331ad7062 removes the longjump when a template is processed, which means statements such as this do not return immediately, leading to unexpected behavior when the subsequent statements are executed.

The use-case here is for the Dancer2::Plugin::LogReport plugin, which (in the worst case scenario if can't do anything else) will render a plain text error if there is an unhandled exception when rendering a template.

I have a proposed solution which I will submit as a separate PR.

cromedome commented 2 months ago

Resolved with merge at 1f913fde. Thanks!