in reply to Opening PDF through CGI
At a first glance it should work.
open(FIN,"< $full_path") || print "File Not Found"; binmode FIN; $buffer = join '', <FIN>; close(FIN); print $buffer;
BTW: how 'bout:
open my $fin, '<:raw', $full_path or die WHATEVER; local \$; # or use File::Slurp print <$fin>;
Update:The following appears to work:
#!/usr/bin/perl -T use strict; use warnings; use CGI ':standard'; use CGI::Carp 'fatalsToBrowser'; print header('application/pdf'), do { open my $fh, '<:raw', 'minimal.pdf' or die "D'Oh! $!\n"; local $\; <$fh>; }; __END__
(it is temporarily available at http://blazar.perlmonk.org/tmp/minimal.pl)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Opening PDF through CGI
by nobull (Friar) on May 26, 2006 at 16:58 UTC |