LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-09-2010, 12:04 AM   #1
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
Perl compilation error


I get an error when typing perl build.pl:
Code:
Cannot locate Unicode/String.pm in @INC
 
Old 03-09-2010, 12:35 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,606

Rep: Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445
You should get a much longer output than that.. it usually says what @INC consists of ie the list of known dirs to look in for reqd modules/fns.
It's basically saying you've called the Unicode:String sub, but it can't find the file containing the definition.
 
Old 03-09-2010, 01:07 AM   #3
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Original Poster
Rep: Reputation: 231Reputation: 231Reputation: 231
Cant locxte Unicode/String.pm in @INC (@INC contains: ./lib /etc/perl/lib/perl/5.100.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl/5.10 .)
 
Old 03-09-2010, 09:07 AM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,398
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
It says that it expects a module Unicode::String to be founds in one of the 'usual places', but that it isn't found there. If you have actually installed it somewhere else, you can add to your main package
Code:
use lib '/the/dir/where/it/is';
Put the 'use lib' directive above the statement that loads the module.
If you haven't installed the module, then the CPAN installer will probably put it in the proper place among the list of 'usual places'.

--- rod.
 
Old 03-09-2010, 12:15 PM   #5
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Original Poster
Rep: Reputation: 231Reputation: 231Reputation: 231
I solved the first error by typing
Code:
cpan --install Unicode::String
But now there is another error:
Code:
Prototype mismatch: sub AIML::Common::LOCK_UN () vs none at lib/AIML/Common.pm line 55.


Died at lib/AIML/Unicode.pm line 102.
Compilation failed in require at lib/AIML/Common.pm line 109.
BEGIN failed--compilation aborted at lib/AIML/Common.pm line 109.
Compilation failed in require at build.pl line 32.
BEGIN failed--compilation aborted at build.pl line 32.
Unicode.pm:
Code:
=head1 NAME

AIML::Unicode - Functions for UTF8 String Case Changing

=head1 SYNOPSIS

   $upper    = uppercase ( 'uppercase' );            # returns 'UPPERCASE'
   $lower    = lowercase ( 'lOwErCaSe' );            # returns 'lowercase'
   $formal   = formal    ( 'proper name' );          # returns 'Proper Name'
   $sentence = sentence  ( 'this is a sentence' );   # returns 'This is a sentence'

=head1 DESCRIPTION

This module provides functions to change the case of UTF8 strings.

=cut

package AIML::Unicode;

use strict;
use warnings;

BEGIN
{
	use vars qw ( $VERSION $DEBUG %CONSTANTS );

	$VERSION	= $VERSION	= 0.08;

	$DEBUG	= 0	unless $DEBUG;
}

use utf8;
use charnames ':full';

use Unicode::String		();
use Unicode::CharName	();
use Unicode::Map8			();

use EnglishSave;

=head1 GLOBALS

   $AIML::Unicode::DEBUG = 1;

No debugging functionality provided yet.

=head1 EXPORT

=head2 Public Functions

C<uppercase>, C<lowercase>, C<formal>, C<sentence>

=cut

sub import
{
	no strict qw ( refs );

	my $callerpkg = caller(0);

	#	export functions
	#
	*{"$callerpkg\::uppercase"}			= *uppercase;
	*{"$callerpkg\::lowercase"}			= *lowercase;
	*{"$callerpkg\::formal"}				= *formal;
	*{"$callerpkg\::sentence"}				= *sentence;

	1;
}

#
#	PRIVATE VARS
#
my ( $TO_UPPER, $TO_LOWER, $TO_TITLE, $TO_DIGIT );

$TO_UPPER	= _load_case ( 'unicode/To/Upper.pl' );
$TO_LOWER	= _load_case ( 'unicode/To/Lower.pl' );
$TO_TITLE	= _load_case ( 'unicode/To/Title.pl' );

#	MEMO: 	unicode/To/Digit.pl

=head1 FUNCTIONS

Do not overwrite and call functions marked as I<B<PRIVATE>> from outside.

=over 4

=cut

=pod

=item * _load_case ( $package ) I<PRIVATE>

This function loads the necessary case change tables at compile time.

=cut

