ajgb/mojox-renderer-alloy — Issue #1: "Template Not Found" error under Windows
Author: kberov
Created: 2011-12-10 22:51:03+00:00
State: open

Hi Alex,
First of all Thanks for Mojolicious::Plugin::AlloyRenderer.
You may noticed that I use it in my project (https://github.com/kberov/MYDLjE).
I needed to run an application build on it under Windows.
It could not find its templates simply because it used absolute path provided by Mojolicious as well as backslashes and drive letters :).
I hacked your code and here is the hack:
MojoX/Renderer/Alloy.pm:69

$path = \$inline if defined $inline;
if($^O=~/win/i){
#remove drive letter..ye this means templates are always on the same drive
$path =~ s/^\w\://i;
$path =~ s/\\/\//g;
}
return unless defined $path && defined $tname;

In addition I played with Template::Alloy and Mojolicious and made a quite simple alternative
of your plugin.
I just use features provided by Template::Alloy like INCLUDE_PATH =[ 'first/path', 'second/path'] and loading only needed roles.
Here it is.

https://github.com/kberov/MYDLjE/commit/8a274df27da3d90d091d88f267909a719ab7ae95

The only think I could not handle/understand is how you make the system to fallback to EPRenderer in case of exceptions :).
So...
1. Can you share this knowledge :) with me?
2. I would like to suggest to simplify your module if you want and use the simplistic solution from MYDLjE.
I would prefer to update your module instead of supporting more code :).