aspell-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Aspell-user] Help, Perl module not happy when called


From: Flying In LA
Subject: [Aspell-user] Help, Perl module not happy when called
Date: Fri, 18 Nov 2005 11:03:59 -0800 (PST)

After install aspell and trying to get the perl module to run, I get
the following error:

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


Here is the CGI script, ANY help would be appreciated:

#!/usr/bin/perl 

use Text::Aspell;

my ($identifier, $word, @suggestions, $i, $l, %input, $speller);

# 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/');

# Parse CGI input
parseInput();

# Send header
print "Content-type: text/javascript; charset=UTF-8\n\n";
print "data = [";

# Parse request and generate response
for ($i = 0; ; $i++) {
        $identifier = $i;
        $word       = $input{$i};
        if ($word eq '') { last; }
        if ($i) { print ','; }
        if ($speller->check($word)) {
                print '[1]';
        }
        else {
                print '[0,[';
                @suggestions = $speller->suggest($word);
                $l = 0;
                foreach (@suggestions) {
                        if ($l) { print ','; }
                        print '"' . $_ . '"';
                        $l++;
                }
                print ']]';
        }
}
print "];\n";


# Internal support functions
sub parseInput {
        my $input   = \%input;
        my ($data, @pairs, $pair, $key, $value, $len);
        if ($ENV{'REQUEST_METHOD'} eq 'GET') { $data =
$ENV{'QUERY_STRING'}; }
        elsif ($ENV{'REQUEST_METHOD'} eq 'POST') {
                $len = $ENV{'CONTENT_LENGTH'};
                if ($len > 102400) { $len = 102400; } # Limit input
to 100 kB
                read(STDIN, $data, $ENV{'CONTENT_LENGTH'});
        }
        # Parse urlencoded GET/POST input
        if (length($data)) {
                if ($ENV{'CONTENT_TYPE'} =~ m/urlencoded/ ||
$ENV{'REQUEST_METHOD'} eq 'GET') {
                        # Replace ampersands in URI's with semicolons
to comply to the w3c
                        # uri recommendations while maintaining
backwards compatibility.
                        $data =~ s/\&/;/g;
                        @pairs = split(/;/ ,$data);
                        foreach $pair (@pairs) {
                                if ($pair =~ m/([^=]+)=(.*)/) {
                                        $key  = $1; $value = $2;
                                        _decodeInput(\$value);
                                        if (grep(/^$key$/,
keys(%{$input}))) {
                                                unless
(ref($input->{$key}) =~ /ARRAY/) {
                                                        my
$originalValue = $input->{$key};
                                                        undef
$input->{$key};
                                                       
$input->{$key}[0] = $originalValue;
                                                }
                                               
push(@{$input->{$key}}, $value);
                                        }
                                        else { $input->{$key} =
$value; }
}       }       }       }       }

sub _decodeInput {
        ${$_[0]} =~ s/\+/ /g;
        ${$_[0]} =~ s/%([\dA-Fa-f]{2})/pack("C", hex($1))/eg;
        ${$_[0]} =~ s/\\/\\\\/g;
}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]