|
List Info
Thread: Perl-Win32-Web Digest, Vol 32, Issue 1
|
|
| Perl-Win32-Web Digest, Vol 32, Issue 1 |

|
2007-01-07 00:59:57 |
|
Try the following: open(DLFILE, "<$files_locationtest.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 listserv.ActiveState.com wrote: Send Perl-Win32-Web mailing list submissions to perl-win32-web listserv.ActiveState.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 listserv.ActiveState.com
You can reach the person managing the list
at perl-win32-web-owner listserv.ActiveState.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" GMAIL.COM> Subject: Perl/Binmode issue To: perl-win32-web listserv.ActiveState.com Message-ID: <560a2afa0701060742o23eed7c8o8a869c076aecef6b mail.gmail.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/pdfn"; print "Content-Disposition:attachment;filename=test3.pdfnn";
my $files_location; my $ID; my fileholder;
$files_location = "C:DataPerl";
open(DLFILE, "<$files_locationtest.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 systemz.net -------------- next part -------------- An HTML attachment was scrubbed... URL: http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/perl-win32-web/attachments/20070106/3f28da2f/attachment-0001.html
------------------------------
_______________________________________________ Perl-Win32-Web mailing list Perl-Win32-Web listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
End of Perl-Win32-Web Digest, Vol 32, Issue 1 *********************************************
|
| Perl-Win32-Web Digest, Vol 32, Issue 1 |

|
2007-01-07 10:17:43 |
Charles Pelkey wrote:
> Try the following:
>
> open(DLFILE, "<$files_locationtest.pdf")
or die "Could not open file
t is interpreted as a tab character. This is why it fails.
When using as path separators they must always be escaped,
hence
open(DLFILE, "<$files_location\test.pdf")
or die "Could not open file
or, a little less ugly and more cross-platform, use forward
slashes;
Perl will know what to do.
open(DLFILE, "<$files_location/test.pdf") or
die "Could not open file
Also, the three-arg form is safer:
open(DLFILE, "<",
"$files_location/test.pdf")
David
_______________________________________________
Perl-Win32-Web mailing list
Perl-Win32-Web listserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs
|
|
[1-2]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|