On 19 Aug 2008, at 14:27, Dermot wrote:
2008/8/19 Carl Franks <[EMAIL PROTECTED]>:
2008/8/19 Dermot <[EMAIL PROTECTED]>:
sub downloadFile {
my ($name, $filepath) = @_;
my $length = (stat($filepath))[7];
my $res = $c->response;
$res->content_length($length);
$res->headers->({ 'Content-Disposition' =>
"attachment;filename=$name"} ); # CODE ref error
Where did you get this syntax idea from? Since when has headers been
returning a coderef? Go read the docs again: http://search.cpan.org/~mramberg/Catalyst-Runtime-5.7014/lib/Catalyst/Response.pm#$res-%3Eheader
Fix the above headers you have, and use the snippet luke gave below
open my $filehandle, '<', $filepath
or die $!;
$c->response->body( $filehandle );
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/