Perl Error and Exception Collections
2015-10-13 16:02
471 查看
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) 再与其他字符串变量连接
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[/code]
相关文章推荐
- schema for clojure
- [原创]在Windows和Linux中搭建PostgreSQL源码调试环境
- SQL Server逻辑读-预读-物理读
- 一、Two Sum
- UE3 体积感光束教程
- Memo: SyntaxHighlighter 的使用
- (转载) 程序员都应遵守的 11 条规则
- How-to: 百度结构化数据插件 Checkurl 请求失败
- 常用SQL查询语句 Oracle中Union,Union All,Intersect,Minus的有什么区别
- JavaScript 代码性能优化总结 && 一个最简单的web服务器
- php 3des 加解密的整理
- 全屏滑动
- SqlDbType与DbType这间的转换关系
- 使用u盘装win7系统图文教程 如何使用U盘安装win7系统
- 安装oracle11g时,Enterprise Manager配置成功,出现以下警告……
- mysql性能优化-慢查询分析、优化索引和配置
- Office Delve 初窥 - What is Office Delve?
- C#: 双检锁 (Double Checked Locking)
- ADFS 概念与基本开发介绍 (1)
- delphi正则表达式学习笔记(三)