1DBIx::Class::Helper::RoUws:e:rNuCmoinftyrGiebtu(t3e)d PeDrBlIxD:o:cCulmaesnst:a:tHieolnper::Row::NumifyGet(3)
2
3
4
6 DBIx::Class::Helper::Row::NumifyGet - Force numeric "context" on
7 numeric columns
8
10 package MyApp::Schema::Result::Foo_Bar;
11
12 __PACKAGE__->load_components(qw{Helper::Row::NumifyGet Core});
13
14 __PACKAGE__->table('Foo');
15 __PACKAGE__->add_columns(
16 foo => {
17 data_type => 'integer',
18 is_nullable => 0,
19 is_numeric => 1,
20 },
21 );
22
23 sub TO_JSON {
24 return {
25 foo => $self->foo, # this becomes 0 instead of "0" due to context
26 }
27 }
28
30 get_column
31 This is the method that "converts" the values. It just checks for
32 "is_numeric" and if that is true it will numify the value.
33
34 get_columns
35 This method also "converts" values, but this one is called a lot more
36 rarely. Again, It just checks for "is_numeric" and if that is true it
37 will numify the value.
38
40 Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
41
43 This software is copyright (c) 2020 by Arthur Axel "fREW" Schmidt.
44
45 This is free software; you can redistribute it and/or modify it under
46 the same terms as the Perl 5 programming language system itself.
47
48
49
50perl v5.32.1 2021-01D-B2I7x::Class::Helper::Row::NumifyGet(3)