is_virtual support
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / ResultSource / View.pm
CommitLineData
1d521afd 1package DBIx::Class::ResultSource::View;
2
3use strict;
4use warnings;
5
6use DBIx::Class::ResultSet;
7
8use base qw/DBIx::Class/;
9__PACKAGE__->load_components(qw/ResultSource/);
9774f48b 10__PACKAGE__->mk_group_accessors('simple' => ' is_virtual');
1d521afd 11
1d521afd 12=head1 NAME
13
14DBIx::Class::ResultSource::Table - Table object
15
16=head1 SYNOPSIS
17
18=head1 DESCRIPTION
19
20Table object that inherits from L<DBIx::Class::ResultSource>
21
22=head1 METHODS
23
9774f48b 24=head2 is_virtual
25
26Attribute to declare a view as virtual.
27
1d521afd 28=head2 from
29
30Returns the FROM entry for the table (i.e. the view name)
9774f48b 31or the definition if this is a virtual view.
1d521afd 32
33=cut
34
9774f48b 35sub from {
36 my $self = shift;
37 return \"(${\$self->view_definition})" if $self->is_virtual;
38 return $self->name;
39}
1d521afd 40
411;
42
43=head1 AUTHORS
44
45Matt S. Trout <mst@shadowcatsystems.co.uk>
46
47With Contributions from:
48
49Guillermo Roditi E<lt>groditi@cpan.orgE<gt>
50
51=head1 LICENSE
52
53You may distribute this code under the same terms as Perl itself.
54
55=cut
56