Hi Petr --
> MIME headers are correct, but I still don't know how to send binary
> output through CGI::Application.
> On "classic" way it is easy:
> open(FILE, "<test.pdf");
> @fileholder = <FILE>;
> close (FILE);
>
> print "Content-Type: application/pdf\n";
> print "Content-Disposition: attachment;filename=test.pdf\n\n";
> print @fileholder;
>
>
> How to do it through CGI::Application?
It's basically the same w/ CGI::Application, with two exceptions:
1. You don't return the headers. You set them.
2. You don't print -- you return your data.
sub send_pdf {
my $self = shift;
$self->header_props( -type => "application/pdf",
-"Content-Disposition"=>"attachment;filename=test.pdf"
);
open(FILE, "<test.pdf");
@fileholder = <FILE>;
close (FILE);
return join("", @fileholder);
}
TTYL,
-Jesse-
Jesse Erlbaum
The Erlbaum Group, LLC
817 Broadway, 10th floor
New York, NY 10003
212-684-6161 (office)
917-647-3059 (mobile)
212-684-6226 (fax)
suppressed
##### CGI::Application community mailing list ################
## ##
## To unsubscribe, or change your message delivery options, ##
## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp ##
## ##
## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ##
## Wiki: http://cgiapp.erlbaum.net/ ##
## ##
################################################################
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.