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

Any ideas? The net result was that `<$file>` resulted in no content if run within the eval block.


--- wiki.pl	Tue Aug  4 00:20:26 2009

      $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