Re: Perl-Win32-Web Digest, Vol 32, Issue 1
by Charles Pelkey other posts by this author
Jan 6 2007 5:00PM messages near this date
view in the new Beta List Site
Re[2]: Capturing command window output
|
Re: Perl-Win32-Web Digest, Vol 32, Issue 1
Try the following:
open(DLFILE, "<$files_location\test.pdf") or die "Could not open file for reading: $!\n";
binmode(DLFILE);
binmode(STDOUT);
while (
read (DLFILE, $buffer, 65536) # read in (up to) 64k chunks
print $buffer # output the contents of the buffer
);
close (DLFILE);
perl-win32-web-request@[...].com wrote:
Send Perl-Win32-Web mailing list submissions to
perl-win32-web@[...].com
To subscribe or unsubscribe via the World Wide Web, visit
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
or, via email, send a message with subject or body 'help' to
perl-win32-web-request@[...].com
You can reach the person managing the list at
perl-win32-web-owner@[...].com
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Perl-Win32-Web digest..."
Today's Topics:
1. Perl/Binmode issue (Zahir Lalani)
----------------------------------------------------------------------
Message: 1
Date: Sat, 6 Jan 2007 15:42:17 +0000
From: "Zahir Lalani"
Subject: Perl/Binmode issue
To: perl-win32-web@[...].com
Message-ID:
<560a2afa0701060742o23eed7c8o8a869c076aecef6b@[...].com>
Content-Type: text/plain; charset="iso-8859-1"
Hello
not sure what is going on here. I have a standard xampp install on win XP,
with the updated install of perl - which is activeperl 5.8.8. I have some
test code to send a pdf from the cgi to the browser as follows:
#!C:/Program Files/xampp/perl/bin/perl
print "Content-Type:application/pdf\n";
print "Content-Disposition:attachment;filename=test3.pdf\n\n";
my $files_location;
my $ID;
my @fileholder;
$files_location = "C:\Data\Perl";
open(DLFILE, "<$files_location\test.pdf");
binmode(DLFILE);
binmode(STDOUT);
@fileholder = ;
close (DLFILE);
print @fileholder;
====
When I run this, I get the save as dialog. Whether I save or open directly,
the resulting data is deemed as corrupt by acrobat. If I access the file
directly via apache rather than the cgi, it works fine. To make sure the
code was OK, I ran the same code (apart from the paths and the binmode) on a
unix install - and it worked fine. I also tried an equivalent version of PHP
via the xampp install - worked fine. So this seems to be a perl issue on
win32.
Has anyone got a clue as to what the problem could be?
Thx
--
Zahir Lalani
SystemZ
zahir@[...].net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/perl-win32-web/attachments/200701
06/3f28da2f/attachment-0001.html
------------------------------
_______________________________________________
Perl-Win32-Web mailing list
Perl-Win32-Web@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
End of Perl-Win32-Web Digest, Vol 32, Issue 1
*********************************************
Thread:
Charles Pelkey
David Landgren
|