小编kon*_*ked的帖子

序列化和反序列化perl DBI连接对象

我需要使用DBI连接对象序列化一个数组,以使用共享内存与其他进程共享.但反序列化不起作用.

使用可存储的qw /冻融/;

my @connections;

for(my $c = 0;$c < 5;$c++) {
  my $conn = DBI->connect($dsn,$user,$password,{'AutoCommit' => 1, 'RaiseError' => 1, 'PrintError' => 0});
  push(@connections,$conn);
}

my $shm = freeze(@connections);
my $obj = thaw($shm);
Run Code Online (Sandbox Code Playgroud)

返回错误:全局符号

"$ drh"需要明确的包名(您是否忘记在(eval 33)第6行声明"我的$ drh"?).

perl dbi storable

0
推荐指数
1
解决办法
139
查看次数

标签 统计

dbi ×1

perl ×1

storable ×1