I wrote DBIx::Class::AsFdat.
DBIx::Class::AsFdat like Class::DBI::Plugin::AsFdat.
package DBIx::Class::AsFdat; use strict; use warnings; use base 'DBIx::Class'; use Scalar::Util qw/blessed/;
our $VERSION = 0.01;
sub as_fdat { my $self = shift;
my $fdat; for my $column ($self->result_source->columns) { $fdat->{$column} = $self->$column;
# inflate the datetime if (blessed $fdat->{$column} and $fdat->{$column}->isa('DateTime')) { for my $type (qw(year month day hour minute second)) { $fdat->{"${column}_$type"} = $fdat->{$column}->$type; } } } return $fdat; }
1;
__END__
=head1 SYNOPSIS
__PACKAGE__->load_components(qw/ AsFdat /);
my $ad = $self->model('Ad')->search(rid => $self->r->param('ad_rid'))->first; $self->fillin_form->fdat($ad->as_fdat);