package DBIx::Class::UUIDColumns;
-use base qw/Class::Data::Inheritable/;
+use base qw/DBIx::Class/;
use Data::UUID;
=head1 METHODS
-=over 4
-
-=item uuid_columns
+=head2 uuid_columns
=cut
sub uuid_columns {
my $self = shift;
for (@_) {
- die "column $_ doesn't exist" unless exists $self->_columns->{$_};
+ $self->throw_exception("column $_ doesn't exist") unless $self->has_column($_);
}
$self->uuid_auto_columns(\@_);
}
sub insert {
- my ($self) = @_;
+ my $self = shift;
for my $column (@{$self->uuid_auto_columns}) {
- $self->$column( $self->get_uuid )
- unless defined $self->$column;
+ $self->store_column( $column, $self->get_uuid )
+ unless defined $self->get_column( $column );
}
- $self->NEXT::ACTUAL::insert;
+ $self->next::method(@_);
}
sub get_uuid {
return Data::UUID->new->to_string(Data::UUID->new->create),
}
-=back
-
=head1 AUTHORS
Chia-liang Kao <clkao@clkao.org>