Hi, I'm trying to use Inline::CPP to speed up a Perl script, and I'm having some problems doing so. I've read the Inline perldocs as best as I can.
The problem I'm having is writing a Perl module, a .pm file, containing Inline C++ code that I can "use" module in a wrapping perl script. The inline code seems to work (compiles, gives required results) fine if I dont make it a .pm file, ie, make it a .pl file and run the script. If instead of making two separate files as below, I simply execute ballz() in the file containing the C++ code (with suitable changes to the shebang line etc), it works fine. Any help will be greatly appreciated. Venky. The error I get from the following code is: --------------------------------------------------- Unknown error Compilation failed in require at ./ballz.pl line 6. BEGIN failed--compilation aborted at ./ballz.pl line 6. ---------------------------------------------------- Rather informative :) Here is the code: ----- Ballz.pm ------ package Ballz; use strict; use warnings; use base 'Exporter'; our @ISA = qw( Exporter ); our $VERSION = 0.01; use Inline::Files; use Inline ( CPP => 'BELOW', NAME => 'Ballz', ENABLE => 'STD_IOSTREAM' ); sub ballz($); sub ballz($) { my( $rad ) = @_; my $football = Ball( $rad ); print "Old radius = ", $football->get_radius(), "\n"; $football->set_radius( 6 ); my $newr = $football->get_radius(); print "New Radius = $newr \n"; } __END__ __CPP__ class Ball { public: int radius; Ball(int r); void set_radius(int r); int get_radius(); }; Ball::Ball( int r ) { radius = r; } void Ball::set_radius(int r) { radius = r; } int Ball::get_radius() { return radius; } -------------------------- END Ballz.pm ------------------------------ Here is the wrapping script: --------------------------- ballz.pl ----------------------------------- #!/usr/bin/perl use strict; use warnings; use Ballz; ballz( $ARGV[0] ); --------------------------- END ballz.pl -------------------------------