Re: [PW-dev] Freezing and Thawing widgets
Status: Alpha
Brought to you by:
spadkins
From: James G S. <JG...@TA...> - 2001-06-11 17:25:50
|
"Jay Lawrence" <Ja...@La...> wrote: >From: "Gunther Birznieks" <gu...@ex...> >> How do you propose supporting this API-wise? > >$stored_data = $widget->freeze; Sounds good to me. >This should return a data structure (i.e. hash) in a format like Storable or >Data::Dumper of all of the properties of the object that are persistant. I >don't belive that you can just freeze or thaw your runtime object as it >might have extra information that is not suitable for storing. (ie/ object >ref to controller object, etc). Not to mention it is implementation >specific - and if you change your implementation your frozen objects won't >be as easy to recall. The frozen widget should only contain data specific to the widget and not any state information, since that may change before it is thawed out. Makes sense to have the function be in the widget. I'll put a freeze method in my Widget::Base before putting it up so people can see how it might work (at least my way of doing it :/). >My idea to get this data back might be as follows: > >$widget=Widget->new( thaw => $stored_data ); > # Will know what class this object is from contents of $stored_data >or >$widget=new Widget::Foo; >$widget->thaw( $stored_data ); > # Gotta check that stored_data widget class matches this widget class, >eh? Perhaps also: $widget = Widget -> thaw($stored_data); ? I'll try to stick that into my Widget::Controller package as well. -- James Smith <JG...@TA...>, 979-862-3725 Texas A&M CIS Operating Systems Group, Unix |