Perl Error and Exception Collections

1.Not a CODE reference
Perl试图将一个引用计算成一个代码值(也就是一个子例程),但是找到了指向其他东西的引用。你可以用ref函数看它究竟是什么类型的引用

print ref($var)
我遇到的情况主要是 UI grid 定位:  应该是 $entry_5->grid(-row => 5, -column => 2,-columnspan => 1);
  而我把 “grid ” 漏掉了, 写成了
  $entry_5->(-row => 5, -column => 2,-columnspan => 1);

2. hash- or arrayref expected (not a simple scalar, use allow_nonref to allow this) at test1.pl line 19
用 perl hash 结构创建一个 json utf8字符串, 需要加引用\ , 如:
  encode_json \ %hash; 如果没有引用“\” ,就会报这个错
encode_json 函数等同于 to_json , to_json 也是需要有\ 的

3. garbage after JSON object, at character offset 77(...
4. , or } expected while parsing object/hash
5.  cannot localize lexical variable $x ... 

 Referring : http://www.4byte.cn/question/350961/why-can-t-localize-lexical-variable-in-perl.html

6 . cannot find YAML on Ubuntu
sudo apt-get install libperl-dev
sudo apt-get install libconfig-yaml-perl

7. TK::Error: Cannot decode string with wide characters at c:\Dwimperl\perl\lib/Encode.pm
错误抛出在我从 TK GUI 界面entry 中获得输入,拼接字符串。主要原因是TK entry 输入会自动decode 为Unicode, 而输出需要为 UTF8 , 如果两种字符串在一起混合就会报错。 需要把输入编码为utf8 , encode("utf8".$var)  再与其他字符串变量连接
croak
croak just like die , but die only show error line and position; croak show error line and position and process  name , see:
http://blog.sina.com.cn/s/blog_8711d35c0100wuqc.html

http://stackoverflow.com/questions/24959739/or-expected-while-parsing-object-hash-error-while-parsing-a-json-file
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值