From: Peter Rabbitson Date: Mon, 4 Oct 2010 09:50:52 +0000 (+0200) Subject: Use clearer varnames X-Git-Tag: v0.08191~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=32cff863db45d7f965a7587929a5db56dfb4ef75;p=dbsrgits%2FDBIx-Class.git Use clearer varnames --- diff --git a/lib/DBIx/Class/Relationship/ProxyMethods.pm b/lib/DBIx/Class/Relationship/ProxyMethods.pm index 9623539..5f7578a 100644 --- a/lib/DBIx/Class/Relationship/ProxyMethods.pm +++ b/lib/DBIx/Class/Relationship/ProxyMethods.pm @@ -25,18 +25,17 @@ sub proxy_to_related { no strict 'refs'; no warnings 'redefine'; foreach my $meth_name ( keys %proxy_map ) { - my $proxy_to = $proxy_map{$meth_name}; + my $proxy_to_col = $proxy_map{$meth_name}; my $name = join '::', $class, $meth_name; - *$name = Sub::Name::subname $name, - sub { - my $self = shift; - my $val = $self->$rel; - if (@_ && !defined $val) { - $val = $self->create_related($rel, { $proxy_to => $_[0] }); - @_ = (); - } - return ($val ? $val->$proxy_to(@_) : undef); - } + *$name = Sub::Name::subname $name => sub { + my $self = shift; + my $relobj = $self->$rel; + if (@_ && !defined $relobj) { + $relobj = $self->create_related($rel, { $proxy_to_col => $_[0] }); + @_ = (); + } + return ($relobj ? $relobj->$proxy_to_col(@_) : undef); + } } }