[Dbix-class] RFC: DBIx::Class::Tokenize

J. Shirley jshirley at gmail.com
Thu May 1 15:05:51 BST 2008

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)

Thanks for the feedback!


More information about the DBIx-Class mailing list