The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
DBIx::Class::Tokenize(3U)ser Contributed Perl DocumentatiDoBnIx::Class::Tokenize(3)



NNAAMMEE
       DBIx::Class::Tokenize - Automatically tokenize a column on creation

DDEESSCCRRIIPPTTIIOONN
       This component simply creates a clean token based on a field on inser‐
       tion.  The simple use case is having a long name that is displayable,
       like "Catalyst Book" that you want to change to "catalyst_book".
       Rather than do that by hand every time you create a record, this compo‐
       nent does it for you.

SSYYNNOOPPSSIISS
        package MyApp::Schema::Book;

        __PACKAGE__->load_components( qw(Tokenize ... Core) );
        __PACKAGE__->add_columns(
            id   => { data_type => 'integer', is_auto_increment => 1 },
            name => { data_type => 'varchar', size => 128,
               # Update the 'token' field on create
               token_field => 'token' },
            token => { data_type => 'varchar', size => 128, is_nullable => 0 }
        );

        ...

        my $row = $schema->resultset('Book')->create({ name => "Catalyst Book" });

        print $row->token; # Prints "catalyst_book

MMEETTHHOODDSS
       ttookkeenniizzee

       This method is what performs the actual conversion to the tokenized
       form.  It is easy to override so that you can change things around to
       suit your particular table.  Whatever is returned is inserted into the
       configured "token_field".

       An example of extending this method would be to traverse a tree in a
       row that uses DBIx::Class::Tree::AdjacencyList and tokenize the parents
       as well.

AAUUTTHHOORR
       J. Shirley, "<jshirley at coldhardcode.com>"

BBUUGGSS
       Please report any bugs or feature requests to "bug-catalyst-con‐
       troller-rest-dbi c-item at rt.cpan.org", or through the web interface
       at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DBIx-Class-Tok‐
       enize>.  I will be notified, and then you’ll automatically be notified
       of progress on your bug as I make changes.

SSUUPPPPOORRTT
       You can find documentation for this module with the perldoc command.

           perldoc DBIx::Class::Tokenize

       You can also look for information at:

       * RT: CPAN’s request tracker
           <http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class-Tokenize>

       * AnnoCPAN: Annotated CPAN documentation
           <http://annocpan.org/dist/DBIx-Class-Tokenize>

       * CPAN Ratings
           <http://cpanratings.perl.org/d/DBIx-Class-Tokenize>

       * Search CPAN
           <http://search.cpan.org/dist/DBIx-Class-Tokenize>

AACCKKNNOOWWLLEEDDGGEEMMEENNTTSS
       This is a Cold Hard Code, LLC module - http://www.coldhardcode.com

CCOOPPYYRRIIGGHHTT && LLIICCEENNSSEE
       Copyright 2008 Cold Hard Code, LLC, all rights reserved.

       This program is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself.



perl v5.8.8                       2008-04-30          DBIx::Class::Tokenize(3)