[Dbix-class] "Alias" schema option

Brandon Black blblack at gmail.com
Wed Apr 5 17:39:40 CEST 2006


On 4/5/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
> Christopher H. Laco wrote:
> >> So, the question now becomes, what does everything think?
> >>
> >> Should we leave ->name alone, and make something new like
> >> result_source_name(), or do we forge ahead with changing the meaning of
> >> what ->name() returns?
> >>
> >> -=Chris
> >>
> >
> > The more I think about this, the more I don't like it.
> > I think adding table_name, and having from() return table_name is a good
> > thing. But I think name should just return what it always has.
> >
> > name() can mean different things to different modules, in different
> > parts of the dist.  I'd personally much rather see source_name(). That's
> > a little more clear IMHO on what it will return.
>
> Mmm, I can see that one. Plus it means the same source can exist in more than
> one schema with a different name in the scheme but the same ->name.
>
> Not sure source_name is quite right though. schema_name suggests the name of
> the schema, name_in_schema sucks. Er. Ideas, anybody?
>

This also touches on (to some degree) the whole issue of best
practices for namespace management (class names) of the various
classes related to a single table (the ResultSource, the ResultSet,
and the Result classes), ResultSetManager and the related issues of
"default" resultset_class's (::_resultset? ::ResultSet?
MySchema::ResultSet::Foo? etc) and the load_classes M::F thing (in
that it would be nice if ->load_classes() would pick up
resultset/result classes that fit the default naming convention and
stuff them in the right place).

Right now the tacit assumption (barring explicit renaming by the user)
in the common case is that the "source_name" is the same as the source
class name minus the schema class name prefix.

-- Brandon



More information about the Dbix-class mailing list