line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Tersify::Plugin::DBIx::Class; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
11768
|
use strict; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
67
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
76
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
574
|
use Data::Tersify 1.003; |
|
2
|
|
|
|
|
27188
|
|
|
2
|
|
|
|
|
403
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.003'; |
9
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Data::Tersify::Plugin::DBIx::Class - tersify DBIx::Class objects |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 VERSION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
This is version 1.003. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
In e.g. the perl debugger |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
DB<1> use Data::Tersify; |
24
|
|
|
|
|
|
|
DB<2> my $dbic_row = $schema->resultset(...)->find(...); |
25
|
|
|
|
|
|
|
DB<3> x Data::Tersify::tersify($dbic_row) |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
produces something like |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
0 Data::Tersify::Summary::...::TableName (0xdeadbeef)=HASH(0xcafebabe) |
30
|
|
|
|
|
|
|
'_column_data' => HASH(0x1b32ca80) |
31
|
|
|
|
|
|
|
'date_created' => '2020-03-04 20:19:47' |
32
|
|
|
|
|
|
|
'id' => 558 |
33
|
|
|
|
|
|
|
'status' => 'active' |
34
|
|
|
|
|
|
|
'_in_storage' => 1 |
35
|
|
|
|
|
|
|
'_inflated_column' => HASH(0x1b318618) |
36
|
|
|
|
|
|
|
empty hash |
37
|
|
|
|
|
|
|
'_result_source' => Data::Tersify::Summary=SCALAR(0xbeefdead) |
38
|
|
|
|
|
|
|
-> 'DBIx::Class::ResultSource::Table (0xbabecafe) table_name' |
39
|
|
|
|
|
|
|
'related_resultsets' => HASH(0x7235e68) |
40
|
|
|
|
|
|
|
'related_table' => Data::Tersify::Summary=SCALAR(0x12345678) |
41
|
|
|
|
|
|
|
-> 'DBIx::Class::ResultSet (0x9abcdef0) ...::RelatedTable' |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
rather than screenfuls of stuff you don't care about. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
If you delve into the guts of the result sources or result sets, you'll get |
46
|
|
|
|
|
|
|
more chatty stuff, but it'll still be limited to amounts that the human brain |
47
|
|
|
|
|
|
|
can deal with. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 DESCRIPTION |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
This class provides terse description for various types of DBIx::Class |
52
|
|
|
|
|
|
|
objects, when used with L. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 handles |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
It handles DBIx::Class::ResultSource::Table, DBIx::Class::ResultSource::View |
57
|
|
|
|
|
|
|
and DBIx::Class::ResultSet objects. Surprisingly, that appears to be enough. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub handles { |
62
|
|
|
|
|
|
|
( |
63
|
2
|
|
|
2
|
1
|
2421
|
'DBIx::Class::ResultSource::Table', |
64
|
|
|
|
|
|
|
'DBIx::Class::ResultSource::View', |
65
|
|
|
|
|
|
|
'DBIx::Class::ResultSet' |
66
|
|
|
|
|
|
|
); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 handles_subclasses |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
It handles subclasses of those classes as well. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
74
|
|
|
|
|
|
|
|
75
|
1
|
|
|
1
|
1
|
2908
|
sub handles_subclasses { 1 } |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 tersify |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
It tersifies DBIx::Class::ResultSource::Table or ...::View objects into just |
80
|
|
|
|
|
|
|
the name of the table or view respectively. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
It tersifies DBIx::Class::ResultSet objects into the name of the result class. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This tends to be the source of the vast majority of the unwanted chaff that |
85
|
|
|
|
|
|
|
fills your screen. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub tersify { |
90
|
4
|
|
|
4
|
1
|
4987
|
my ($self, $dbic_object) = @_; |
91
|
|
|
|
|
|
|
|
92
|
4
|
100
|
100
|
|
|
48
|
if ( $dbic_object->isa('DBIx::Class::ResultSource::Table') |
|
|
50
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|| $dbic_object->isa('DBIx::Class::ResultSource::View')) |
94
|
|
|
|
|
|
|
{ |
95
|
2
|
|
|
|
|
12
|
return $dbic_object->{name}; |
96
|
|
|
|
|
|
|
} elsif ($dbic_object->isa('DBIx::Class::ResultSet')) { |
97
|
2
|
|
|
|
|
11
|
return $dbic_object->{_result_class}; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |
102
|
|
|
|
|
|
|
|