From: Mark W. <ma...@ne...> - 2006-08-17 07:57:30
|
Hi, Sorry to be a pain about this but I want to get it right. I am using the following in my Wx::TreeListCtrl.pm: use Exporter; use base qw( Exporter); use vars qw( $VERSION @EXPORT_OK ); @EXPORT_OK = qw( wxTR_VRULE wxTR_SHOW_ROOT_LABEL_ONLY ); But when I try and use these in my script sample1.pl I get the following error: Undefined subroutine &Wx::TreeListCtrl::wxTR_VRULE called ... So if I create the functions as below, where I get the values from the treelistctrl.h file. sub wxTR_VRULE { 0x8000 } sub wxTR_SHOW_ROOT_LABEL_ONLY { 0x0002 } Is this the way to do this? Or is there a easier/better way where I can automatically export these constants. I do not know if I can use the tl_constants.cpp method or what else I need to do ? I have removed Wx::Mini. The reason I first used it was because I was getting errors with wx_boot, but now the problems have gone, even when I remove the 'use Wx::Mini'. How can I increment $VERSION? The moment I change it to 0.02 in my TreeListCtrl.pm file I get an error on Wx::wx_boot as below. I tried to re-compile the XS files but still the error??? Wx::TreeListCtrl object version 0.01 does not match bootstrap parameter 0.02 at C:/Perl/lib/XSLoader.pm line 92. Thanks Mark -----Original Message----- From: Mattia Barbon [mailto:mat...@li...] Sent: 16 August 2006 09:16 PM To: Mark Wardell Cc: wxp...@li... Subject: Re: [wxperl-users] Unable to export constants in Wx::TreeListCtrl On Wed, 16 Aug 2006 20:51:53 +0200 "Mark Wardell" <ma...@ne...> wrote: Hello, > I understand Exporter and EXPORT and EXPORT_OK but I cannot see how > these are used in the other wxPerl modules. There is no magic: you inherit from Exporter and set up @EXPORT_OK (and %EXPORT_TAGS, if you need). In wxPerl the inheritance is in Wx.pm and the EXPORT_XXX setup in Wx::Wx_Exp (which is autogenerated, but this does not change anything). Then there is xx_constants.cpp, which defines a function for mapping names into constants and a wxPlConstants object to register it with the main wxPerl AUTOLOAD sub, but the error you see is caused by incorrect use of Exporter: in the package you do not populate EXPORT_OK and do not inherit from Exporter. Oh, and please do not use Wx::Mini: it is an implementation detail. Regards Mattia |