Skip to content

Commit

Permalink
Move the Subclassing POD under Examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ribasushi committed Jul 1, 2014
1 parent 77a6448 commit 293a924
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions lib/DBIx/Class/ResultSet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -80,33 +80,6 @@ However, if it is used in a boolean context it is B<always> true. So if
you want to check if a resultset has any results, you must use C<if $rs
!= 0>.
=head1 CUSTOM ResultSet CLASSES THAT USE Moose
If you want to make your custom ResultSet classes with L<Moose>, use a template
similar to:
package MyApp::Schema::ResultSet::User;
use Moose;
use MooseX::NonMoose;
extends 'DBIx::Class::ResultSet';
sub BUILDARGS { $_[2] }
...your code...
__PACKAGE__->meta->make_immutable;
1;
The L<MooseX::NonMoose> is necessary so that the L<Moose> constructor does not
clash with the regular ResultSet constructor. Alternatively, you can use:
__PACKAGE__->meta->make_immutable(inline_constructor => 0);
The L<BUILDARGS|Moose::Manual::Construction/BUILDARGS> is necessary because the
signature of the ResultSet C<new> is C<< ->new($source, \%args) >>.
=head1 EXAMPLES
=head2 Chaining resultsets
Expand Down Expand Up @@ -194,6 +167,33 @@ Which is the same as:
See: L</search>, L</count>, L</get_column>, L</all>, L</create>.
=head2 Custom ResultSet classes using Moose
If you want to make your custom ResultSet classes with L<Moose>, use a template
similar to:
package MyApp::Schema::ResultSet::User;
use Moose;
use MooseX::NonMoose;
extends 'DBIx::Class::ResultSet';
sub BUILDARGS { $_[2] }
...your code...
__PACKAGE__->meta->make_immutable;
1;
The L<MooseX::NonMoose> is necessary so that the L<Moose> constructor does not
clash with the regular ResultSet constructor. Alternatively, you can use:
__PACKAGE__->meta->make_immutable(inline_constructor => 0);
The L<BUILDARGS|Moose::Manual::Construction/BUILDARGS> is necessary because the
signature of the ResultSet C<new> is C<< ->new($source, \%args) >>.
=head1 METHODS
=head2 new
Expand Down

0 comments on commit 293a924

Please sign in to comment.