« Postfixで外部にメールが送信できずName service error for...のエラーが出る | トップページ | Javascriptで簡単な塗り絵をしてみた »

2014年4月15日 (火)

jcode.plでdefined(%hash) is deprecated at ../perllib/jcode.pl line 684.のエラー

perlがバージョンアップして5.14になったら

defined(%hash) is deprecated at ../perllib/jcode.pl line 684.
        (Maybe you should just omit the defined()?)
defined(%hash) is deprecated at ../perllib/jcode.pl line 693.
        (Maybe you should just omit the defined()?)

なるエラーが出るようになった。

defined関数はスカラーに適用されるものなので、ハッシュだとだめらしい。ハッシュが作られているかどうか調べればいいだけなので、682行目からの

sub z2h_euc {
    local(*s, $n) = @_;
    &init_z2h_euc unless defined %z2h_euc_inited;
    $s =~ s/($re_euc_c|$re_euc_kana)/
    $z2h_euc{$1} ? ($n++, $z2h_euc{$1}) : $1
    /geo;
    $n;
}

sub z2h_sjis {
    local(*s, $n) = @_;
    &init_z2h_sjis unless defined %z2h_sjis_inited;
    $s =~ s/($re_sjis_c)/$z2h_sjis{$1} ? ($n++, $z2h_sjis{$1}) : $1/geo;
    $n;
}

を次のように修正したら解決。

sub z2h_euc {
    local(*s, $n) = @_;
    &init_z2h_euc if !%z2h_euc;
    $s =~ s/($re_euc_c|$re_euc_kana)/$z2h_euc{$1} ? ($n++, $z2h_euc{$1}) : $1/geo;
    $n;
}

sub z2h_sjis {
    local(*s, $n) = @_;
    &init_z2h_sjis if !%z2h_sjis;
    $s =~ s/($re_sjis_c)/$z2h_sjis{$1} ? ($n++, $z2h_sjis{$1}) : $1/geo;
    $n;
}

 

 

« Postfixで外部にメールが送信できずName service error for...のエラーが出る | トップページ | Javascriptで簡単な塗り絵をしてみた »

2019年9月
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          

ブックマーク

無料ブログはココログ