YanoRyuichi.com/
Wiki
Blog
GitHub
Sandbox
開始行:
* スキーマの設定方法 inflate/deflate [#r4ca6d26]
*** MyDB/Schema.pm [#f7cd6f8f]
install_inflate_rule
'^sex$' =>
callback {
inflate {
my $value = shift;
return $value eq '1' ? 'man' : 'woman';
};
deflate {
my $value = shift;
return defined $value == 1 ? 1 : 2;
};
};
終了行:
* スキーマの設定方法 inflate/deflate [#r4ca6d26]
*** MyDB/Schema.pm [#f7cd6f8f]
install_inflate_rule
'^sex$' =>
callback {
inflate {
my $value = shift;
return $value eq '1' ? 'man' : 'woman';
};
deflate {
my $value = shift;
return defined $value == 1 ? 1 : 2;
};
};
ページ名: