[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Aspell-user] Help, Perl module not happy when called
From: |
Bill Moseley |
Subject: |
Re: [Aspell-user] Help, Perl module not happy when called |
Date: |
Mon, 21 Nov 2005 06:41:16 -0800 |
User-agent: |
Mutt/1.5.10i |
On Fri, Nov 18, 2005 at 11:03:59AM -0800, Flying In LA wrote:
Been a while since I ventured into this mailbox, sorry.
> perl: relocation error:
> /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Text/Aspell/Aspell.so:
> undefined symbol: new_aspell_config
That normally means you are running code that was compiled on a
different version of perl. Are you mixing packaged binaries with code
built from source?
Below I included a complete build session for Aspell and the Perl module, if
you want to start from scratch.
> Here is the CGI script, ANY help would be appreciated:
Ok:
> #!/usr/bin/perl
>
> use Text::Aspell;
use strict;
use warnings;
> my ($identifier, $word, @suggestions, $i, $l, %input, $speller);
Localize your variables where they are used.
>
> # Create speller object and set options
> $speller = Text::Aspell->new;
> $speller->set_option('lang','en_US');
> $speller->set_option('sug-mode','fast');
> $speller->set_option('local-data-dir','/usr/lib/aspell/');
You should not need to set local-data-dir in most cases, I'd think.
>
> # Parse CGI input
> parseInput();
use CGI; # or any of the other modules that do this
>
> # Send header
> print "Content-type: text/javascript; charset=UTF-8\n\n";
Javascript?
Here's my session:
$ mkdir aspell
$ cd aspell
$ wget ftp://ftp.gnu.org/gnu/aspell/aspell-0.60.4.tar.gz
$ tar zxf aspell-0.60.4.tar.gz
$ cd aspell-0.60.4
$ ./configure --prefix=$HOME/aspell && make && make install
$ cd ..
$ export PATH=$(pwd)/bin:$PATH
$ which aspell
/home/moseley/aspell/bin/aspell
$ wget ftp://ftp.gnu.org/gnu/aspell/dict/en/aspell6-en-6.0-0.tar.bz2
$ tar jxf aspell6-en-6.0-0.tar.bz2
$ cd aspell6-en-6.0-0
$ ./configure
Finding Dictionary file location ... /home/moseley/aspell/lib/aspell-0.60
Finding Data file location ... /home/moseley/aspell/lib/aspell-0.60
$ make && make install
$ cd ..
$ aspell --version
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.4)
$ aspell -a
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.4)
aspelll
& aspelll 6 0: Aspell, Ispell, spell, Aspell's, Ascella, Ispell's
$ wget http://search.cpan.org/CPAN/authors/id/H/HA/HANK/Text-Aspell-0.05.tar.gz
$ tar zxf Text-Aspell-0.05.tar.gz
$ cd Text-Aspell-0.05
$ perl Makefile.PL PREFIX=$HOME/aspell \
> CCFLAGS=-I$HOME/aspell/include \
> LIBS="-L$HOME/aspell/lib -laspell
$ make && make test && make install
$cd ..
# Check that the perl module linked to my local copy of libaspell.
$ ldd lib/perl/5.8.7/auto/Text/Aspell/Aspell.so | grep aspell
libaspell.so.15 => /home/moseley/aspell/lib/libaspell.so.15 (0x4000c000)
$ cat spell.pl
#!/usr/bin/perl
use Text::Aspell;
use strict;
use warnings;
my $speller = Text::Aspell->new or die "no speller";
$speller->set_option('lang','en_US');
$speller->set_option('sug-mode','fast');
my $word = shift or die "no word";
if ( $speller->check( $word ) ) {
print "$word was found\n";
exit;
}
print "$word : ", join( ', ', $speller->suggest( $word ) ), "\n";
$ perl spell.pl aspelll
aspelll : Aspell, Ispell, spell, Aspell's, Ascella, Ispell's
--
Bill Moseley
address@hidden