| 1 | package Rose::DBx::Garden::Catalyst::Controller; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use base qw( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | CatalystX::CRUD::YUI::Controller | ||||||||||||||||||||||||||||
| 6 | CatalystX::CRUD::Controller::RHTMLO | ||||||||||||||||||||||||||||
| 7 | 1 | ); | |||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Data::Dump qw( dump ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use MRO::Compat; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use mro 'c3'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 1 | our $VERSION = '0.180'; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | =head1 NAME | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | Rose::DBx::Garden::Catalyst::Controller - base Controller class | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | Rose::DBx::Garden::Catalyst::Controller is a subclass of CatalystX::CRUD::Controller::RHTMLO | ||||||||||||||||||||||||||||
| 22 | with some additional/overridden methods for working with YUI and JSON. | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | =head1 METHODS | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =cut | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | =head2 autocomplete_columns | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | Should return arrayref of fields to search when | ||||||||||||||||||||||||||||
| 31 | the autocomplete() URI method is requested. | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | The default is all the unique keys | ||||||||||||||||||||||||||||
| 34 | in model_name() that are made up of a single column. | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | =cut | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 0 | ▶ | sub _get_autocomplete_columns { | ||||||||||||||||||||||||||
|
Subroutine
_get_autocomplete_columns: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 39 | 0 | my ( $self, $c ) = @_; | |||||||||||||||||||||||||||
| 40 | 0 | my $model = $c->model( $self->model_name )->name; | |||||||||||||||||||||||||||
| 41 | 0 | my @ukeys = $model->meta->unique_keys_column_names; | |||||||||||||||||||||||||||
| 42 | 0 | my @cols; | |||||||||||||||||||||||||||
| 43 | 0 | ▶ | return [] unless @ukeys; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 44 | 0 | for my $k (@ukeys) { | |||||||||||||||||||||||||||
| 45 | 0 | ▶ | if ( scalar(@$k) == 1 | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
scalar @$k == 1 and $model->meta->column($k->[0])->type =~ /char/
MC/DC0%0/2
scalar @$k == 1 and $model->meta->column($k->[0])->type =~ /char/
scalar @$k == 1
$model->meta->column($k->[0])->type =~ /char/
Truth table0%0/3
A and B
A= scalar @$k == 1B= $model->meta->column($k->[0])->type =~ /char/
| |||||||||||||||||||||||||||||
| 46 | && $model->meta->column( $k->[0] )->type =~ m/char/ ) | ||||||||||||||||||||||||||||
| 47 | { | ||||||||||||||||||||||||||||
| 48 | 0 | push( @cols, $k->[0] ); | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | 0 | $self->autocomplete_columns( \@cols ); | |||||||||||||||||||||||||||
| 52 | 0 | return $self->autocomplete_columns; | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 1 | 1; | |||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | __END__ | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | Peter Karman, C<< <karman at cpan.org> >> | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | =head1 BUGS | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | Please report any bugs or feature requests to | ||||||||||||||||||||||||||||
| 66 | C<bug-rose-dbx-garden-catalyst at rt.cpan.org>, or through the web interface at | ||||||||||||||||||||||||||||
| 67 | L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Rose-DBx-Garden-Catalyst>. | ||||||||||||||||||||||||||||
| 68 | I will be notified, and then you'll automatically be notified of progress on | ||||||||||||||||||||||||||||
| 69 | your bug as I make changes. | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | perldoc Rose::DBx::Garden::Catalyst | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | You can also look for information at: | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | =over 4 | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | L<http://annocpan.org/dist/Rose-DBx-Garden-Catalyst> | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | =item * CPAN Ratings | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | L<http://cpanratings.perl.org/d/Rose-DBx-Garden-Catalyst> | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | =item * RT: CPAN's request tracker | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Rose-DBx-Garden-Catalyst> | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | =item * Search CPAN | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | L<http://search.cpan.org/dist/Rose-DBx-Garden-Catalyst> | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | =back | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | =head1 ACKNOWLEDGEMENTS | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | The Minnesota Supercomputing Institute C<< http://www.msi.umn.edu/ >> | ||||||||||||||||||||||||||||
| 102 | sponsored the development of this software. | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | Copyright 2008 by the Regents of the University of Minnesota. | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||
| 109 | under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | =cut | ||||||||||||||||||||||||||||