listing buddies through Perl plugin

Etan Reisner pidgin at unreliablesource.net
Thu May 31 13:45:17 EDT 2007


> > I believe the key is understanding this in the BuddyList.xs:
> > for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- >
> > const_iv; )
> >         newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv));
> > }
> >
> > From my understanding this is creating new "sub"s in perl?  So I
> > should be able to call whatever those subs are?

Since Sadrul already answered your real question I'll just explain the
above code. That snippet creates perl constants (hence CONST). I finally
got sick and tired of not having access to the named enum fields in perl
(well, in hearing people talk about it since I don't actually use the perl
stuff myself) so I added all the useful constants to perl.

These constants are used in Sadrul's example script as
Purple::BuddyList::Node::GROUP/CHAT/CONTACT/BUDDY.

	-Etan




More information about the Devel mailing list