Ah, thank you Rob. This solved the problem, but another one came up. Anyway, is 
this first problem documented anywhere? I've looked around and I haven't found 
this. Unless I'm missing it, I recommend that the '/lib' thing be included in 
future versions of the FAQ, it's a minor thing, but how are we to know about it?

I spent all day yesterday, rebuilding my code with Inline::C, pretty much like 
the OO example in the C Cookbook. And with the modified Makefile it works 
perfectly. But the CPP version still doesn't work. Actually it's like this. If 
I write the code like this:

#package ChmFile #commented out, not needed because Inline::CPP creates
                                    #the namespace automatically

our $VERSION = '0.01';

use Inline (
            C => Config => LIBS => '-lchm', 
            VERSION => '0.01',
            NAME => __PACKAGE__,
            CLEAN_AFTER_BUILD => 0
           );
use Inline 'CPP';

__DATA__
__CPP__

class ChmFile
{
...
}

I get errors because I didn't put the "package ChmFile;" statement on top ( I 
can't use VERSION and NAME without a package declaration). And if I put it, 
after installing the module and trying to use it, it seems the methods are not 
correctly linked with the ChmFile class. I thought when Inline::CPP detects a 
class declaration it automatically creates the namespace and the package 
declaration is no longer needed. This seems to be somewhat true since I can use 
the ChmFile.pm without the package declaration (if I remove the VERSION and 
NAME options) but I can't make a CPAN distribution out of it since it has no 
explicit package declaration. It also seems to compile the class in the main 
namespace if I use it as I said it works. I don't know, I'm confused as to 
what's really going on here.

Help, anyone?
Alex




On Fri, 25 Mar 2005 09:59:14 +1100, Sisyphus <[EMAIL PROTECTED]> wrote:
> 
> ----- Original Message -----
> From: "Alexandru Palade" <[EMAIL PROTECTED]>
> 
> >     VERSION_FROM      => 'lib/ChmFile.pm', # finds $VERSION
> 
> I think *that* is the problem - ie Inline doesn't know how to deal with the
> situation when ChmFile.pm is in the 'lib' folder. It wants ChmFile.pm to be
> in the current working directory. If you move ChmFile.pm to the current
> working directory (top level folder) and amend the above line from the
> Makefile.PL appropriately, then it should work.
> 
> Alternatively, there may be a fix that allows ChmFile.pm to remain in the
> 'lib' folder - but I don't know what it is. I've a feeling that this has
> been discusssed here previously - perhaps there's something in the archive
> that helps.
> 
> I get a very similar error on Win32 when I move Simple.pm to a 'lib' folder
> with the Math::Simple example that ships with the source distro.
> 
> D:\tmp>dmake
> cp lib/Simple.pm blib\lib\Simple.pm
> dmake.exe:  Error -- `Simple.inl' not found, and can't be made
> 
> Cheers,
> Rob
> 
> 

Reply via email to