blib/lib/App/Netdisco/DB/Result.pm untested

filter: Statementstmt 0.0% 0 / 21 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 29 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
unserializable_data_types
2.0
BEGIN
2.0
CRAP 2.0
1 package App::Netdisco::DB::Result;
2  
3 use strict;
4 use warnings;
5  
6 use base 'DBIx::Class::Core';
7  
8 BEGIN {
9 no warnings 'redefine';
10 __PACKAGE__->load_components(qw{Helper::Row::ToJSON});
11  
12 # this replacement will avoid the issue of relation names which override
13 # field names, causing TO_JSON to return object instances, breaking to_json
14 *DBIx::Class::Helper::Row::ToJSON::TO_JSON = sub {
15 my $self = shift;
16 my $columns_info = $self->columns_info($self->serializable_columns);
17 my $columns_data = { $self->get_columns };
18 return {
19 map +($_ => $columns_data->{$_}), keys %$columns_info
20 };
21 };
22 }
23  
24 # for DBIx::Class::Helper::Row::ToJSON
25 # to allow text columns to be included in results
26  
27 sub unserializable_data_types {
28 return {
29 blob => 1,
30 ntext => 1,
31 };
32 }
33  
34 1;