in reply to how to open excel in browser using CGI::Application

First, CGI::Application won't automatically send the file. The script needs to read the file and return the data.

Second, header_props is a function that modifies the header directly. There is no need to assign it to $output at all. The 2/8 you see is result of printing the anonymous hash (header) in scalar context.

Here's a working example:

sub show_excel { my $self = shift; my $file = "temp.xls"; my $output = do { local $/; open FH, 'temp.xls' or die "$!"; <FH> }; $self->header_props(-type => application/vnd.ms-excel', -attachment => $file); return $output; }

Finally, it is up to the end user whether to open Excel outside of the browser, embedded in the browser or save the file to disk. A web page can't force it to open in the browser, if that is what you are looking for.

HTH