Author: hmbrand
Date: Sat Jun 19 01:06:11 2010
New Revision: 14175
Modified:
dbi/trunk/lib/DBD/File.pm
dbi/trunk/t/49dbd_file.t
Log:
more tidy
never use else after return
Modified: dbi/trunk/lib/DBD/File.pm
==============================================================================
--- dbi/trunk/lib/DBD/File.pm (original)
+++ dbi/trunk/lib/DBD/File.pm Sat Jun 19 01:06:11 2010
@@ -573,31 +573,29 @@
$table = [ ".", keys %{$dbh->{f_meta}} ];
$table eq "+" and
$table = [ grep { m/^[_A-Za-z0-9]+$/ } keys %{$dbh->{f_meta}} ];
- ref ($table) eq "Regexp" and
+ ref $table eq "Regexp" and
$table = [ grep { $_ =~ $table } keys %{$dbh->{f_meta}} ];
- unless (ref ($table) or ref ($attr)) {
+ ref $table || ref $attr or
return &$gstm ($dbh, $table, $attr);
- }
- else {
- ref $table or $table = [ $table ];
- ref $attr or $attr = [ $attr ];
- "ARRAY" eq ref $table or
- croak "Invalid argument for \$table - SCALAR, Regexp or ARRAY
expected but got " . ref $table;
- "ARRAY" eq ref $attr or
- croak "Invalid argument for \$attr - SCALAR or ARRAY expected but
got " . ref $attr;
-
- my %results;
- foreach my $tname (@{$table}) {
- my %tattrs;
- foreach my $aname (@{$attr}) {
- $tattrs{$aname} = &$gstm ($dbh, $tname, $aname);
- }
- $results{$tname} = \%tattrs;
- }
- return \%results;
+ ref $table or $table = [ $table ];
+ ref $attr or $attr = [ $attr ];
+ "ARRAY" eq ref $table or
+ croak "Invalid argument for \$table - SCALAR, Regexp or ARRAY expected
but got " . ref $table;
+ "ARRAY" eq ref $attr or
+ croak "Invalid argument for \$attr - SCALAR or ARRAY expected but got "
. ref $attr;
+
+ my %results;
+ foreach my $tname (@{$table}) {
+ my %tattrs;
+ foreach my $aname (@{$attr}) {
+ $tattrs{$aname} = &$gstm ($dbh, $tname, $aname);
+ }
+ $results{$tname} = \%tattrs;
}
+
+ return \%results;
} # get_file_meta
sub set_single_table_meta
Modified: dbi/trunk/t/49dbd_file.t
==============================================================================
--- dbi/trunk/t/49dbd_file.t (original)
+++ dbi/trunk/t/49dbd_file.t Sat Jun 19 01:06:11 2010
@@ -109,13 +109,13 @@
{
$tbl => {
f_dir => $dir,
- f_ext => q(.txt),
- },
- t_sbdgf_53442Gz => {
+ f_ext => ".txt",
+ },
+ t_sbdgf_53442Gz => {
f_dir => $dir,
- f_ext => q(.txt),
+ f_ext => ".txt",
+ },
},
- },
"get multiple meta data");
# Expected: ("unix", "perlio", "encoding(iso-8859-1)")