From: Christopher H. Laco Date: Fri, 10 Feb 2006 00:03:18 +0000 (+0000) Subject: Nuked UUIDColumns.pm~ X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d5980fb62ef83a22fc9ef07b612c6ed84b8e2b1a;p=dbsrgits%2FDBIx-Class-Historic.git Nuked UUIDColumns.pm~ --- diff --git a/lib/DBIx/Class/UUIDColumns.pm~ b/lib/DBIx/Class/UUIDColumns.pm~ deleted file mode 100644 index 1873c90..0000000 --- a/lib/DBIx/Class/UUIDColumns.pm~ +++ /dev/null @@ -1,63 +0,0 @@ -package DBIx::Class::UUIDColumns; -use base qw/DBIx::Class/; - -use Data::UUID; - -__PACKAGE__->mk_classdata( 'uuid_auto_columns' => [] ); - -=head1 NAME - -DBIx::Class::UUIDColumns - Implicit uuid columns - -=head1 SYNOPSIS - - pacakge Artist; - __PACKAGE__->load_components(qw/UUIDColumns Core DB/); - __PACKAGE__->uuid_columns( 'artist_id' );x - -=head1 DESCRIPTION - -This L component resambles the behaviour of -L, to make some columns implicitly created as uuid. - -Note that the component needs to be loaded before Core. - -=head1 METHODS - -=head2 uuid_columns - -=cut - -# be compatible with Class::DBI::UUID -sub uuid_columns { - my $self = shift; - for (@_) { - $self->throw_exception("column $_ doesn't exist") unless $self->has_column($_); - } - $self->uuid_auto_columns(\@_); -} - -sub insert { - my $self = shift; - for my $column (@{$self->uuid_auto_columns}) { - $self->store_column( $column, $self->get_uuid ) - unless defined $self->get_column( $column ); - } - $self->next::method(@_); -} - -sub get_uuid { - return Data::UUID->new->to_string(Data::UUID->new->create), -} - -=head1 AUTHORS - -Chia-liang Kao - -=head1 LICENSE - -You may distribute this code under the same terms as Perl itself. - -=cut - -1;