X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FDBObject.pm;h=09bbbf0880b27dd11e86cf200bc4266a7f6a72d3;hb=900628605efdbced5dcfdbbab0022b204aa93e14;hp=e0ec405d2e56b516a40a6c3b7439b9a484dcf6df;hpb=c4a69b87bd3d3fdda08f05d363311a6e9d3fc0f7;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/DBObject.pm b/lib/DBIx/Class/Schema/Loader/DBObject.pm index e0ec405..09bbbf0 100644 --- a/lib/DBIx/Class/Schema/Loader/DBObject.pm +++ b/lib/DBIx/Class/Schema/Loader/DBObject.pm @@ -3,6 +3,7 @@ package DBIx::Class::Schema::Loader::DBObject; use strict; use warnings; use base 'Class::Accessor::Grouped'; +use mro 'c3'; use Carp::Clan qw/^DBIx::Class/; use Scalar::Util 'weaken'; use namespace::clean; @@ -33,7 +34,9 @@ __PACKAGE__->mk_group_accessors(simple => qw/ /); use overload - '""' => sub { $_[0]->name }; + '""' => sub { $_[0]->name }, + '@{}' => sub { $_[0]->name_parts }, + fallback => 1; =head2 new @@ -56,6 +59,18 @@ sub new { return bless $self, $class; } +=head2 clone + +Make a shallow copy of the object. + +=cut + +sub clone { + my $self = shift; + + return bless { %$self }, ref $self; +} + =head2 schema The schema (or owner) of the object. Returns nothing if L is @@ -139,14 +154,28 @@ sub dbic_name { return $self->name; } +=head2 name_parts + +Returns an arrayref of the values returned by the methods specified in +the L of +the L object. The object arrayrefifies to this value. + +=cut + +sub name_parts { + my ($self) = shift; + return [ map { $self->$_ } @{$self->loader->moniker_parts} ]; +} + + =head1 SEE ALSO L, L, L -=head1 AUTHOR +=head1 AUTHORS -See L and L. +See L. =head1 LICENSE