sub _load_case
{
	my $pkg = shift;

	my $changer = do ( $pkg ) or die;

	my @lines = split /\n/, $changer;

	$changer = {};

	foreach my $line ( @lines )
	{
		my ( $key, $border, $value )	= split /\t/, $line;

		$key		||= 0;
		$border	||= 0;
		$value	||= 0;

		$key		= hex $key;
		$border	= hex $border;
		$value	= hex $value;

		if ( $border )
		{
#			printf "$pkg\tk=0x%04x\tb=0x%04x\tv=0x%04x\n",
#				$key, $border, $value;

			my $offset = $key - $value;

			foreach my $key2 ( $key .. $border )
			{
#				printf "\tborder\tk=0x%04x\to=0x%04x\tv=0x%04x\n",
#					$key2, $offset, $key2 - $offset;

				$changer->{$key2} = $key2 - $offset;
			}
		}
		else
		{
#			printf "$pkg\tk=0x%04x\tb=0x%04x\tv=0x%04x\n",
#				$key, $border, $value;
#
#			printf "\t\t\t\tk=0x%04x\to=0x%04x\tv=0x%04x\n",
#				$key, 0, $value;

			$changer->{$key} = $value;
		}
	}

#	use Data::Dumper;
#	print "\n$pkg\n", Dumper ( $changer ), "\n";

	return $changer;
}

=pod

=item * uppercase ( $string )

Returns a case changed string.

'uppercase'	becomes	'UPPERCASE'

See L<http://alicebot.org/TR/2001/WD-aiml/#section-uppercase>.

=cut

sub uppercase
{
	return _change_case ( shift(), $TO_UPPER );
}

=pod

=item * lowercase ( $string )

Returns a case changed string.

'lOwErCaSe'	becomes	'lowercase'

See L<http://alicebot.org/TR/2001/WD-aiml/#section-lowercase>.

=cut

sub lowercase
{
	return _change_case ( shift(), $TO_LOWER );
}

=pod

=item * _change_case ( $string ) I<PRIVATE>

The secret worker.

=cut

sub _change_case
{
	my $str_in	= shift;
	my $changer	= shift() || {};

	return ''		unless defined $str_in;

	my $str_out = '';

	my $str_obj = Unicode::String::utf8 ( $str_in );

	my @char_list = $str_obj->unpack;

	my ( $char_in, $char_out );

	foreach $char_in ( @char_list )
	{
		if ( $char_out = $changer->{$char_in} )
		{
			$str_out .= Unicode::String::uchr ( $char_out );

#			printf "found\t0x%04x\t0x%04x\t'%s'\n", $char_in, $char_out, $str_out;
		}
		else
		{
			$str_out .= Unicode::String::uchr ( $char_in );

#			printf "as is\t0x%04x\t0x%04x\t'%s'\n", $char_in, 0, $str_out;
		}
	}

	return "$str_out";	#	!!!
}

=pod

=item * formal ( $string )

Returns a case changed string.

'proper name'	becomes	'Proper Name'

See L<http://alicebot.org/TR/2001/WD-aiml/#section-formal>.

=cut

sub formal
{
	my $str_in	= shift;

	return ''		unless defined $str_in;

	my @words = split / /, $str_in;

	foreach my $word ( @words )
	{
		my $u = Unicode::String::utf8 ( $word );

		my $first	= $u->substr ( 0, 1 );
		my $rest		= $u->substr ( 1 );

		$first	= ''		unless defined $first;
		$rest		= ''		unless defined $rest;

		$word = _change_case ( "$first", $TO_TITLE ) . _change_case ( "$rest", $TO_LOWER );	#	!!!
	}

	return join ( ' ', @words );
}

=pod

=item * sentence ( $string )

Returns a case changed string.

'this is a sentence'	becomes	'This is a sentence'

'dies ist ein Satz'	becomes	'Dies ist ein Satz' (!)

See L<http://alicebot.org/TR/2001/WD-aiml/#section-sentence>.

=cut

sub sentence
{
	my $str_in	= shift;

	return ''		unless defined $str_in;

	my $u = Unicode::String::utf8 ( $str_in );

	my $first	= $u->substr ( 0, 1 );
	my $rest		= $u->substr ( 1 );

	$first	= ''		unless defined $first;
	$rest		= ''		unless defined $rest;

	return _change_case ( "$first", $TO_UPPER ) . "$rest";	#	!!!
}


=pod

=back

=head1 AUTHOR / COPYRIGHT

Ernest Lergon, L<ernest@virtualitas.net>.

Copyright (c) 2002 by Ernest Lergon, VIRTUALITAS Inc.
L<http://www.virtualitas.net>

AIML - Artificial Intelligence Markup Language
Copyright (c) 1995-2002, A.L.I.C.E. AI Foundation
L<http://www.alicebot.org>

All Rights Reserved. This module is free software; you can
redistribute it and/or modify it under the same terms as Perl itself.

