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 => \&output,

Later on in the view base class...

sub output {
  my $filename = 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 => '.tt2',
    INCLUDE_PATH => [
        hde->path_to( 'root', 'src' ),
        hde->path_to( 'root', 'lib' ),
        hde->path_to( 'root', 'tt2' )
    ],
    PRE_PROCESS  => 'config/main',
    WRAPPER      => 'site/wrapper',
    OUTPUT       => \&output,
    OUTPUT_PATH  => [
        hde->path_to( 'root', 'static', 'published' ),
    ],
    ERROR        => 'error.tt2',
    TIMER        => 0
});

/dennis
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to