| 1 | package OpusVL::Preferences::Hat::preferences; | ||
| 2 | |||
| 3 | 1 | ▶ | use v5.24; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | with "OpusVL::FB11::Role::Hat"; | ||
| 6 | |||
| 7 | # ABSTRACT: Allows any FB11 component to do legacy Preferences stuff | ||
| 8 | |||
| 9 | has _classes_with_preferences => ( | ||
| 10 | is => 'rw', | ||
| 11 | traits => ['Array'], | ||
| 12 | isa => 'ArrayRef', | ||
| 13 | handles => { | ||
| 14 | add_pref_class => 'push', | ||
| 15 | find_pref_class => 'first', | ||
| 16 | classes_with_preferences => 'uniq', | ||
| 17 | } | ||
| 18 | ); | ||
| 19 | |||
| 20 | 0 | ▶ | sub schema { shift->__brain } |
|
Subroutine
schema: not called CC=1 SCAR=6.9
| |||
| 21 | |||
| 22 | sub register_extension { | ||
| 23 | 0 | ▶ | my $self = shift; |
|
Subroutine
register_extension: not called CC=1 SCAR=6.9
| |||
| 24 | 0 | my %namespaces = @_; | |
| 25 | |||
| 26 | 0 | my $classes = delete $namespaces{preferences_sources}; | |
| 27 | |||
| 28 | 0 | $self->add_pref_class(@$classes); | |
| 29 | 0 | $self->schema->load_namespaces(%namespaces); | |
| 30 | } | ||
| 31 | |||
| 32 | sub class_has_preferences { | ||
| 33 | 0 | ▶ | my $self = shift; |
|
Subroutine
class_has_preferences: not called CC=1 SCAR=6.9
| |||
| 34 | 0 | my $class = shift; | |
| 35 | |||
| 36 | 0 | ▶ | return $self->find_pref_class( sub { $_ eq $class } ); |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 37 | } | ||
| 38 | |||
| 39 | 1; | ||
| 40 | |||
| 41 | __END__ | ||
| 42 | |||
| 43 | =pod | ||
| 44 | |||
| 45 | =encoding UTF-8 | ||
| 46 | |||
| 47 | =head1 NAME | ||
| 48 | |||
| 49 | OpusVL::Preferences::Hat::preferences - Allows any FB11 component to do legacy Preferences stuff | ||
| 50 | |||
| 51 | =head1 VERSION | ||
| 52 | |||
| 53 | version 0.32 | ||
| 54 | |||
| 55 | =head1 DESCRIPTION | ||
| 56 | |||
| 57 | This Hat doesn't have an interface because it is entirely specific to this | ||
| 58 | module. | ||
| 59 | |||
| 60 | Anything using this hat is already tightly coupled to the Preferences module | ||
| 61 | and deserves everything it gets. | ||
| 62 | |||
| 63 | It exists so that those components can still actualy get at this component via | ||
| 64 | the component manager - the only level of decoupling we expect to achieve. | ||
| 65 | |||
| 66 | =head2 DEPRECATED | ||
| 67 | |||
| 68 | This module was written deprecated. New code should not be using it. New code | ||
| 69 | should make the JSON-based L<OpusVL::FB11::Parameters> module work instead, and | ||
| 70 | then use that. | ||
| 71 | |||
| 72 | =head1 METHODS | ||
| 73 | |||
| 74 | =head2 schema | ||
| 75 | |||
| 76 | The Preferences schema is the brain. The dbic_schema::is_brain hat is also worn. | ||
| 77 | |||
| 78 | =head2 register_extension | ||
| 79 | |||
| 80 | Pass a hashref a la L<DBIx::Class::Schema/load_namespaces> and it will be loaded | ||
| 81 | in. | ||
| 82 | |||
| 83 | This should only be done at Catalyst time so that we don't produce migrations | ||
| 84 | for other schemata. | ||
| 85 | |||
| 86 | =head1 AUTHOR | ||
| 87 | |||
| 88 | OpusVL - www.opusvl.com | ||
| 89 | |||
| 90 | =head1 COPYRIGHT AND LICENSE | ||
| 91 | |||
| 92 | This software is copyright (c) 2011 by OpusVL - www.opusvl.com. | ||
| 93 | |||
| 94 | This is free software; you can redistribute it and/or modify it under | ||
| 95 | the same terms as the Perl 5 programming language system itself. | ||
| 96 | |||
| 97 | =cut | ||