jonb has asked for the wisdom of the Perl Monks concerning the following question:

Hi
I don't quite understand this error, I'm using this:
use Unicode::Map(); use Unicode::String qw(utf8 utf16); use Config::INI::Simple; our $conf = new Config::INI::Simple; # Read the config file. $conf->read ("/usr/lib/perl5/tengsl/tengsl_en.ini"); my $CHARSET = $conf->{ANNAD}->{CHARSET}; my $Map = new Unicode::Map($CHARSET);
#lots of code....then
return (utf8_to_latin($nafn_fyrirt)); sub utf8_to_latin { $Map->to8(utf8($_[0])->utf16); }
Can someone help ?
  • Comment on [error] Can't call method "to8" without a package or object reference at /usr/lib/perl5/tengsl/raun.pm line 2225.\n
  • Select or Download Code

Replies are listed 'Best First'.
Re: [error] Can't call method "to8" without a package or object reference at /usr/lib/perl5/tengsl/raun.pm line 2225.\n
by Corion (Patriarch) on Jan 12, 2009 at 14:39 UTC

    You're not checking the return value from Unicode::Map->new($CHARSET). Try

    my $Map = Unicode::Map->new($CHARSET) or die "Couldn't load Unicode map for '$CHARSET'";