dada-mail
dada-mail copied to clipboard
"Safe Mode" for template parsing?
Templates - like email messages with embedded tags, that also have errors in those tags cause chaos when you try to send them out as a mailing list message. A problem happens, but it's sometimes hard to know exactly where the error is.
Perhaps what we need is a safe mode for parsing templates, where the code that could fail is wrapped up in an eval(). This isn't done now for performance reasons, but maybe it makes sense in a safe mode to wrap it in an eval to get the line where the error in the template tag is found.
Oftentimes, the email message also has its data on all one line, so we should try to break that up for debugging purposes,
Simplified code:
${$args->{-data}} =~ s/\>/>\n/gi;
try {
$template = HTML::Template::MyExpr->new(
%Global_Template_Options,
scalarref => $args->{-data},
filter => $filters,
);
} catch {
croak $_ . ' => raw template: ' . ${$args->{-data}};
};
At the very least, that would help us see what template/message is causing the issue and give us a clue as to where.
This wasn't implemented; opening back up!