2009-08-03 Strange Perl Issue
Today I had to make the following change to Oddmuse because that fixes an image upload issue on my dad’s blog. What’s going on? He’s using the following:
Oddmuse
- Apache/2.2.3 (Debian) DAV/2 SVN/1.4.2 mod_jk/1.2.18 mod_ssl/2.2.3 OpenSSL/0.9.8c mod_wsgi/2.3 Python/2.5
- Perl v5.8.8
- CGI: 3.15
Any ideas? The net result was that `<$file>` resulted in no content if run within the eval block.
- ** wiki.pl.~1.925.~ Fri Jul 3 11:23:01 2009
--- wiki.pl Tue Aug 4 00:20:26 2009
- **************
- ** 3548,3554 ****
$type = $q->uploadInfo($filename)->{'Content-Type'};
ReportError(T('Browser reports no file type.'), '415 UNSUPPORTED MEDIA TYPE') unless $type;
local $/ = undef; # Read complete files
! eval { require MIME::Base64; $_ = MIME::Base64::encode(<$file>) };
$string = '#FILE ' . $type . "\n" . $_;
} else {
$string = AddComment($old, $comment) if $comment;
--- 3548,3555 ----
$type = $q->uploadInfo($filename)->{'Content-Type'};
ReportError(T('Browser reports no file type.'), '415 UNSUPPORTED MEDIA TYPE') unless $type;
local $/ = undef; # Read complete files
! my $content = <$file>; # Apparently we cannot count on <$file> to always work within the eval!?
! eval { require MIME::Base64; $_ = MIME::Base64::encode($content) };
$string = '#FILE ' . $type . "\n" . $_;
} else {
$string = AddComment($old, $comment) if $comment;
#Perl #Oddmuse
Comments
(Please contact me if you want to remove your comment.)
⁂
This sounds like the issue we have on EmacsWiki as well.
EmacsWiki
– AaronHawley 2009-08-04 07:39 UTC
AaronHawley
---
Thanks for the reminder! I had forgotten about it. 🙁
– Alex Schroeder 2009-08-04 09:03 UTC
Alex Schroeder