[Pdx-pm] HTTP::Server::Simple question

Kris Bosland krisb at ring.org
Thu Jun 29 13:16:22 PDT 2006


I am porting a CGI script from a web server to HTTP::Server::Simple, and
so far it mostly works (I am agravating some Firefox bug in the
HTTP::Server::Simple version that causes problems for
document.getElementsByName but I worked around it).  The final big piece
that I can't get working is a simple file download option to let the users
get their data in Excel (I am just sending them a CSV file right now)

This worked in the old CGI.pm code:
===========================================
use CGI::Pretty qw/:standard/;
...
if(param("excel")) {
	print header(-type=>'application/vnd.ms-excel',-attachment=>'binswitch.csv'),
		$x->excel_binswitch($prog1options[0],$locationoptions[0],$prog2options[0],$hardbin,\@debuglog);
} else {
===========================================

This does not work in the new HTTP::Server::Simple code:
===========================================
if($q->param("excel")) {
	print $q->header(-type=>'application/vnd.ms-excel',-attachment=>'binswitch.csv'),
		excel_binswitch($binswitchdata);
} else {
===========================================

instead, firefox prints up a page with this source:
===========================================
Content-Disposition:
attachment;
filename="binswitch.csv"
Content-Type:
application/vnd.ms-excel

s1/s2,1,2,3
1,a,b,c
2,f,e,d
3,g,h,i
===========================================
(note the testing data)

Does anyone know if there are some headers that HTTP::Server::Simple
prints that I need to stop or change?

Thanks.

-Kris



More information about the Pdx-pm-list mailing list