Merge 'trunk' into 'view-deps'
[dbsrgits/DBIx-Class.git] / lib / SQL / Translator / Parser / DBIx / Class.pm
index fc95801..3a5d918 100644 (file)
@@ -15,8 +15,9 @@ $DEBUG = 0 unless defined $DEBUG;
 use Exporter;
 use SQL::Translator::Utils qw(debug normalize_name);
 use Carp::Clan qw/^SQL::Translator|^DBIx::Class|^Try::Tiny/;
-use Scalar::Util ();
+use Scalar::Util 'weaken';
 use Try::Tiny;
+use namespace::clean;
 
 use base qw(Exporter);
 
@@ -34,7 +35,7 @@ use base qw(Exporter);
 sub parse {
     # this is a hack to prevent schema leaks due to a retarded SQLT implementation
     # DO NOT REMOVE (until SQLT2 is out, the all of this will be rewritten anyway)
-    Scalar::Util::weaken ($_[1]) if ref ($_[1]);
+    weaken $_[1] if ref ($_[1]);
 
     my ($tr, $data)   = @_;
     my $args          = $tr->parser_args;
@@ -64,7 +65,7 @@ sub parse {
         $dbicschema->throw_exception ("'sources' parameter must be an array or hash ref")
           unless( $ref eq 'ARRAY' || ref eq 'HASH' );
 
-        # limit monikers to those specified in 
+        # limit monikers to those specified in
         my $sources;
         if ($ref eq 'ARRAY') {
             $sources->{$_} = 1 for (@$limit_sources);
@@ -170,7 +171,7 @@ sub parse {
             # Force the order of @cond to match the order of ->add_columns
             my $idx;
             my %other_columns_idx = map {'foreign.'.$_ => ++$idx } $relsource->columns;
-            my @cond = sort { $other_columns_idx{$a} cmp $other_columns_idx{$b} } keys(%{$rel_info->{cond}}); 
+            my @cond = sort { $other_columns_idx{$a} cmp $other_columns_idx{$b} } keys(%{$rel_info->{cond}});
 
             # Get the key information, mapping off the foreign/self markers
             my @refkeys = map {/^\w+\.(\w+)$/} @cond;