[Catalyst] Forward to view question

Dennis Daupert ddaupert at gmail.com
Tue May 5 14:54:17 GMT 2009


I've created a view that's intended to write a couple of files to the file
system.

The output filename needs to be dynamically set. I'm having a bit of a go
figuring out how to do that.

The TT configuration documentation speaks of an output subroutine:

OUTPUT =3D> \&output,

Later on in the view base class...

sub output {
  my $filename =3D shift;
  # do stuff
}

Here's my question:
How do I get the $filename into sub output when I forward to the view?


Here is my view class configuration:

package hde::View::TTprint;

use strict;
use base 'Catalyst::View::TT';

__PACKAGE__->config({
    TEMPLATE_EXTENSION =3D> '.tt2',
    INCLUDE_PATH =3D> [
        hde->path_to( 'root', 'src' ),
        hde->path_to( 'root', 'lib' ),
        hde->path_to( 'root', 'tt2' )
    ],
    PRE_PROCESS  =3D> 'config/main',
    WRAPPER      =3D> 'site/wrapper',
    OUTPUT       =3D> \&output,
    OUTPUT_PATH  =3D> [
        hde->path_to( 'root', 'static', 'published' ),
    ],
    ERROR        =3D> 'error.tt2',
    TIMER        =3D> 0
});

/dennis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090505/bda90=
230/attachment.htm


More information about the Catalyst mailing list