Pics common module. Using Rose::Object generic methods generator instead of raw perl...
[blog.pm-common-perl-mods.git] / Common-RDBO-Helper / lib / Common / RDBO / Helper / Comment.pm
bloba74bc7d237a607ce35abb5655478de0ecfcf848c
1 package Common::RDBO::Helper::Comment;
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 comment_count / ] );
11 use Rose::Object::MakeMethods::Generic ( scalar => [ qw/ comment_count / ] );
13 sub master {
14 my $self = shift;
16 if ( $self->can( 'type' ) ) {
17 my $type = $self->type;
18 return $self->$type;
19 } else {
20 my ( $rel ) =
21 grep { $_->type eq 'many to one' } $self->meta->relationships;
22 die $rel->name;
24 my $master = $rel->name;
26 return $self->$master;
30 =head1 AUTHOR
32 vti
34 =head1 LICENSE
36 This library is free software, you can redistribute it and/or modify
37 it under the same terms as Perl itself.
39 =cut