Greetings!

I'm wrapping the Bow IR library, and I've made a possibly interesting
discovery.

If I want to use it directly, in a script, using the technique found in the 
Inline pod, it works perfectly. If I want to put it in a module, Bow.pm, it 
suddenly needs more header files and I have to provide the locations of 
these extra headers.

Here is the plain example script, using libbow directly:
#!/usr/bin/perl -w

my $word = shift;

print stem($word), "\n";

use Inline C => Config =>
           LIBS => '-lbow';
use Inline C => <<'END_OF_C_CODE';

#include <bow/libbow.h>

char *stem(char* word) {
        bow_stem_porter( word );
        return word;
}

END_OF_C_CODE

Pretty simple, yes?

But for the module here is the code necessary in Bow.pm:
package Bow;

require 5.005_62;
use strict;
use warnings;
use vars qw( $VERSION );

$VERSION = '0.01';

use Inline C => 'DATA',
           VERSION => '0.01',
           NAME => 'Bow';
use Inline C => Config => LIBS => '-lbow';
           INC => '-I/home/tchecky/bow-20000915';

1;

__DATA__
__C__

#include <bow/libbow.h>

char *stem(char* class, char* word) {
        bow_stem_porter( word );
        return word;
}

... Also pretty much by the book, only the 'INC' configuration option is 
necessary this time. (Compiler complains as much and demands extra headers 
that aren't installed by the bow install process).

Why is that? Supposedly everything necessary is there without having access 
to the extra headers, so why require them when wrapping into a module and 
not require them when calling from a script?

Cheers!


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

Reply via email to