为什么 DBIx 色谱柱没有放气?

Why DBIx column is not deflated?

InflateColumn这样定义

__PACKAGE__->inflate_column( request => { inflate => sub{ die },  deflate => sub{ die } } );

但是当我尝试将数据存储到此列时,它存储没有问题。

$schema->resultset( 'Table' )->create({
    request => 'value'
});

为什么 inflate/deflate 没有被调用?

deflate 将在 value 是数组引用或散列引用时调用

$schema->resultset( 'Table' )->create({
    request => [ 'value' ]
});

UPD DOC

It will handle all types of references except scalar references. It will not handle scalar values, these are ignored and thus passed through to SQL::Abstract. This is to allow setting raw values to "just work". Scalar references are passed through to the database to deal with, to allow such settings as \'year + 1' and \'DEFAULT' to work.

If you want to filter plain scalar values and replace them with something else, see DBIx::Class::FilterColumn.