[Catalyst] PDF::Reuse and Catalyst app

Michael Higgins linux at evolone.org
Thu Dec 6 03:52:15 GMT 2007


Hello, all --

I've finally gotten some traction with this project, was hoping to get
a bit of input before I go much further in case I'm digging a hole.

My application, running the catalyst engine development server, looks
like:

- user logs in, gets to create a document in a form page
- data is parsed and passed to PDF::Reuse:
    first I grab a temp file:

        my (undef,$filename) = tempfile(SUFFIX => '.pdf', DIR =>
'/home/col/charley/bolmaker/root/pdf_tmp'); # File::Temp 'tempfile'

I have to strip the path to root in order for the development server
to serve it... How do I do that automatically? Is there a better option
for making the file? (PDF::Reuse won't accept a filehandle).

- Then to serve the file:

      my $fh = new IO::File "< $filename";
        if (defined $fh) {
            $c->response->content_type('application/pdf');
            $c->response->header('content-disposition',
                 "attachment; filename=${bol}_BOL.pdf");
            $c->response->body($fh);

            return 1;
        }

Is there a better way to serve the file? I got nowhere with
Static::Simple... not that it matters, I guess.

Ultimately, I'll put this in a mod_perl environment... any pointers
there?

Any advice appreciated.

Cheers,

-- 
 |\  /|        |   |          ~ ~  
 | \/ |        |---|          `|` ?
 |    |ichael  |   |iggins    \^ /
 michael.higgins[at]evolone[dot]org



More information about the Catalyst mailing list