Writing more genering helpers.
[blog.pm-common-perl-mods.git] / Common-RDBO-Helper / lib / Common / RDBO / Helper / Std.pm
blobfbb63121b4a8f233439658f34245d6b76c4b115c
1 package Common::RDBO::Helper::Std;
3 use strict;
4 use warnings;
6 use Rose::Object::MixIn();
7 our @ISA = qw(Rose::Object::MixIn);
9 __PACKAGE__->export_tag( all => [ qw/ master / ] );
11 sub master {
12 my $self = shift;
14 if ( $self->can( 'type' ) ) {
15 my $type = $self->type;
16 return $self->$type;
17 } else {
18 my ( $rel ) =
19 grep { $_->type eq 'many to one' } $self->meta->relationships;
20 die $rel->name;
22 my $master = $rel->name;
24 return $self->$master;
28 =head1 AUTHOR
30 vti
32 =head1 LICENSE
34 This library is free software, you can redistribute it and/or modify
35 it under the same terms as Perl itself.
37 =cut