I'm wondering if it has any bad side effects to have a TT macro which is set to
$c->uri_for. If I'm remembering previous posts on this topic correctly, calling
uri_for() repeatedly has quite a big impact on performance which really matters
most for my current application. I have this in a global macros.tt2 file:

[%
    base = Catalyst.req.base;
    static = Catalyst.config.hosts.static;
    images = Catalyst.config.hosts.images;
    site.url = {
        base    = base
        static  = static
        images  = images
    }
-%]

That way I can easily change the location of my static files and images to
another server or place using the Catalyst config file and generate links like
this:

<img src="[% site.url.images %]logo.png" />
<a href="[% site.url.base %]user/whatever">bla</a>

etc.

Any comments? Thanks!

--Tobias

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to