VsCode Perl Debug时模拟命令行传入参数

复制代码
Unknown option: name zhangs
at D:/ProgramFiles/strawberry/perl/lib/Getopt/Long.pm line 1072.
Getopt::Long::FindOption(ARRAY(0x29ad740), "(--|-|\\+)", "--", "-name zhangS", HASH(0x32d54e0)) called at D:/ProgramFiles/strawberry/perl/lib/Getopt/Long.pm line 528
Getopt::Long::GetOptionsFromArray(undef, undef, undef, undef, undef, ARRAY(0x29ad740), "name=s", SCALAR(0x2d5c3e8), ...) called at D:\work\p1\t1.pl line 10
Unknown option: age 25
at D:/ProgramFiles/strawberry/perl/lib/Getopt/Long.pm line 1072.
Getopt::Long::FindOption(ARRAY(0x29ad740), "(--|-|\\+)", "--", "-age 25", HASH(0x32d54e0)) called at D:/ProgramFiles/strawberry/perl/lib/Getopt/Long.pm line 528
Getopt::Long::GetOptionsFromArray(undef, undef, undef, undef, undef, ARRAY(0x29ad740), "name=s", SCALAR(0x2d5c3e8), ...) called at D:\work\p1\t1.pl line 10
Error in command line arguments
at D:\work\p1\t1.pl line 10.




Perl VsCode debug 很麻烦,各种报错.而且LZ本地装上了,发现数字类型的变量可以看到,字符串类型的变量不显示,NND,折腾了好几天,最后放弃,还是用CMD 进行debug

最终还是用CMD debug 省事,就是操作小麻烦...

复制代码
DBD::Pg::db do failed: 错误:  当前事务被终止, 事务块结束之前的查询被忽略 at able.pl line 777
引起原因:LZ本地是手动事务AutoCommit => 0, (AutoCommit => 1 就是自动事务)
$dh = DBI->connect(DSN, USER, PASSWORD, { RaiseError => 1,AutoCommit => 0,pg_enable_utf8 => 1}) or die DBI::errstr;
上一个SQL执行失败了,没有回滚 or 提交事务造成
代码里加:$dh->commit;

DBD::Pg::st execute failed: 错误:  无效的类型 integer 输入语法: ""
CONTEXT:  unnamed portal parameter $12 = '' at Table.pl line 800, <INFILE_CSV> line 1.
PostgreSQL数据库某字段是Integer类型,但是CSV文件某字段的值是空串''造成的异常
foreach my $value (@$csvdata) {
				if ($value eq '') {
			        $value = undef;
			    }
				if ($cnt != 0) {
					$sql .= ", ";
				}
				$sql .= "?";
				$cnt++;
			}
追加了
if ($value eq '') {
       $value = undef;
   }
把空串替换为undef,PG就能接受

DBI connect('dbname=postgres;host=127.0.0.1;port=5432','bkdb3',...) failed: authentication method 10 not supported at
Failed:不支持认证方式10 at 276行
Issuing rollback() due to DESTROY without explicit disconnect() of DBD::Pg::db handle dbname=postgres;host=127.0.0.1;port=5432 at D:/ProgramFiles/strawberry/perl/lib/Encode.pm line 212.
Exception : 処理中にエラーが発生しました ( Wide character at D:/ProgramFiles/strawberry/perl/lib/Encode.pm line 212. 
)。
错误信息表明你在使用 Perl DBI 连接 PostgreSQL 时,遇到了认证方式的问题。具体来说,错误信息中的"认证方式10"通常是指 PostgreSQL 服务器正在使用的认证方法与你的客户端驱动程序(DBD::Pg)不兼容
解决方案:修改了pg_hba.conf文件
LZ本地是先把 md5  →  trust 了先用着调试程序,
相关推荐
历程里程碑3 天前
链表-----
数据结构·线性代数·算法·链表·矩阵·lua·perl
朵朵奇葩向阳开#4 天前
【无标题】
javascript·typescript·ruby·laravel·perl·composer
ZVAyIVqt0UFji8 天前
高可用虚拟IP(HaVip)技术详解:原理、设计与应用
开发语言·网络·网络协议·tcp/ip·perl
老友@10 天前
云计算的统一心智模型
开发语言·ci/cd·docker·云计算·k8s·perl
普通网友11 天前
探索Perl在ASIC中的应用:深入标量、数组和哈希的应用
scala·哈希算法·perl
oOOpHQYUKG1 个月前
混合动力汽车交通堵塞时的节能动力总成控制 ##ECMS 混合动力电动汽车有助于节省燃料和实现减...
perl
UseLessQQ1 个月前
2.5云计算python作业
开发语言·python·perl
2601_949146531 个月前
Perl语音通知接口实现:使用Perl脚本快速调用REST API发送语音消息
开发语言·perl
普通网友2 个月前
云计算数据加密选型:合规要求(GDPR / 等保)下的方法选择
开发语言·云计算·perl
weixin_395448912 个月前
draw_tensor2psd.py_cursor
lua·perl·symfony