Friday, November 5, 2010

Tweaking TWiki

Spent way too long tracking down this issue. Long story short is that I recently upgraded my version of TWiki from one of the Cairo iterations (4.2) to the latest and greatest (5.0.1).

It went off mostly without a hitch except that it borked attachments giving the following error:


Can't locate object method "binmode" via package "IO::File


Doh, not cool. After a whole lot of digging (my grep skills are non-existent), I finally tracked down the offender in Upload.pm. Basically, they had patched upload but forgot about the lowly of us still using Perl 5.8.8.

A quick tweak out of the OO world:


sub handle {
my $fh = new IO::File( $_[0]->{tmpname}, '<' ); binmode $fh if ($fh ); # $fh->binmode if( $fh );
return $fh;
}


and voila, life is good again.

No comments: