Branch Coverage

blib/lib/Dancer/Plugin/SimpleCRUD.pm
Criterion Covered Total %
branch 108 240 45.0


line true false branch
15 0 0 if (not @args) { }
0 0 elsif (@args == 1) { }
0 0 elsif ($args == 2) { }
16 0 0 if not $paramname
547 0 8 unless ($dbh)
552 0 8 unless ($args{'prefix'})
553 0 8 unless ($args{'prefix'} =~ m[^/])
565 0 8 unless ($args{'db_table'})
569 0 8 if not exists $args{'deletable'} and exists $args{'deleteable'}
574 1 7 unless exists $args{'editable'}
575 7 1 unless exists $args{'addable'}
576 8 0 unless exists $args{'query_auto_focus'}
583 0 16 if /--/
592 3 5 if ($args{'editable'})
601 2 6 if ($args{'addable'})
624 0 3 if ($args{'editable'} and $args{'deletable'})
668 0 0 unless my $rows_deleted = $dbh->quick_delete($table_name, $where)
671 0 0 if ($rows_deleted)
697 0 2 unless my $id = $params->{'id'}
737 30 0 if ($provider eq 'Database')
740 0 0 if ($provider eq 'DBIC')
757 5 1 if (defined $id)
762 3 2 unless ($values_from_database)
773 0 3 if ($args->{'editable_columns'}) { }
785 0 3 if ($args->{'not_editable_columns'})
795 0 6 if $validation->{$field}
796 0 6 if ($field =~ /email/)
805 0 3 if (exists $args->{'required'}) { }
820 0 9 if (my $values_specified = $args->{'acceptable_values'}{$name}) { }
0 9 elsif (my $foreign_key = $args->{'foreign_keys'}{$name}) { }
0 9 elsif (my $values_from_db = $field->{'mysql_values'} || $field->{'mariadb_values'}) { }
824 0 0 if (ref $values_specified eq 'CODE')
851 0 3 request()->{'method'} eq 'POST' ? :
867 1 2 params()->{'id'} ? :
882 0 2 exists $args->{'default_value'}{$field} ? :
0 2 exists params()->{$field} ? :
4 2 exists $values_from_database->{$field} ? :
891 0 6 if ($constrain_values{$field})
905 0 30 if (my $val = $args->{$arg_name}{$field})
912 3 3 if ($field =~ /pass(?:wd|word)?$/i)
917 0 6 if ($field_type{$field} eq 'TEXT')
923 0 6 if (my $override_type = $args->{'input_types'}{$field})
934 0 6 if (ref $field_params{'options'} eq 'ARRAY')
935 0 0 if (ref $field_params{'options'}[0] eq 'ARRAY')
936 0 0 if (@{$field_params{'options'}[0];} == 3)
948 0 3 if (request()->{'method'} eq 'POST' and $form->submitted and $form->validate) { }
968 0 0 if (exists params('route')->{'id'}) { }
990 0 0 if ($success) { }
1031 0 14 if (ref $display_columns eq 'ARRAY')
1035 0 0 if (grep {$_ eq $col->{'COLUMN_NAME'};} @$display_columns)
1040 0 0 if (@filtered_columns)
1050 0 42 if ($args->{'labels'}{$_->{'COLUMN_NAME'}})
1055 14 28 $searchfield eq $_->{'COLUMN_NAME'} ? :
1080 14 126 $sel ? :
1099 14 0 if ($args->{'query_auto_focus'})
1123 1 13 if ($args->{'foreign_keys'})
1129 0 0 if ($seen_table->{$raw_ftable}++)
1147 0 14 if (ref $args->{'custom_columns'} eq 'HASH')
1159 3 11 unless $args->{'custom_columns'}
1161 4 7 unless (grep {$column_alias eq $_;} @select_cols)
1163 0 4 unless my $raw_column = $custom_col_spec->{'raw_column'}
1165 4 0 if ($raw_column =~ /^[\w_]+$/) { }
1186 2 12 $args->{'editable'} ? :
1192 1 13 if ($args->{'foreign_keys'})
1202 0 0 if (my $alias = $fk_alias{$col})
1214 4 10 if (length $q or $where_filter)
1222 4 0 if (length $q)
1232 4 0 if ($column_data)
1234 0 4 if ($st eq 'c' or $st eq 'nc') { }
0 4 elsif ($st eq 'b') { }
1263 0 14 if ($args->{'downloadable'})
1283 4 10 if ($args->{'sortable'})
1291 0 4 unless $valid
1295 0 4 exists params()->{'d'} && params()->{'d'} eq 'desc' ? :
1298 4 0 $order_by_direction eq 'asc' ? :
1309 0 12 if ($args->{'labels'}{$col_name}) { }
1314 4 8 if ($col_name eq $order_by_column)
1316 0 4 $direction eq 'asc' ? :
1331 4 0 if (exists $args->{'custom_columns'})
1335 2 5 unless (grep {$_ eq $custom_column_name;} @all_cols)
1342 0 0 if (exists $args->{'foreign_keys'} and exists $args->{'foreign_keys'}{$order_by_column})
1354 0 14 if ($args->{'paginate'} and $args->{'paginate'} =~ /^\d+$/)
1363 0 0 unless $page =~ /^\d+$/
1373 0 0 if ($page > 0) { }
1397 0 14 unless $sth->execute(@binds)
1401 0 0 if ($args->{'downloadable'} and params()->{'format'})
1408 3 11 unless $args->{'custom_columns'}
1425 16 0 if ($args->{'editable'} and _has_permission('edit', $args))
1433 0 16 if ($args->{'deletable'} and _has_permission('edit', $args))
1456 0 14 unless $args->{'custom_columns'}
1457 11 0 if (my $column_class = $custom_col_spec->{'column_class'})
1459 0 11 if $first_index == -1
1465 1 13 if ($args->{'addable'} and _has_permission('edit', $args))
1477 0 14 if ($args->{'deleteable'} and _has_permission('delete', $args))
1507 0 19 if ($template) { }
1521 0 0 if (params()->{'o'})
1527 0 0 if (length $q)
1532 0 0 if (params()->{'p'})
1539 0 0 if ($format eq 'tabular') { }
0 0 elsif ($format eq 'csv') { }
0 0 elsif ($format eq 'json') { }
0 0 elsif ($format eq 'xml') { }
1551 0 0 if $@
1597 0 19 unless my $sth = $dbh->column_info(undef, undef, $table_name, undef)
1606 0 19 unless @columns
1632 0 36 if (plugin_setting()->{'use_old_url_scheme'}) { }
1648 4 17 if (keys %$auth_settings) { }
1649 0 4 unless 'Dancer::ModuleLoader'->load('Dancer::Plugin::Auth::Extensible')
1659 4 0 if ($auth_settings->{'require_login'}) { }
1664 0 0 if (my $val = $auth_settings->{$keyword})
1680 0 17 if (keys %$auth_settings) { }
1681 0 0 unless 'Dancer::ModuleLoader'->load('Dancer::Plugin::Auth::Extensible')
1689 0 0 if ($auth_settings->{'require_login'})
1690 0 0 Dancer::Plugin::Auth::Extensible::logged_in_user() ? :
1693 0 0 if (my $need_role = $auth_settings->{'require_role'})
1704 4 10 defined $v ? :
1713 21 0 unless $args->{'where_filter'}
1715 0 0 if (ref $args->{'where_filter'} eq 'HASH') { }
0 0 elsif (ref $args->{'where_filter'} eq 'CODE') { }
1719 0 0 if (ref $result eq 'HASH') { }