I am getting the following errors when I execute the code below.
Any ideas why and how to fix them?
( I saw something similar posted in the lists before and it
had something to do with using "my" and "local" variables and/or
passing parameters by reference. Does this ring a bell
to anybody?)
Here are the errors:
Undefined value assigned to typeglob at /export/fmsgml60/solbook/export2/common/jcode_pl_2_13.pl line 399.
Undefined subroutine &jcode::f called at /export/fmsgml60/solbook/export2/common/jcode_pl_2_13.pl line 400.
Here is my code:
use lib "/jcode";
require("jcode_pl_2_13.pl");
# hardcode the UTF8 string for chapter and appendix
$utf8_chap_pref = "\347\254\254";
$utf8_chap_suff = "\347\253\240";
$utf8_app_pref = "\344\273\230\351\214\262";
# convert from UTF8 to SJIS
$sjis_chap_pref = jcode::convert(\$utf8_chap_pref, 'sjis', 'utf8');
$sjis_chap_suff = jcode::convert(\$utf8_chap_suff, 'sjis', 'utf8');
$sjis_app_pref = jcode::convert(\$utf8_app_pref, 'sjis', 'utf8');
Here is jcode::convert. It is in a file called /jcode/jcode_pl_2_13.pl
which is included above with require.
;#
;# Convert any code to specified code.
;#
sub convert {
local(*s, $ocode, $icode, $opt) = @_;
return (undef, undef) unless $icode = $icode || &getcode(*s);
return (undef, $icode) if $icode eq 'binary';
$ocode = 'jis' unless $ocode;
$ocode = $icode if $ocode eq 'noconv';
local(*f) = $convf{$icode, $ocode};
&f(*s, $opt);
wantarray ? (*f, $icode) : $icode;
}
Lines 399-400 are the following:
local(*f) = $convf{$icode, $ocode};
&f(*s, $opt);
I have not written the jcode_pl_2_13.pl. It's been written by somebody
else to convert japanese chaeacters from one encoding to another.
Any ideas will be greatly appreciated.
--tassos