There is a bug in Movable Type: only single values (i.e scalar references) can be stored with MT::PluginData when used with a PostgreSQL database. Complex values (i.e. non-scalar references) can be stored with MySQL however, because MySQL allows binary data in its text columns (I would consider that incorrect behavior myself). PostgreSQL does not. So, to fix the problem, the binary data that the Storable perl module outputs needs to be converted to text before reaching the database. To do this, I made use of pack and unpack to trasform the data to and from hexadecimal before it gets to the database itself. I also needed to be sure to preserve any existing data already stored in the database.
The updated data method of MT::PluginData looks like this:
sub data {
my $data = shift;
$data->column('data', unpack ("H*", freeze(shift))) if @_;
my $r;
eval {
$r = thaw($data->column('data'));
};
$r = thaw(pack ("H*", $data->column('data'))) if ($@);
$r;
}
Arg, I was so hopeful that this would fix the problem I was having with rebuilding my index since I had tried everything else!!
- - - - - - -
Storable binary image v35.65 more recent than I am (v2.4) at blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/thaw.al) line 355, at /usr/www/users/puppydog/mt/lib/MT/PluginData.pm line 32
- - - - - - -
But hey, thanks for posting it!
One day, I'm going to buy you a very large beer for this, I swear it.
I also owe you a large beer, a very large foamy beer with whipped cream on top or something. THANKS!