DBIx::Class::FormatColumns - Creates format accessors for you
package Artist; __PACKAGE__->load_components(qw/FormatColumns Core/); __PACKAGE__->add_columns( message => {}, date_start => { accessor => 'start_date', data_type => 'datetime' } ); __PACKAGE__->format_columns; # accessing the data print $rc->message_format_ashtml, "\n"; print $rc->date_start_format_full_datetime, "\n"; print $rc->start_date_format_long_date, "\n";
This modul creates format accessors for you. It tries to be smart and uses the data_type property of the column to know which kind of format accessors it should create.
If you did not use DBIx::Class::InflateColumns to inflate your datetime/date column, it uses DateTime::Format::DBI to convert the value to an DateTime object.
Calls DateTime->locale->full_date_format to retrieve the format string to put it into a DateTime->strftime call.
Calls DateTime->locale->long_date_format to retrieve the format string to put it into a DateTime->strftime call.
Calls DateTime->locale->medium_date_format to retrieve the format string to put it into a DateTime->strftime call.
Calls DateTime->locale->short_date_format to retrieve the format string to put it into a DateTime->strftime call.
Calls DateTime->locale->full_time_format to retrieve the format string to put it into a DateTime->strftime call.
Calls DateTime->locale->long_time_format to retrieve the format string to put it into a DateTime->strftime call.
Calls DateTime->locale->medium_time_format to retrieve the format string to put it into a DateTime->strftime call.
Calls DateTime->locale->short_time_format to retrieve the format string to put it into a DateTime->strftime call.
Calls DateTime->locale->full_datetime_format to retrieve the format string to put it into a DateTime->strftime call.
Calls DateTime->locale->long_datetime_format to retrieve the format string to put it into a DateTime->strftime call.
Calls DateTime->locale->medium_datetime_format to retrieve the format string to put it into a DateTime->strftime call.
Calls DateTime->locale->short_datetime_format to retrieve the format string to put it into a DateTime->strftime call.
Uses HTML::Entities to encode all entities. But it also replaces all linebreaks with <br / >.
Creates format accessors for every column in @columns. Uses __PACKAGE__->columns if @columns is empty;
If set to a true value, format_columns will only format columns that have a data_type configured. The default value is 0.
Sascha Kiefer <esskar@cpan.org>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
To install DBIx::Class::FormatColumns, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::Class::FormatColumns
CPAN shell
perl -MCPAN -e shell install DBIx::Class::FormatColumns
For more information on module installation, please visit the detailed CPAN module installation guide.