Glib::Object->methods take a look at this...



laying be bed feeling like ass trying to take a nap and can't b/c my
head is in over-drive. it just happens to spin on to the fact that perl
ought to know what sub routines (methods) are available to a class, hell
you have to (well the autogenerated boot function does it for you)
register them with newXS i assume that puts them in some list somewhere
with all of the perl subs for that particular object type. needless to
say i wasn't gonna get to sleep thinking about it so i decided to come
play around with the idea and i'm glad i did. (at this point i'll put in
a disclaimer and say that if this is obvious to the perl mongers out
there forgive me i've never seen it before)

searched for 'list perl object methods' on google and saw something that
looked promising, http://dev.perl.org/rfc/335.html. about 1 min 30
seconds latter i had it added to Glib.pm under the package Glib::Object
and it worked. 

i hacked around at it for a few minutes improving upon what i found and
arrived at the patch attached. you should be able to apply it while in
the Glib directory. the methods.pl shows what it does. personally i
think this is damned cool and i plan on adding it unless i hear other
wise. feedback requested/appreciated. i haven't even sat down to figure
out exactly what the code is doing just yet so that's still to come.

question where should this be documented? personally i think it should
be all over the place so every one will know it exists and will use it.
if only perl knew what parameters the functions were expecting this
would negate the need for looking at the api doc about half of the time,
but oh well. take a look let me know what you think:

the the following code will show you the way...

Attachment: methods.patch
Description: Text Data

Attachment: methods.pl
Description: Text Data



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