Hello,

I'm trying to wrap a C library into a Perl class and the solution I've
tried is to actually wrap it in C++ and then use Inline::CPP to make
it usable in Perl. It works fine, but the problem is making a CPAN
distribution out of it. My code looks something like this:



#package ChmFile;       #Not needed as Inline::CPP detects the class declaration
                                   #and creates the appropriate namespace.

our $VERSION = '0.01';

use strict;
use warnings;
use diagnostics;
use Inline (
            CPP => Config => LIBS => '-lchm', 
            VERSION => $VERSION,
            NAME => __PACKAGE__,
            CLEAN_AFTER_BUILD => 0
            );
use Inline 'CPP';
            

#Some huge package isn't it? Lots of Perl... hehe!
1;

#The start of the CPP code, where all the fun begins :)
__DATA__
__CPP__

#include "chm_lib.h"

#define ALL_FILES (1)
#define BASE_FILES (2)


class ChmFile
{
private:
    chmFile*    target;         //the chmFile structure contained by the object
    char*       filename;       //the name of the file

public:
    ChmFile(char* filename);
    ~ChmFile();

    int enum_files(char* out_file, int mode);

    //method for extracting all the contents of the archive in a given directory
    int extract_all(char* out_dir);

    //method for extracting a single item from the archive and outputting it to
    //a certain output file
    int extract_item(char* item_name, char* out_file);

    //method for getting the length of a single item in the archive
    unsigned long get_item_length(char* item_name);

    //method for getting the name of the archive
    char* get_name();
}  
//etc. etc. etc.

After all this I have the ChmFile class implementation and all. It
works quite well and I can use it as any normal Perl class.

My Makefile.pl is as simple as can be:

WriteMakefile(
    NAME              => 'ChmFile',
    VERSION_FROM      => 'lib/ChmFile.pm', # finds $VERSION
    PREREQ_PM         => {Inline::CPP => 0.25}, # e.g., Module::Name => 1.1
);

I've made the stubs for my distribution with "h2xs -AX --skip-exporter
-n ChmFile". When I try to make the Makefile I get the following
error:

make: *** No rule to make target 'ChmFile.inl', needed by 'pure_all'. Stop.

Can anyone help me?

Thanks,
Alexandru Palade


p.s. Oh and if it's a really simple problem, before you shoot me, bear
in mind that this is the first CPAN module I'm trying to build, and
it's the first itme I'm using Inline. Also, I've looked far and wide
for an answer but all I could find were answers to Inline::C problems.

Reply via email to