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 了先用着调试程序,

在这里插入图片描述

相关推荐

  1. Flink命令提交参数传递

    2024-06-08 10:24:03       42 阅读
  2. PHP命令脚本接收传入参数的三种方式

    2024-06-08 10:24:03       50 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-06-08 10:24:03       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-06-08 10:24:03       106 阅读
  3. 在Django里面运行非项目文件

    2024-06-08 10:24:03       87 阅读
  4. Python语言-面向对象

    2024-06-08 10:24:03       96 阅读

热门阅读

  1. azure cli的安装和使用

    2024-06-08 10:24:03       24 阅读
  2. go语言打印出变量的类型

    2024-06-08 10:24:03       24 阅读
  3. 【自动驾驶】点与向量从ego系转odometry系

    2024-06-08 10:24:03       23 阅读
  4. Github 2024-06-08 开源项目日报Top10

    2024-06-08 10:24:03       26 阅读
  5. 长轮询之websocket

    2024-06-08 10:24:03       23 阅读
  6. langchian_aws模块学习

    2024-06-08 10:24:03       32 阅读
  7. npm发布自己的插件包

    2024-06-08 10:24:03       36 阅读
  8. npm发布自己的插件包

    2024-06-08 10:24:03       28 阅读