http://qs321.pair.com?node_id=106800

blackjudas has asked for the wisdom of the Perl Monks concerning the following question:

Oh wise ones, I certainly hope you can enlighten me on this particular problem I'm having with FreezeThaw.pm

Current setup:
perl 5.005
mysql 3.23.24
FreezeThaw.pm 0.41

Here's the scenario, a session handler module written from scratch by me handles all input form variables, each form variable passed in through the HTML pages get processed and added into a hash called %session_vars which is then frozen to a session record through MySql. This works quite well throughout the program, but one snag I've run into kinda breaks FreezeThaw and errors out with the following error:

Frozen string too short: `$10| OK', expect 14 at /usr/lib/perl5/site_perl/5.005/FreezeThaw.pm line 313
FreezeThaw::thawString called at /usr/lib/perl5/site_perl/5.005/FreezeThaw.pm line 452
FreezeThaw::thawScalar(235) called at /usr/lib/perl5/site_perl/5.005/FreezeThaw.pm line 338
FreezeThaw::thawArray called at /usr/lib/perl5/site_perl/5.005/FreezeThaw.pm line 453
FreezeThaw::thawScalar(4) called at /usr/lib/perl5/site_perl/5.005/FreezeThaw.pm line 624
FreezeThaw::thaw('FrT;@20|$15|unitman.company$0|$14|unitman.action$4|Edit$9|subact...') called at ../lib/Authorization.pm line 230
Authorization::get_session('96443fe0bd30d7ba696247502898af7c') called at ../lib/TestUnitMan.pm line 36
TestUnitMan::start('96443fe0bd30d7ba696247502898af7c', 'TestUnitMan', undef) called at /www/skibc/dev/public_html/sbin/postillion.pl line 90

What's going on is the following: I have multiple submit buttons throughout the page that is generated for the user, the values inside the names are conditional flags that the script bases decisions on. All fine and dandy so far... if I create a form submit button with a value of "    OK    " in order to create a "nicer" button this breaks freezethaw the second time through, the first time it takes the frozen session and thaws it out no problem and the script chugs along, if the previous submit key is still in the session hash FreezeThaw cannot seem to Thaw the data and dies with the above error. The actual record is correct if I look at it in the database table, all the spaces are there etc. Can you tell me if it's my logic or FreezeThaw? I've been battling with it for a day now.

Replies are listed 'Best First'.
Re (tilly) 1: FreezeThaw Problem
by tilly (Archbishop) on Aug 22, 2001 at 05:46 UTC
    You have given us rather little information about what your logic looks like. For instance FreezeThaw has various hooks to allow you to put logic in the freezing and thawing process. Are you using those? If not, then I would suggest giving Storable a shot.

    However I would wonder whether your frozen string is getting long enough to not fit in whatever database field it is going into. Check whether that is plausible. (For instance report the length of the string going in and coming out. If they differ, you know what it is.)

    If neither of those two naive guesses helps, you really need to create a minimal test case. Do you have a reliable interaction that does it? Can you script that interaction on the command line? Once you get to that point, try to start cutting out steps, and keep on going until you have the shortest case you can that reproduces it. After you get there, you are going to be in a much better position to figure out what it is.

      My apologies for being vague, while I cannot seem to reproduce it on the command line, I will go ahead and write a different script with the same logic. In answer to your suggestions, the field that FreezeThaw freezes data to is set to MEDIUMTEXT which means that the theoretical limit is 16777215 characters which in testing I don't come close to. What I believe the problem to be (just venturing a guess) is that the version of Mozilla I'm testing this with may be broken since I cannot reproduce the error on the command line and it never errors with MSIE. Well thanks for the reply I just ended up throwing in a couple of filters to strip then add spaces. Seems to have cleared the problem up just fine. Man now if I could only write clearer posts eh? Grazias for the input.