Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想使用 Class::DBI 创建一个新对象。此对象的字段之一是 BLOB 类型。我有一个要用于此数据的文件句柄,但显然,这样做是行不通的:
my $item = My::Class::DBI::Class->insert({ foo => $bar, biz => $baz, blob => $my_filehandle });
我缺少什么技巧吗?
谢谢!
您必须读出文件句柄,然后将其插入。
my $blob = do {local $/; <$my_filehandle>}; my $item = My::Class::DBI::Class->insert({ foo => $bar, biz => $baz, blob => $blob, });