DBIx/Class/ResultSetManager.pm

filter: Statementstmt 93.7% 60 / 64 Branchbran 58.3% 7 / 12 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 92.3% 12 / 13 Podpod 0.0% 0 / 2 totaltotal 85.1% 80 / 94 CC 9 SCAR 10.2
CC
9
Cov
87%
_register_attributes
6.1
_register_resultset_class
2.0
table
2.0
CRAP 2.8
« DBIx/Class/Storage/DBI/ODBC/Firebird.pm ↑ Summary DBIx/Class/Relationship/ProxyMethods.pm »
1 package DBIx::Class::ResultSetManager;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use base 'DBIx::Class';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Sub::Name ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use Class::Inspector;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 warn "DBIx::Class::ResultSetManager never left experimental status and
9 has now been DEPRECATED. This module will be deleted in 09000 so please
10 migrate any and all code using it to explicit resultset classes using either
11 __PACKAGE__->resultset_class(...) calls or by switching from using
12 DBIx::Class::Schema->load_classes() to load_namespaces() and creating
13 appropriate My::Schema::ResultSet::* classes for it to pick up.";
14  
15 =head1 NAME
16  
17 DBIx::Class::ResultSetManager - scheduled for deletion in 09000
18  
19 =head1 DESCRIPTION
20  
21 DBIx::Class::ResultSetManager never left experimental status and
22 has now been DEPRECATED. This module will be deleted in 09000 so please
23 migrate any and all code using it to explicit resultset classes using either
24 __PACKAGE__->resultset_class(...) calls or by switching from using
25 DBIx::Class::Schema->load_classes() to load_namespaces() and creating
26 appropriate My::Schema::ResultSet::* classes for it to pick up.";
27  
28 =cut
29  
30 __PACKAGE__->mk_classdata($_)
31 3 for qw/ base_resultset_class table_resultset_class_suffix /;
32 3 __PACKAGE__->base_resultset_class('DBIx::Class::ResultSet');
33 3 __PACKAGE__->table_resultset_class_suffix('::_resultset');
34  
35 1 ▶sub table {
Subroutine table: called CC=2 SCAR=7.0
Pod undocumented
36 1 my ($self,@rest) = @_;
37 1 my $ret = $self->next::method(@rest);
38 1 ▶ if (@rest) {
Branch: 1 branch
BranchTrueFalseTotal
if (@rest) 1 0 1
39 1 $self->_register_attributes;
40 1 $self->_register_resultset_class;
41 }
42 1 return $ret;
43 }
44  
45 0 ▶sub load_resultset_components {
Subroutine load_resultset_components: not called CC=1 SCAR=6.9
Pod undocumented
46 0 my ($self,@comp) = @_;
47 0 my $resultset_class = $self->_setup_resultset_class;
48 0 $resultset_class->load_components(@comp);
49 }
50  
51 1 ▶sub _register_attributes {
Subroutine _register_attributes: called CC=6 SCAR=18.0
52 1 my $self = shift;
53 1 my $cache = $self->_attr_cache;
54 1 ▶ return if keys %$cache == 0;
Branch: 1 branch
BranchTrueFalseTotal
if keys %$cache == 0 0 1 1
55  
56 1 ▶ foreach my $meth (@{Class::Inspector->methods($self) || []}) {
Condition50%1/2
'Class::Inspector'->methods($self) || []
l!l
10
MC/DC0%0/1
'Class::Inspector'->methods($self) || []
'Class::Inspector'->methods($self)
Truth table50%1/2
A
A= 'Class::Inspector'->methods($self)
Aresult
11
00
57 149 my $attrs = $cache->{$self->can($meth)};
58 149 ▶ next unless $attrs;
Branch: 1 branch
BranchTrueFalseTotal
unless $attrs 148 1 149
59 1 ▶ if ($attrs->[0] eq 'ResultSet') {
Branch: 1 branch
BranchTrueFalseTotal
if ($attrs->[0] eq "ResultSet") 1 0 1
60 3 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
61 1 my $resultset_class = $self->_setup_resultset_class;
62 1 my $name = join '::',$resultset_class, $meth;
63 1 *$name = Sub::Name::subname $name, $self->can($meth);
64 1 delete ${"${self}::"}{$meth};
65 }
66 }
67 }
68  
69 1 ▶sub _setup_resultset_class {
Subroutine _setup_resultset_class: called CC=2 SCAR=6.9
70 1 my $self = shift;
71 1 my $resultset_class = $self . $self->table_resultset_class_suffix;
72 3 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
73 1 ▶ unless (@{"$resultset_class\::ISA"}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@{"${resultset_class}::ISA";}) 1 0 1
74 1 @{"$resultset_class\::ISA"} = ($self->base_resultset_class);
75 }
76 1 return $resultset_class;
77 }
78  
79 1 ▶sub _register_resultset_class {
Subroutine _register_resultset_class: called CC=2 SCAR=7.1
80 1 my $self = shift;
81 1 my $resultset_class = $self . $self->table_resultset_class_suffix;
82 3 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
83 1 ▶ if (@{"$resultset_class\::ISA"}) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{"${resultset_class}::ISA";}) { } 1 0 1
84 1 $self->result_source_instance->resultset_class($resultset_class);
85 } else {
86 0 $self->result_source_instance->resultset_class
87 ($self->base_resultset_class);
88 }
89 }
90  
91 =head1 FURTHER QUESTIONS?
92  
93 Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
94  
95 =head1 COPYRIGHT AND LICENSE
96  
97 This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
98 by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
99 redistribute it and/or modify it under the same terms as the
100 L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.
101  
102 =cut
103  
104 3 1;
« DBIx/Class/Storage/DBI/ODBC/Firebird.pm ↑ Summary DBIx/Class/Relationship/ProxyMethods.pm »