[Dbix-class] RFC: DBIx::Class::Tokenize
Matt S Trout
dbix-class at trout.me.uk
Sat May 3 23:34:02 BST 2008
On Thu, May 01, 2008 at 07:05:51AM -0700, J. Shirley wrote:
> On Thu, May 1, 2008 at 1:41 AM, Moritz Onken <onken at houseofdesign.de> wrote:
> > Hi,
> >
> > nice component. Some thoughts:
> >
> > It seems like you do not handle an update of a row. Is this what you want?
> > I don't like the underscore :) I'd prefer "-" as delimiter. You could add a
> > config option where you can specify which character you want.
> > Two underscores in a row look not pretty nice. You could add =~ s/__/_/g to
> > remove them.
> > You could also add a test which checks whether the gernerated token is
> > already there.
> > "Catalyst Book, Volume 1" and "Catalyst-Book, Volume 1" would have the same
> > token!
> >
> > Nice anyway :)
> >
> > cheers,
> >
> > moritz
> >
> >
> Yes, it purposefully doesn't do anything on update, because the idea
> is that token is an index (sort of an alternative record location
> identifier) - the use case I have in mind is a web application or
> something, where the URL would be /books/catalyst_book_volume_1 to
> tidy things up. If the name changes, the token will not, but that
> doesn't stop you from doing it on your own.
>
> As far as the tokenize method, I suppose a config option for spaces is
> reasonable. The test for whether the generated token exists is up to
> the application and indexes on the database. I would put a unique
> constraint on the token field if that was important, and then catch
> the exception and perhaps then call an alternative tokenization method
> in the app space (since nothing really _requires_ them to be unique on
> the component level)
Search engines generally treat foo_bar as a single word and foo-bar as two,
so I agree re '-'.
Also, are we not really looking at a "create <something> automatically
before insert" component and then the tokenize behaviour being a standalone
module? I can see it being useful for other things as well.
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
More information about the DBIx-Class
mailing list