Inheriting from Math::BigInt - What am I doing wrong?
Trying here, after filing an rt.cpan.org bug, to find one of the maintainers of Math::BigInt, especially Math::BigInt::(GMP|Pari). I'm trying to inherit my module (Net::IPAddress::Util) from Math::BigInt, while using (i.e. passing along) the try, lib and only import arguments. Here's the mess as it currently stands: http://code.google.com/p/perl-ipaddress-simple/source/browse/trunk/lib/Net/IPAddress/Util.pm#38 I'm getting sporadic FAILs on cpantesters, and it looks like what's happening is that my attempts to inherit are not inheriting properly on systems where Math::BigInt::(GMP|Pari) are installed. For example: http://www.cpantesters.org/cpan/report/7c84cb0a-6997-11e0-abb5-fac0acc1530f http://www.cpantesters.org/cpan/report/05058420-66fe-11e0-96c5-a2a3c0b02281 Both of those look like something along the way is getting confused as to the type of objects in my class, but I find the notion of anything relying on something other than @ISA to determine that to be utterly alien and (frankly) verging on the marginally hostile. I have (so far) been unable to get either of Math::BigInt::(GMP|Pari) to install on my development system, so I can't be more specific than this, yet. Anyway. Long story short: Is there a Math::BigInt maintainer in the house? Alternatively, anybody else care to take a crack at it? Thanks, PS: Random unrelated question: I've looking at the perldoc for require. Is there an existing If you don't have a module installed, go get it from CPAN automatically module out there? Maybe something in the Devel:: namespace? If not, do you think there's a market for one? It seems like something some developers might like to add to their PERL5OPT. 'export PERL5OPT=-MDevel::WellGoGetItThen' or something...? Thanks again, -- Paul Bennett (PWBENNETT)
Re: Inheriting from Math::BigInt - What am I doing wrong?
Is there an existing If you don't have a module installed, go get it from CPAN automatically module out there? CPAN::AutoINC Module::AutoINC Acme::Magic::Pony lib::xi signature.asc Description: This is a digitally signed message part.
Handling C++ structs with XSpp
Hi, I am trying to bind Box2D to Perl using XSpp. This is my code so far: https://github.com/PerlGameDev/Box2D-perl I am using Module::Build::WithXSpp and ExtUtils::XSpp. The first thing I need to bind are a bunch of C++ style structs (not pure C struct). http://paste.scsys.co.uk/99657 It has operator overloads and so on. The ExtUtils::XSpp is not clear on how I should handle this. I tried doing https://github.com/PerlGameDev/Box2D-perl/blob/master/xsp/Box2D.xsp but when I compile and run I get: Building Box2D Generating main XS file... Error: line 7 (Current token type: 'OPCURLY') (Current value: '{') Buffer: Expecting: ('OPPAR') Error reading from pipe '/home/kthakore/.perl5/perls/perl-5.12.2/bin/perl5.12.2 -MExtUtils::XSpp::Cmd -e xspp -- /home/kthakore/Documents/Development/Box2D-perl/Box2D/xsp/Box2D.xsp': in main.xs, line 22 Any help will be appreciated. Regards, -- Kartik Thakore thakore.kar...@gmail.com
Re: Handling C++ structs with XSpp
Hi, um, Kartik? I worked with XS++ before, and I can tell you that the author (steffen) is very helpful. a few pointers: I don't think that you want to use the %file directive. it redirect the output of XS++, while you probably wanted to just include the file. if it is true, then just #include the file, like you would have done in a C++ file. there is no 'public' statment in an xsp file. whatever is there is public by definition. you have two constructors for the class. one of them need a new name. float32 is just normal float, right? why not use it, and let XS++ use the default float handling? that is all I can think about right now. please try and see if it makes any difference. Shmuel. On 2011/04/27 0:02, Kartik Thakore wrote: Hi, I am trying to bind Box2D to Perl using XSpp. This is my code so far: https://github.com/PerlGameDev/Box2D-perl I am using Module::Build::WithXSpp and ExtUtils::XSpp. The first thing I need to bind are a bunch of C++ style structs (not pure C struct). http://paste.scsys.co.uk/99657 It has operator overloads and so on. The ExtUtils::XSpp is not clear on how I should handle this. I tried doing https://github.com/PerlGameDev/Box2D-perl/blob/master/xsp/Box2D.xsp but when I compile and run I get: Building Box2D Generating main XS file... Error: line 7 (Current token type: 'OPCURLY') (Current value: '{') Buffer: Expecting: ('OPPAR') Error reading from pipe '/home/kthakore/.perl5/perls/perl-5.12.2/bin/perl5.12.2 -MExtUtils::XSpp::Cmd -e xspp -- /home/kthakore/Documents/Development/Box2D-perl/Box2D/xsp/Box2D.xsp': in main.xs, line 22 Any help will be appreciated. Regards,
Re: Handling C++ structs with XSpp
I seem to have gotten a bit further by mimic the early ZeroMQ perl module tsee made. This is my class xsp now: https://github.com/PerlGameDev/Box2D-perl/blob/master/xsp/b2Vec2.xsp But now I am running into: cc -I/home/kthakore/.perl5/perls/perl-5.12.2/lib/5.12.2/x86_64-linux-thread-multi/CORE -DXS_VERSION=0.01 -DVERSION=0.01 -fPIC -xc++ -Isrc -Ibuildtmp -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -o buildtmp/Box2D.o buildtmp/Box2D.c buildtmp/Box2D.c:97: error: expected class-name before ‘extern’ error building buildtmp/Box2D.o from 'buildtmp/Box2D.c' at /home/kthakore/.perl5/perls/perl-5.12.2/lib/5.12.2/ExtUtils/CBuilder/Base.pm line 112. Regards, Kartik Thakore On Tue, 2011-04-26 at 11:02 -0400, Kartik Thakore wrote: Hi, I am trying to bind Box2D to Perl using XSpp. This is my code so far: https://github.com/PerlGameDev/Box2D-perl I am using Module::Build::WithXSpp and ExtUtils::XSpp. The first thing I need to bind are a bunch of C++ style structs (not pure C struct). http://paste.scsys.co.uk/99657 It has operator overloads and so on. The ExtUtils::XSpp is not clear on how I should handle this. I tried doing https://github.com/PerlGameDev/Box2D-perl/blob/master/xsp/Box2D.xsp but when I compile and run I get: Building Box2D Generating main XS file... Error: line 7 (Current token type: 'OPCURLY') (Current value: '{') Buffer: Expecting: ('OPPAR') Error reading from pipe '/home/kthakore/.perl5/perls/perl-5.12.2/bin/perl5.12.2 -MExtUtils::XSpp::Cmd -e xspp -- /home/kthakore/Documents/Development/Box2D-perl/Box2D/xsp/Box2D.xsp': in main.xs, line 22 Any help will be appreciated. Regards, -- Kartik Thakore thakore.kar...@gmail.com
Re: Handling C++ structs with XSpp
Have you considered using Inline::CPP and writing your accessors as needed? Its another layer of indirection, but there may be fewer surprises.
Re: Handling C++ structs with XSpp
Hi Kartik. I think that you still need to #include your header file where b2Vec2 is defined in the beginning of the xsp file. Shmuel. On 2011/04/27 3:35, Kartik Thakore wrote: I seem to have gotten a bit further by mimic the early ZeroMQ perl module tsee made. This is my class xsp now: https://github.com/PerlGameDev/Box2D-perl/blob/master/xsp/b2Vec2.xsp But now I am running into: cc -I/home/kthakore/.perl5/perls/perl-5.12.2/lib/5.12.2/x86_64-linux-thread-multi/CORE -DXS_VERSION=0.01 -DVERSION=0.01 -fPIC -xc++ -Isrc -Ibuildtmp -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -o buildtmp/Box2D.o buildtmp/Box2D.c buildtmp/Box2D.c:97: error: expected class-name before ‘extern’ error building buildtmp/Box2D.o from 'buildtmp/Box2D.c' at /home/kthakore/.perl5/perls/perl-5.12.2/lib/5.12.2/ExtUtils/CBuilder/Base.pm line 112. Regards, Kartik Thakore On Tue, 2011-04-26 at 11:02 -0400, Kartik Thakore wrote: Hi, I am trying to bind Box2D to Perl using XSpp. This is my code so far: https://github.com/PerlGameDev/Box2D-perl I am using Module::Build::WithXSpp and ExtUtils::XSpp. The first thing I need to bind are a bunch of C++ style structs (not pure C struct). http://paste.scsys.co.uk/99657 It has operator overloads and so on. The ExtUtils::XSpp is not clear on how I should handle this. I tried doing https://github.com/PerlGameDev/Box2D-perl/blob/master/xsp/Box2D.xsp but when I compile and run I get: Building Box2D Generating main XS file... Error: line 7 (Current token type: 'OPCURLY') (Current value: '{') Buffer: Expecting: ('OPPAR') Error reading from pipe '/home/kthakore/.perl5/perls/perl-5.12.2/bin/perl5.12.2 -MExtUtils::XSpp::Cmd -e xspp -- /home/kthakore/Documents/Development/Box2D-perl/Box2D/xsp/Box2D.xsp': in main.xs, line 22 Any help will be appreciated. Regards,