Skip Menu |

This queue is for tickets about the Catalyst-View-CSV CPAN distribution.

Report information
The Basics
Id: 70009
Status: resolved
Priority: 0/
Queue: Catalyst-View-CSV

People
Owner: mbrown [...] fensystems.co.uk
Requestors: drew [...] drewtaylor.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.1.2



Subject: Feature: specify filename of CSV file
Here's a patch to the 1.1.2 distribution to allow setting the filename of the resulting CSV file: $ diff -u CSV.pm.orig CSV.pm --- CSV.pm.orig 2011-08-04 11:48:00.000000000 +1000 +++ CSV.pm 2011-08-04 11:47:07.000000000 +1000 @@ -71,6 +71,12 @@ Set to C<undef> to prevent any manipulation of the filename suffix. +=head2 filename + +The filename for the generated CSV file. If not specified, it will +default to the last path segment of the request URI. This works in +conjunction with the C<suffix> option. + =head2 charset The character set stated in the MIME type of the downloaded CSV file. @@ -226,7 +232,8 @@ my $cursor = $c->stash->{cursor}; # Determine resulting CSV filename - my $filename = [ $c->req->uri->path_segments ]->[-1]; + my $filename = $c->stash->{filename} || + [ $c->req->uri->path_segments ]->[-1]; if ( $suffix ) { $filename =~ s/\.[^.]*$//; $filename .= ".".$suffix;
On Wed Aug 03 21:49:44 2011, drew@drewtaylor.com wrote: Show quoted text
> Here's a patch to the 1.1.2 distribution to allow setting the filename > of the resulting CSV file:
Thanks for the patch! I have applied a modified version of your patch (including some extended documentation and additional test cases) and uploaded it as Catalyst::View::CSV version 1.2. Should be on CPAN shortly. Michael