Re: [Perl-widget-developer] Teambuilding Exercise #2: Usage - Freezing and thawing widgets
Status: Alpha
Brought to you by:
spadkins
From: Jay L. <Ja...@La...> - 2001-06-06 14:04:19
|
One other thing I really wanna see is thaw/freeze support. Scary? Not really. Obviously if you don't wanna thaw and freeze widgets ever this will be no skin off your nose - it is optional to use. I belive that one thing needs to happen in the thaw phase - that is a "use" for the widget's class. There is no guarantee that you've "use"d that widget class already. ie/ use Widget; open DAT, "widget.dat"; undef $/; $widget_dat=<DAT>; close DAT; my $widget=Widget->thaw($widget_dat); print $widget->whizbang; $widget->whizbang( rand ); open DAT, ">widget.dat"; print DAT $widget->freeze; close DAT; -------- Base class would support serialization of widget properties through Storable, Data::Dumper and XML. You might be able to test what format is being thaw'ed but it might be desirable to pass that info along explicitly: $widget->freeze('XML', (params for XML generation) ); $widget->freeze('dumper'); $widget->freeze('storable'); $Widget::freezer="storable"; # Over ride default Cheers, Jay |