If you have suggestions for improvement, please drop me a line.  If
you make improvements to this software, I ask that you please send me
a copy of your changes. Thanks.

=head1 SEE ALSO

L<AIML::Parser>, L<AIML::Loader>, L<AIML::Responder> and L<AIML::Graphmaster>.

=cut

1;

__END__
 
Old 03-09-2010, 06:23 PM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,398
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Ouch. That doesn't look too promising. I don't think you've supplied a sample of the right module to get to the bottom of the problem, but from where I sit, that is fairly obscure error message. It looks like a subroutine in one of the modules you are calling has been prototyped more than once and the two prototypes differ. You may have to modify installed code to fix this. I wonder if there is a bug fix published for this.
Maybe try contacting the original author if you got this from CPAN.
--- rod.
 
Old 03-10-2010, 11:05 AM   #7
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Original Poster
Rep: Reputation: 231Reputation: 231Reputation: 231
Quote:
Originally Posted by theNbomr View Post
Maybe try contacting the original author if you got this from CPAN.
--- rod.
Cannot, its not available any more.
I downloaded with the internet archive.
 
Old 03-10-2010, 05:58 PM   #8
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Original Poster
Rep: Reputation: 231Reputation: 231Reputation: 231
code can be downloaded from http://web.archive.org/web/200705020...net/perl/aiml/
 
Old 03-10-2010, 06:06 PM   #9
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,398
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Quote:
Originally Posted by smeezekitty View Post
Cannot, its not available any more.
I downloaded with the internet archive.
I guess that makes you the maintainer...

Seriously, though, have a look at Common.pm, line 55, and line 109. These seem to be of interest to the compiler. I'm guessing one of them is a subroutine, or a subroutine prototype.

--- rod.
 
Old 03-10-2010, 06:21 PM   #10
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Original Poster
Rep: Reputation: 231Reputation: 231Reputation: 231
Lines of common.pm have an odd construct on lines 39-56:
Code:
eval
	{
		require Fcntl;
		Fcntl->import ( ':flock' );
	};
	my $err1 = $@ || '';

	my $err2 = not exists &flock;

	if ( $err1 or $err2 )
	{
		*CORE::GLOBAL::flock		= sub { 1 };

		*AIML::Common::LOCK_SH	= sub { 1 };
		*AIML::Common::LOCK_EX	= sub { 2 };
		*AIML::Common::LOCK_NB	= sub { 4 };
		*AIML::Common::LOCK_UN	= sub { 8 };
	}
as for 109:
Code:
use AIML::Unicode;
 
Old 03-11-2010, 11:20 AM   #11
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,398
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Quote:
Originally Posted by smeezekitty View Post
Lines of common.pm have an odd construct on lines 39-56:
You're right. I can't make any sense of it. I think you might be best served by inquiring on a Perl-specific forum. In any case, I think the solution will involve scrutiny of a larger sample of the code. Good luck.

--- rod.
 
Old 03-11-2010, 02:14 PM   #12
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by theNbomr View Post
You're right. I can't make any sense of it. I think you might be best served by inquiring on a Perl-specific forum. In any case, I think the solution will involve scrutiny of a larger sample of the code. Good luck.

--- rod.
The code posted here doesn't have line numbers in it - the latter can be obtained by using 'cat -n some_file'.

Maybe the lines are not that strange, I just don't know what they are.
 
Old 12-02-2014, 11:16 PM   #13
Kirsle
LQ Newbie
 
Registered: Dec 2014
Location: Los Angeles
Distribution: Fedora
Posts: 1

Rep: Reputation: Disabled
I'm aware this is an old thread, but if anyone else takes an interest in ProgramV and stumbles upon this in the future... I've updated ProgramV's code to run on modern Perl (5.8 through 5.18 and onwards). I have a fork of ProgramV on GitHub: https://github.com/kirsle/programv
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Inkscape compilation error: *** [extension/internal/pdfinput/pdf-parser.o] Error 1 w1k0 Slackware 12 10-25-2008 09:53 AM
compilation error : /tmp/cczC6Kc3.s:7368: Error: unknown pseudo-op: `.ltorg' nankie Red Hat 0 08-19-2008 10:15 AM
NDBM error lors de la compilation de perl-5.8.6 tifa Linux - Software 2 03-03-2005 10:22 AM
Yum error: .conflict between perl and perl-NDBM_File zepplin611 Red Hat 3 10-20-2004 10:22 AM
perl compilation error behmjose Linux From Scratch 0 12-18-2003 06:54 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration