Commit | Line | Data |
---|---|---|
fe5d862b | 1 | package DBIx::Class::AccessorGroup; |
2 | ||
12bbb339 | 3 | use strict; |
4 | use warnings; | |
5 | ||
73281318 | 6 | use base qw/Class::Accessor::Grouped/; |
91fe73bc | 7 | use Scalar::Util qw/weaken blessed/; |
0d374214 | 8 | use namespace::clean; |
701da8c4 | 9 | |
d009cb7d | 10 | sub mk_classdata { |
11 | shift->mk_classaccessor(@_); | |
12 | } | |
13 | ||
14 | sub mk_classaccessor { | |
15 | my $self = shift; | |
16 | $self->mk_group_accessors('inherited', $_[0]); | |
17 | $self->set_inherited(@_) if @_ > 1; | |
18 | } | |
19 | ||
0d374214 | 20 | my $successfully_loaded_components; |
db29433c | 21 | |
22 | sub get_component_class { | |
23 | my $class = $_[0]->get_inherited($_[1]); | |
0d374214 | 24 | |
91fe73bc | 25 | # It's already an object, just go for it. |
26 | return $class if blessed $class; | |
27 | ||
0d374214 | 28 | if (defined $class and ! $successfully_loaded_components->{$class} ) { |
db29433c | 29 | $_[0]->ensure_class_loaded($class); |
0d374214 | 30 | |
d009cb7d | 31 | mro::set_mro( $class, 'c3' ); |
32 | ||
0d374214 | 33 | no strict 'refs'; |
34 | $successfully_loaded_components->{$class} | |
35 | = ${"${class}::__LOADED__BY__DBIC__CAG__COMPONENT_CLASS__"} | |
36 | = do { \(my $anon = 'loaded') }; | |
37 | weaken($successfully_loaded_components->{$class}); | |
db29433c | 38 | } |
0d374214 | 39 | |
db29433c | 40 | $class; |
41 | }; | |
42 | ||
43 | sub set_component_class { | |
44 | shift->set_inherited(@_); | |
45 | } | |
46 | ||
fe0e9f67 | 47 | 1; |
48 | ||
75d07914 | 49 | =head1 NAME |
34d52be2 | 50 | |
73281318 | 51 | DBIx::Class::AccessorGroup - See Class::Accessor::Grouped |
34d52be2 | 52 | |
53 | =head1 SYNOPSIS | |
54 | ||
55 | =head1 DESCRIPTION | |
56 | ||
73281318 | 57 | This class now exists in its own right on CPAN as Class::Accessor::Grouped |
fc969005 | 58 | |
a2bd3796 | 59 | =head1 FURTHER QUESTIONS? |
34d52be2 | 60 | |
a2bd3796 | 61 | Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>. |
34d52be2 | 62 | |
a2bd3796 | 63 | =head1 COPYRIGHT AND LICENSE |
34d52be2 | 64 | |
a2bd3796 | 65 | This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE> |
66 | by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can | |
67 | redistribute it and/or modify it under the same terms as the | |
68 | L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>. | |
34d52be2 | 69 | |
70 | =cut |