monikers
dynamic
naming
+ datetime_timezone
+ datetime_locale
/);
Add to all columns with type DATE the attribute timezone => "Europe/Berlin".
+=head2 datetime_timezone
+
+Set timezone attribute for L<DBIx::Class::InflateColumn::DateTime>
+to all columns with the type DATE.
+
+=head2 datetime_locale
+
+Set local attribute for L<DBIx::Class::InflateColumn::DateTime>
+to all columns with the type DATE.
+
=head1 METHODS
None of these methods are intended for direct invocation by regular
$self->_pod( $class,
join "\n", map {
my $s = $attrs->{$_};
- $s = !defined $s ? 'undef' :
- length($s) == 0 ? '(empty string)' :
- $s;
+ $s = !defined $s ? 'undef' :
+ length($s) == 0 ? '(empty string)' :
+ ref($s) eq 'SCALAR' ? $$s :
+ $s
+ ;
" $_: $s"
} sort keys %$attrs,
sub _is_case_sensitive { 0 }
sub _custom_column_info {
- my ( $self, $info ) = @_;
+ my ( $self, $table_name, $column_name, $column_info ) = @_;
if( ref $self->custom_column_info eq 'CODE' ) {
- return $self->custom_column_info->($info);
+ return $self->custom_column_info->( $table_name, $column_name, $column_info );
}
return {};
}
+sub _datetime_column_info {
+ my ( $self, $table_name, $column_name, $column_info ) = @_;
+ my $return = {};
+ my $type = lc ( $column_info->{data_type} );
+ if (
+ ( defined $column_info->{inflate_datetime} and $column_info->{inflate_datetime} )
+ or ( defined $column_info->{inflate_date} and $column_info->{inflate_date} )
+ or ( $type eq 'date')
+ or ( $type eq 'datetime')
+ or ( $type eq 'timestamp')
+ ){
+ $return->{timezone} = $self->datetime_timezone if $self->datetime_timezone;
+ $return->{locale} = $self->datetime_locale if $self->datetime_locale;
+ }
+ return $return;
+}
+
# remove the dump dir from @INC on destruction
sub DESTROY {
my $self = shift;