- if ref $config->ok_tables eq "ARRAY";
- warn "We don't have that table ($self->{table}).\n"
- . "Available tables are: "
- . join( ",", @{ $config->{display_tables} } )
- if $self->debug
- and not $config->ok_tables->{ $self->{table} }
- and $self->{action};
- return DECLINED() unless exists $config->ok_tables->{ $self->{table} };
+ if ref $config->ok_tables eq "ARRAY";
+
+ my $table = $self->table;
+
+ warn "We don't have that table ($table).\n"
+ . "Available tables are: "
+ . join( ",", @{ $config->display_tables } )
+ if $self->debug
+ and not $config->ok_tables->{$table}
+ and $self->action; # this is probably always true
+
+ return DECLINED unless exists $config->ok_tables->{$table};
+
+ my $path_is_ok = 0;
+ if (exists $config->ok_tables->{ $self->{table} }) {
+ $path_is_ok = 1;
+ } else {
+ if ( $self->_have_default_table_view ) {
+ my $path_is_ok = $self->default_table_view($self->{path},$self->{args});
+ }
+ unless ($path_is_ok) {
+ warn "We don't have that table ($self->{table}).\n"
+ . "Available tables are: "
+ . join( ",", @{ $config->{display_tables} } )
+ if $self->debug
+ and not $config->ok_tables->{ $self->{table} }
+ and $self->{action};
+ }
+ }
+
+ return DECLINED() unless $path_is_ok;