Re: gtk2-perl / easily accessing objects properties



Guillaume,

On Tue, Oct 29, 2002 at 06:03:36PM +0100, Guillaume Cottenceau wrote:
During an irc talk with Manish Singh, he suggested the following
idea (which appears nice to me).
For each object property, instead of either using the generic

        $obj->set(property_name, property_value)

That name is already taken by a similar method:
http://developer.gnome.org/doc/API/2.0/gobject/gobject-the-base-object-type.html#g-object-set
And those are already implemented by you a few day ago :-)
The above exampel should work with your $object->set().

or even manually implementing in our classes accessors to have:

        $window->set_allow_shrink(1)

I did this but used:
GET: $window->allow_shrink;
SET: $window->allow_shrink($flag);
which is shorter and cleaner.

we could change our perl objects so that hash access would be
generic wrappers to automatically call set_property with the
right property name and value, giving the following use:
        $obj->{sensitive} = 1
needs a tie or a copy, 
which slows down start time even if we don't use it

/göran



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]