On 2/05/2013 10:07 PM, Craig Chant wrote:
Hi Neil,

My model is already 'Catalyst::Model::Factory::PerRequest'

So I have added an attribute...

sub prepare_arguments {

     my ($self,$c) = @_;
     return {,
         res         =>  $c->res
     };

}

So I now have my model bound to  $c->res

How do I assign the scalar CSV data to it?
Assuming now there is an accessor in the actual class you are using for the model, and assuming a Moose based class then rather than putting the CSV output into a scalar you want to use the 'response' object. Something like:

$self->res->print( $my_line_of_csv );

At any rate it's how the CSV is being output in the model that you need to change.

Surely if I use $self->res->body($xls) in the model it's no different than 
doing it in the  Controller and is still going to fall over with 'Out of memory'?
Yep. This is why the discussion says do it line by line rather than build a big scalar.
I seem to be getting no-where trying to print direct to the browser...

I've tried..

         $c->response->header(
             Content_Type =>  'application/vnd.ms-excel',
             Content_Disposition => 'attachment;filename=NBCS_Export.csv'
             );

That part's okay. You need a response Content_Type.


_______________________________________________
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