[Dbix-class] Should DBIC prefix the table alias on columns in a WHERE?

Peter Rabbitson rabbit+dbic at rabbit.us
Wed May 12 16:57:36 GMT 2010


Bill Moseley wrote:
> I've discussed this on irc, and have worked around the issue I had, but
> I'm still curious.
> 
> The docs for current_source_alias seems to indicate that the alias will
> always be "me." -- or that it may be in the future.  And I'm not clear
> "alias" is a valid attribute.

Addendum:

current_source_alias is exactly this - the alias of a certain $rs object.
When will it not be 'me'? Simple:

my $artists_with_cds =
  $s->resultset('CD')->search_related ('artist', {}, { distinct => 1});

Now the alias of $artists_with_cds is not 'me' anymore. It's 'artist'.

'alias' is a valid *undocumented* (thus internal) attribute (as many many
others), and you should not be messing with it.



More information about the DBIx-Class mailing list