[Catalyst] View::TT patches

Zbigniew Lukasiak zzbbyy at gmail.com
Wed Nov 30 23:16:11 CET 2005


Hi,

Sometimes you need to set additional search paths dynamically (from
the controllers).  With this patch you can just put the paths on stash
and they will be added to the list used by the View, after processing
the search paths list is restored back, so that subsequent requests
will not change the search path for each other.

I needed that to set the search path to a library of templates I want
to bundle together with a controller.

You can use it like that:

$c->stash->{additional_include_paths} = [$c->config->{root} .
'/test_include_path'];

In attachments you'll find:
TT.diff - the patch to Catalyst::View::TT, against trunk
TestApp.diff - patch to the test application (goes into t/lib/TestApp.pm)
06includepath.t - new tests (t/06includepath.t)
Includepath.pm - new view subclass for the tests
(t/lib/TestApp/View/TT/Includepath.pm)

You'll need to create needed directory and copy
t/lib/TestApp/root/test.tt to
t/lib/TestApp/root/test_include_path/testpath.tt to run the tests.

I hope I did not forget about anything.

-- Zbyszek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TT.diff
Type: text/x-patch
Size: 1976 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20051130/64435c72/TT.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestApp.diff
Type: text/x-patch
Size: 493 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20051130/64435c72/TestApp.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 06includepath.t
Type: application/x-troff
Size: 555 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20051130/64435c72/06includepath.t
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Includepath.pm
Type: application/x-perl
Size: 358 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20051130/64435c72/Includepath.bin


More information about the Catalyst mailing list