[rt-users] RE: Content Type Header

Ruslan U. Zakirov cubic at acronis.ru
Tue Aug 3 10:22:44 EDT 2004


		Hello.
Christopher, did you read anything about Mason?

Comments below.

christopher.l.hood at verizon.com wrote:
> Ok below is the code that I tried and the error that it produced. It is
> probably due to the way that I used the code you provided for the
> header, however any help is greatly appreciated.
> 
> I have not included the ENTIRE script here as the other part is
> irrelevant, and works when not associated with mason, also I did not get
> errors when this ran without the new $r->content_type(blah) code below,
> it simply didn't work and printed out the header as text.
> 
> START CODE
> <%perl>
> 
> 
> 
> use strict;
> use DBI();
> use Spreadsheet::WriteExcel;
> use CGI qw(:standard);
throw it away, you have %ARGS hash. Or define <%ARGS> block.

> 
> my $dbh;
> my $worksheet;
> my $q=new CGI;
> my $row;
> 
> #my $type = $q->param('type');
> my $type = "Spam";
> 
> # Set the filename and send the content type
> my $filename ="cgitest.xls";
> $r->content_type('application/vnd.ms-excel');
> print "Content-Disposition: attachment; filename=$filename\n";
Don't even try to print headers. Mason throw header for you, use 
$r->header_out('field', 'value'); call.
As I can see you want send XML file then may be you want to look on 
RTStatistics package that generates images.

> 
> ....
> 
> END CODE
> 
> 
> START ERROR
> 
> error:   	Error during compilation of
> /usr/local/rt3/local/html/cgi-bin/reporting/reports/offendersbytypeexcel
> .mas:
> Prototype mismatch: sub HTML::Mason::Commands::url ($;$) vs none at
> /usr/lib/perl5/5.8.3/CGI.pm line 274.
Don't use CGI under Mason. If you want CGI then you can switch back 
handler to default for particular location of your host(this trick was 
on ML less then two weeks ago).

> 
> context:  	
> ...  	
> code stack:  	/usr/lib/perl5/site_perl/5.8.3/HTML/Mason/Interp.pm:317
> /usr/lib/perl5/site_perl/5.8.3/HTML/Mason/Request.pm:198
> /usr/lib/perl5/site_perl/5.8.3/HTML/Mason/Request.pm:166
> /usr/lib/perl5/site_perl/5.8.3/HTML/Mason/ApacheHandler.pm:60
> /usr/lib/perl5/site_perl/5.8.3/Class/Container.pm:265
> /usr/lib/perl5/site_perl/5.8.3/Class/Container.pm:343
> /usr/lib/perl5/site_perl/5.8.3/HTML/Mason/Interp.pm:213
> /usr/lib/perl5/site_perl/5.8.3/HTML/Mason/ApacheHandler.pm:863
> /usr/lib/perl5/site_perl/5.8.3/HTML/Mason/ApacheHandler.pm:789
> /usr/local/rt3/bin/webmux.pl:138
> /dev/null:0
> 
> END ERROR
> 
> 



More information about the rt-users mailing list