DBIx-Class-Candy-0.005003/0000775000175000017500000000000013132170544013320 5ustar frewfrewDBIx-Class-Candy-0.005003/lib/0000775000175000017500000000000013132170544014066 5ustar frewfrewDBIx-Class-Candy-0.005003/lib/DBIx/0000775000175000017500000000000013132170544014654 5ustar frewfrewDBIx-Class-Candy-0.005003/lib/DBIx/Class/0000775000175000017500000000000013132170544015721 5ustar frewfrewDBIx-Class-Candy-0.005003/lib/DBIx/Class/Candy/0000775000175000017500000000000013132170544016757 5ustar frewfrewDBIx-Class-Candy-0.005003/lib/DBIx/Class/Candy/ResultSet.pm0000644000175000017500000001361113132170544021247 0ustar frewfrewpackage DBIx::Class::Candy::ResultSet; $DBIx::Class::Candy::ResultSet::VERSION = '0.005003'; use strict; use warnings; use MRO::Compat; use Sub::Exporter 'build_exporter'; use Carp 'croak'; # ABSTRACT: Sugar for your resultsets sub base { return $_[1] || 'DBIx::Class::ResultSet' } sub perl_version { return $_[1] } sub experimental { $_[1] } sub import { my $self = shift; my $inheritor = caller(0); my $args = $self->parse_arguments(\@_); my $perl_version = $self->perl_version($args->{perl_version}); my $experimental = $self->experimental($args->{experimental}); my @rest = @{$args->{rest}}; $self->set_base($inheritor, $args->{base}); $inheritor->load_components(@{$args->{components}}); @_ = ($self, @rest); my $import = build_exporter({ installer => $self->installer, collectors => [ INIT => $self->gen_INIT($perl_version, $inheritor, $experimental) ], }); goto $import } sub parse_arguments { my $self = shift; my @args = @{shift @_}; my $skipnext; my $base; my @rest; my $perl_version = undef; my $components = []; my $experimental; for my $idx ( 0 .. $#args ) { my $val = $args[$idx]; next unless defined $val; if ($skipnext) { $skipnext--; next; } if ( $val eq '-base' ) { $base = $args[$idx + 1]; $skipnext = 1; } elsif ( $val eq '-perl5' ) { $perl_version = ord $args[$idx + 1]; $skipnext = 1; } elsif ( $val eq '-experimental' ) { $experimental = $args[$idx + 1]; $skipnext = 1; } elsif ( $val eq '-components' ) { $components = $args[$idx + 1]; $skipnext = 1; } else { push @rest, $val; } } return { base => $base, perl_version => $perl_version, components => $components, rest => \@rest, experimental => $experimental, }; } sub installer { my ($self) = @_; sub { Sub::Exporter::default_installer @_; } } sub set_base { my ($self, $inheritor, $base) = @_; # inlined from parent.pm for ( my @useless = $self->base($base) ) { s{::|'}{/}g; require "$_.pm"; # dies if the file is not found } { no strict 'refs'; # This is more efficient than push for the new MRO # at least until the new MRO is fixed @{"$inheritor\::ISA"} = (@{"$inheritor\::ISA"} , $self->base($base)); } } sub gen_INIT { my ($self, $perl_version, $inheritor, $experimental) = @_; sub { my $orig = $_[1]->{import_args}; $_[1]->{import_args} = []; strict->import; warnings->import; if ($perl_version) { require feature; feature->import(":5.$perl_version") } if ($experimental) { require experimental; die 'experimental arg must be an arrayref!' unless ref $experimental && ref $experimental eq 'ARRAY'; # to avoid experimental referring to the method experimental::->import(@$experimental) } mro::set_mro($inheritor, 'c3'); 1; } } 1; __END__ =pod =head1 NAME DBIx::Class::Candy::ResultSet - Sugar for your resultsets =head1 SYNOPSIS package MyApp::Schema::ResultSet::Artist; use DBIx::Class::Candy::ResultSet -components => ['Helper::ResultSet::Me']; use experimental 'signatures'; sub by_name ($self, $name) { $self->search({ $self->me . 'name' => $name }) } 1; =head1 DESCRIPTION C is an initial sugar layer in the spirit of L. Unlike the original it does not define a DSL, though I do have plans for that in the future. For now all it does is set some imports: =over =item * turns on strict and warnings =item * sets your parent class =item * sets your mro to C =back =head1 IMPORT OPTIONS See L for information on setting these schema wide. =head2 -base use DBIx::Class::Candy::ResultSet -base => 'MyApp::Schema::ResultSet'; The first thing you can do to customize your usage of C is change the parent class. Do that by using the C<-base> import option. =head2 -components use DBIx::Class::Candy::ResultSet -components => ['Helper::ResultSet::Me']; C allows you to set which components you are using at import time. =head2 -perl5 use DBIx::Class::Candy::ResultSet -perl5 => v20; I love the new features in Perl 5.20, so I felt that it would be nice to remove the boiler plate of doing C<< use feature ':5.20' >> and add it to my sugar importer. Feel free not to use this. =head1 SETTING DEFAULT IMPORT OPTIONS Eventually you will get tired of writing the following in every single one of your resultsets: use DBIx::Class::Candy::ResultSet -base => 'MyApp::Schema::ResultSet', -perl5 => v20, -experimental => ['signatures']; You can set all of these for your whole schema if you define your own C subclass as follows: package MyApp::Schema::Candy::ResultSet; use base 'DBIx::Class::Candy::ResultSet'; sub base { $_[1] || 'MyApp::Schema::ResultSEt' } sub perl_version { 20 } sub experimental { ['signatures'] } Note the C<< $_[1] || >> in C. All of these methods are passed the values passed in from the arguments to the subclass, so you can either throw them away, honor them, die on usage, or whatever. To be clear, if you define your subclass, and someone uses it as follows: use MyApp::Schema::Candy::ResultSet -base => 'MyApp::Schema::ResultSet', -perl5 => v18, -experimental => ['postderef']; Your C method will get C, your C will get C<['postderef']>, and your C will get C<18>. =head1 AUTHOR Arthur Axel "fREW" Schmidt =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2017 by Arthur Axel "fREW" Schmidt. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut DBIx-Class-Candy-0.005003/lib/DBIx/Class/Candy/Exports.pm0000644000175000017500000000375413132170544020770 0ustar frewfrewpackage DBIx::Class::Candy::Exports; $DBIx::Class::Candy::Exports::VERSION = '0.005003'; # ABSTRACT: Create sugar for your favorite ORM, DBIx::Class use strict; use warnings; our %methods; our %aliases; sub export_methods { $methods{scalar caller(0)} = $_[0] } sub export_method_aliases { $aliases{scalar caller(0)} = $_[0] } use Sub::Exporter -setup => { exports => [ qw(export_methods export_method_aliases) ], groups => { default => [ qw(export_methods export_method_aliases) ] }, }; 1; __END__ =pod =head1 NAME DBIx::Class::Candy::Exports - Create sugar for your favorite ORM, DBIx::Class =head1 SYNOPSIS package DBIx::Class::Widget; sub create_a_widget { ... } # so you don't depend on ::Candy eval { require DBIx::Class::Candy::Exports; DBIx::Class::Candy::Exports->import; export_methods ['create_a_widget']; export_method_aliases { widget => 'create_a_widget' }; } 1; The above will make it such that users of your component who use it with L will have the methods you designate exported into their namespace. =head1 DESCRIPTION The whole point of this module is to make sugar a first class citizen in the component world that dominates L. I make enough components and like this sugar idea enough that I want to be able to have both at the same time. =head1 IMPORTED SUBROUTINES =head2 export_methods export_methods [qw( foo bar baz )]; Use this subroutine to define methods that get exported as subroutines of the same name. =head2 export_method_aliases export_method_aliases { old_method_name => 'new_sub_name', }; Use this subroutine to define methods that get exported as subroutines of a different name. =head1 AUTHOR Arthur Axel "fREW" Schmidt =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2017 by Arthur Axel "fREW" Schmidt. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut DBIx-Class-Candy-0.005003/lib/DBIx/Class/Candy.pm0000644000175000017500000003626113132170544017323 0ustar frewfrewpackage DBIx::Class::Candy; $DBIx::Class::Candy::VERSION = '0.005003'; use strict; use warnings; use namespace::clean; require DBIx::Class::Candy::Exports; use MRO::Compat; use Sub::Exporter 'build_exporter'; use Carp 'croak'; # ABSTRACT: Sugar for your favorite ORM, DBIx::Class my %aliases = ( column => 'add_columns', primary_key => 'set_primary_key', unique_constraint => 'add_unique_constraint', relationship => 'add_relationship', ); my @methods = qw( resultset_class resultset_attributes remove_columns remove_column table source_name inflate_column belongs_to has_many might_have has_one many_to_many sequence ); sub base { return $_[1] || 'DBIx::Class::Core' } sub perl_version { return $_[1] } sub autotable { $_[1] } sub experimental { $_[1] } sub _extract_part { my ($self, $class) = @_; if (my ( $part ) = $class =~ /(?:::Schema)?::Result::(.+)$/) { return $part } else { croak 'unrecognized naming scheme!' } } my $decamelize = sub { my $s = shift; $s =~ s{([^a-zA-Z]?)([A-Z]*)([A-Z])([a-z]?)}{ my $fc = pos($s)==0; my ($p0,$p1,$p2,$p3) = ($1,lc$2,lc$3,$4); my $t = $p0 || $fc ? $p0 : '_'; $t .= $p3 ? $p1 ? "${p1}_$p2$p3" : "$p2$p3" : "$p1$p2"; $t; }ge; $s; }; sub gen_table { my ( $self, $class, $version ) = @_; if ($version eq 'singular') { my $part = $self->_extract_part($class); $part =~ s/:://g; return $decamelize->($part); } elsif ($version == 1) { my $part = $self->_extract_part($class); require Lingua::EN::Inflect; $part =~ s/:://g; $part = $decamelize->($part); return join q{_}, split /\s+/, Lingua::EN::Inflect::PL(join q{ }, split /_/, $part); } } sub import { my $self = shift; my $inheritor = caller(0); my $args = $self->parse_arguments(\@_); my $perl_version = $self->perl_version($args->{perl_version}); my $experimental = $self->experimental($args->{experimental}); my @rest = @{$args->{rest}}; $self->set_base($inheritor, $args->{base}); $inheritor->load_components(@{$args->{components}}); my @custom_methods; my %custom_aliases; { my @custom = $self->gen_custom_imports($inheritor); @custom_methods = @{$custom[0]}; %custom_aliases = %{$custom[1]}; } my $set_table = sub {}; if (my $v = $self->autotable($args->{autotable})) { my $table_name = $self->gen_table($inheritor, $v); my $ran = 0; $set_table = sub { $inheritor->table($table_name) unless $ran++ } } @_ = ($self, @rest); my $import = build_exporter({ exports => [ has_column => $self->gen_has_column($inheritor, $set_table), primary_column => $self->gen_primary_column($inheritor, $set_table), unique_column => $self->gen_unique_column($inheritor, $set_table), (map { $_ => $self->gen_proxy($inheritor, $set_table) } @methods, @custom_methods), (map { $_ => $self->gen_rename_proxy($inheritor, $set_table, %aliases, %custom_aliases) } keys %aliases, keys %custom_aliases), ], groups => { default => [ qw(has_column primary_column unique_column), @methods, @custom_methods, keys %aliases, keys %custom_aliases ], }, installer => $self->installer, collectors => [ INIT => $self->gen_INIT($perl_version, \%custom_aliases, \@custom_methods, $inheritor, $experimental), ], }); goto $import } sub gen_custom_imports { my ($self, $inheritor) = @_; my @methods; my %aliases; for (@{mro::get_linear_isa($inheritor)}) { if (my $a = $DBIx::Class::Candy::Exports::aliases{$_}) { %aliases = (%aliases, %$a) } if (my $m = $DBIx::Class::Candy::Exports::methods{$_}) { @methods = (@methods, @$m) } } return(\@methods, \%aliases) } sub parse_arguments { my $self = shift; my @args = @{shift @_}; my $skipnext; my $base; my @rest; my $perl_version = undef; my $components = []; my $autotable = 0; my $experimental; for my $idx ( 0 .. $#args ) { my $val = $args[$idx]; next unless defined $val; if ($skipnext) { $skipnext--; next; } if ( $val eq '-base' ) { $base = $args[$idx + 1]; $skipnext = 1; } elsif ( $val eq '-autotable' ) { $autotable = $args[$idx + 1]; $autotable = ord $autotable if length $autotable == 1; $skipnext = 1; } elsif ( $val eq '-perl5' ) { $perl_version = ord $args[$idx + 1]; $skipnext = 1; } elsif ( $val eq '-experimental' ) { $experimental = $args[$idx + 1]; $skipnext = 1; } elsif ( $val eq '-components' ) { $components = $args[$idx + 1]; $skipnext = 1; } else { push @rest, $val; } } return { autotable => $autotable, base => $base, perl_version => $perl_version, components => $components, rest => \@rest, experimental => $experimental, }; } sub gen_primary_column { my ($self, $inheritor, $set_table) = @_; sub { my $i = $inheritor; sub { my $column = shift; my $info = shift; $set_table->(); $i->add_columns($column => $info); $i->set_primary_key($i->primary_columns, $column); } } } sub gen_unique_column { my ($self, $inheritor, $set_table) = @_; sub { my $i = $inheritor; sub { my $column = shift; my $info = shift; $set_table->(); $i->add_columns($column => $info); $i->add_unique_constraint([ $column ]); } } } sub gen_has_column { my ($self, $inheritor, $set_table) = @_; sub { my $i = $inheritor; sub { my $column = shift; $set_table->(); $i->add_columns($column => { @_ }) } } } sub gen_rename_proxy { my ($self, $inheritor, $set_table, %aliases) = @_; sub { my ($class, $name) = @_; my $meth = $aliases{$name}; my $i = $inheritor; sub { $set_table->(); $i->$meth(@_) } } } sub gen_proxy { my ($self, $inheritor, $set_table) = @_; sub { my ($class, $name) = @_; my $i = $inheritor; sub { $set_table->(); $i->$name(@_) } } } sub installer { my ($self) = @_; sub { Sub::Exporter::default_installer @_; my %subs = @{ $_[1] }; namespace::clean->import( -cleanee => $_[0]{into}, keys %subs ) } } sub set_base { my ($self, $inheritor, $base) = @_; # inlined from parent.pm for ( my @useless = $self->base($base) ) { s{::|'}{/}g; require "$_.pm"; # dies if the file is not found } { no strict 'refs'; # This is more efficient than push for the new MRO # at least until the new MRO is fixed @{"$inheritor\::ISA"} = (@{"$inheritor\::ISA"} , $self->base($base)); } } sub gen_INIT { my ($self, $perl_version, $custom_aliases, $custom_methods, $inheritor, $experimental) = @_; sub { my $orig = $_[1]->{import_args}; $_[1]->{import_args} = []; %$custom_aliases = (); @$custom_methods = (); strict->import; warnings->import; if ($perl_version) { require feature; feature->import(":5.$perl_version") } if ($experimental) { require experimental; die 'experimental arg must be an arrayref!' unless ref $experimental && ref $experimental eq 'ARRAY'; # to avoid experimental referring to the method experimental::->import(@$experimental) } mro::set_mro($inheritor, 'c3'); 1; } } 1; __END__ =pod =head1 NAME DBIx::Class::Candy - Sugar for your favorite ORM, DBIx::Class =head1 SYNOPSIS package MyApp::Schema::Result::Artist; use DBIx::Class::Candy -autotable => v1; primary_column id => { data_type => 'int', is_auto_increment => 1, }; column name => { data_type => 'varchar', size => 25, is_nullable => 1, }; has_many albums => 'A::Schema::Result::Album', 'artist_id'; 1; =head1 DESCRIPTION C is a simple sugar layer for definition of L results. Note that it may later be expanded to add sugar for more C related things. By default C: =over =item * turns on strict and warnings =item * sets your parent class =item * exports a bunch of the package methods that you normally use to define your L results =item * makes a few aliases to make some of the original method names shorter or more clear =item * defines very few new subroutines that transform the arguments passed to them =back It assumes a L-like API, but you can tailor it to suit your needs. =head1 IMPORT OPTIONS See L for information on setting these schema wide. =head2 -base use DBIx::Class::Candy -base => 'MyApp::Schema::Result'; The first thing you can do to customize your usage of C is change the parent class. Do that by using the C<-base> import option. =head2 -autotable use DBIx::Class::Candy -autotable => v1; Don't waste your precious keystrokes typing C<< table 'buildings' >>, let C do that for you! See L for what the existing versions will generate for you. =head2 -components use DBIx::Class::Candy -components => ['FilterColumn']; C allows you to set which components you are using at import time so that the components can define their own sugar to export as well. See L for details on how that works. =head2 -perl5 use DBIx::Class::Candy -perl5 => v10; I love the new features in Perl 5.10 and 5.12, so I felt that it would be nice to remove the boiler plate of doing C<< use feature ':5.10' >> and add it to my sugar importer. Feel free not to use this. =head2 -experimental use DBIx::Class::Candy -experimental => ['signatures']; I would like to use signatures and postfix dereferencing in all of my C classes. This makes that goal trivial. =head1 IMPORTED SUBROUTINES Most of the imported subroutines are the same as what you get when you use the normal interface for result definition: they have the same names and take the same arguments. In general write the code the way you normally would, leaving out the C<< __PACKAGE__-> >> part. The following are methods that are exported with the same name and arguments: belongs_to has_many has_one inflate_column many_to_many might_have remove_column remove_columns resultset_attributes resultset_class sequence source_name table There are some exceptions though, which brings us to: =head1 IMPORTED ALIASES These are merely renamed versions of the functions you know and love. The idea is to make your result classes a tiny bit prettier by aliasing some methods. If you know your C API you noticed that in the L I used C instead of C and C instead of C. The old versions work, this is just nicer. A list of aliases are as follows: column => 'add_columns', primary_key => 'set_primary_key', unique_constraint => 'add_unique_constraint', relationship => 'add_relationship', =head1 SETTING DEFAULT IMPORT OPTIONS Eventually you will get tired of writing the following in every single one of your results: use DBIx::Class::Candy -base => 'MyApp::Schema::Result', -perl5 => v12, -autotable => v1, -experimental => ['signatures']; You can set all of these for your whole schema if you define your own C subclass as follows: package MyApp::Schema::Candy; use base 'DBIx::Class::Candy'; sub base { $_[1] || 'MyApp::Schema::Result' } sub perl_version { 12 } sub autotable { 1 } sub experimental { ['signatures'] } Note the C<< $_[1] || >> in C. All of these methods are passed the values passed in from the arguments to the subclass, so you can either throw them away, honor them, die on usage, or whatever. To be clear, if you define your subclass, and someone uses it as follows: use MyApp::Schema::Candy -base => 'MyApp::Schema::Result', -perl5 => v18, -autotable => v1, -experimental => ['postderef']; Your C method will get C, your C will get C<18>, your C will get C<['postderef']>, and your C will get C<1>. =head1 SECONDARY API =head2 has_column There is currently a single "transformer" for C, so that people used to the L api will feel more at home. Note that this B go into a "Candy Component" at some point. Example usage: has_column foo => ( data_type => 'varchar', size => 25, is_nullable => 1, ); =head2 primary_column Another handy little feature that allows you to define a column and set it as the primary key in a single call: primary_column id => { data_type => 'int', is_auto_increment => 1, }; If your table has multiple columns in its primary key, merely call this method for each column: primary_column person_id => { data_type => 'int' }; primary_column friend_id => { data_type => 'int' }; =head2 unique_column This allows you to define a column and set it as unique in a single call: unique_column name => { data_type => 'varchar', size => 30, }; =head1 AUTOTABLE VERSIONS Currently there are two versions: =head2 C It looks at your class name, grabs everything after C<::Schema::Result::> (or C<::Result::>), removes the C<::>'s, converts it to underscores instead of camel-case, and pluralizes it. Here are some examples if that's not clear: MyApp::Schema::Result::Cat -> cats MyApp::Schema::Result::Software::Building -> software_buildings MyApp::Schema::Result::LonelyPerson -> lonely_people MyApp::DB::Result::FriendlyPerson -> friendly_people MyApp::DB::Result::Dog -> dogs =head2 C<'singular'> It looks at your class name, grabs everything after C<::Schema::Result::> (or C<::Result::>), removes the C<::>'s and converts it to underscores instead of camel-case. Here are some examples if that's not clear: MyApp::Schema::Result::Cat -> cat MyApp::Schema::Result::Software::Building -> software_building MyApp::Schema::Result::LonelyPerson -> lonely_person MyApp::DB::Result::FriendlyPerson -> friendly_person MyApp::DB::Result::Dog -> dog Also, if you just want to be different, you can easily set up your own naming scheme. Just add a C method to your candy subclass. The method gets passed the class name and the autotable version, which of course you may ignore. For example, one might just do the following: sub gen_table { my ($self, $class) = @_; $class =~ s/::/_/g; lc $class; } Which would transform C into C. Or maybe instead of using the standard C namespace you decided to be different and do C or something silly like that. You could pre-process your class name so that the default C will still work: sub gen_table { my $self = shift; my $class = $_[0]; $class =~ s/::DB::Table::/::Schema::Result::/; return $self->next::method(@_); } =head1 AUTHOR Arthur Axel "fREW" Schmidt =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2017 by Arthur Axel "fREW" Schmidt. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut DBIx-Class-Candy-0.005003/Makefile.PL0000644000175000017500000000256313132170544015276 0ustar frewfrew# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.009. use strict; use warnings; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Sugar for your favorite ORM, DBIx::Class", "AUTHOR" => "Arthur Axel \"fREW\" Schmidt ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "DBIx-Class-Candy", "LICENSE" => "perl", "NAME" => "DBIx::Class::Candy", "PREREQ_PM" => { "DBIx::Class" => "0.08123", "Lingua::EN::Inflect" => 0, "MRO::Compat" => "0.11", "Sub::Exporter" => "0.982", "namespace::clean" => "0.18" }, "TEST_REQUIRES" => { "Test::Deep" => 0, "Test::Fatal" => 0, "Test::More" => "0.94" }, "VERSION" => "0.005003", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "DBIx::Class" => "0.08123", "Lingua::EN::Inflect" => 0, "MRO::Compat" => "0.11", "Sub::Exporter" => "0.982", "Test::Deep" => 0, "Test::Fatal" => 0, "Test::More" => "0.94", "namespace::clean" => "0.18" ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); DBIx-Class-Candy-0.005003/t/0000775000175000017500000000000013132170544013563 5ustar frewfrewDBIx-Class-Candy-0.005003/t/release-changes_has_content.t0000644000175000017500000000222213132170544021357 0ustar frewfrew#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { print qq{1..0 # SKIP these tests are for release candidate testing\n}; exit } } use Test::More tests => 2; note 'Checking Changes'; my $changes_file = 'Changes'; my $newver = '0.005003'; my $trial_token = '-TRIAL'; SKIP: { ok(-e $changes_file, "$changes_file file exists") or skip 'Changes is missing', 1; ok(_get_changes($newver), "$changes_file has content for $newver"); } done_testing; # _get_changes copied and adapted from Dist::Zilla::Plugin::Git::Commit # by Jerome Quelin sub _get_changes { my $newver = shift; # parse changelog to find commit message open(my $fh, '<', $changes_file) or die "cannot open $changes_file: $!"; my $changelog = join('', <$fh>); close $fh; my @content = grep { /^$newver(?:$trial_token)?(?:\s+|$)/ ... /^\S/ } # from newver to un-indented split /\n/, $changelog; shift @content; # drop the version line # drop unindented last line and trailing blank lines pop @content while ( @content && $content[-1] =~ /^(?:\S|\s*$)/ ); # return number of non-blank lines return scalar @content; } DBIx-Class-Candy-0.005003/t/lib2/0000775000175000017500000000000013132170544014413 5ustar frewfrewDBIx-Class-Candy-0.005003/t/lib2/IRC/0000775000175000017500000000000013132170544015030 5ustar frewfrewDBIx-Class-Candy-0.005003/t/lib2/IRC/Schema/0000775000175000017500000000000013132170544016230 5ustar frewfrewDBIx-Class-Candy-0.005003/t/lib2/IRC/Schema/Result/0000775000175000017500000000000013132170544017506 5ustar frewfrewDBIx-Class-Candy-0.005003/t/lib2/IRC/Schema/Result/Foo.pm0000644000175000017500000000121013132170544020557 0ustar frewfrewpackage IRC::Schema::Result::Message; use IRC::Schema::Candy -base => 'DBIx::Class::Core'; table 'Messages'; primary_column id => { data_type => 'int', is_auto_increment => 1, }; column user_id => { data_type => 'int', }; column mode_id => { data_type => 'int', }; column channel_id => { data_type => 'int', }; column value => { data_type => 'varchar', size => 100, }; column when_said => { data_type => 'datetime', }; belongs_to user => 'IRC::Schema::Result::User', 'user_id'; belongs_to mode => 'IRC::Schema::Result::Mode', 'mode_id'; belongs_to channel => 'IRC::Schema::Result::Channel', 'channel_id'; 1; DBIx-Class-Candy-0.005003/t/lib2/IRC/Schema/Result/Bar.pm0000644000175000017500000000052213132170544020545 0ustar frewfrewpackage IRC::Schema::Result::User; use DBIx::Class::Candy -autotable => v1, -base => 'IRC::Schema::Result'; column id => { data_type => 'int', is_auto_increment => 1, }; unique_column handle => { data_type => 'varchar', size => 30, }; primary_key 'id'; has_many messages => 'IRC::Schema::Result::Message', 'user_id'; 1; DBIx-Class-Candy-0.005003/t/author-pod-syntax.t0000644000175000017500000000045413132170544017357 0ustar frewfrew#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { print qq{1..0 # SKIP these tests are for testing by the author\n}; exit } } # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); DBIx-Class-Candy-0.005003/t/lib/0000775000175000017500000000000013132170544014331 5ustar frewfrewDBIx-Class-Candy-0.005003/t/lib/IRC/0000775000175000017500000000000013132170544014746 5ustar frewfrewDBIx-Class-Candy-0.005003/t/lib/IRC/Schema/0000775000175000017500000000000013132170544016146 5ustar frewfrewDBIx-Class-Candy-0.005003/t/lib/IRC/Schema/ResultSet/0000775000175000017500000000000013132170544020100 5ustar frewfrewDBIx-Class-Candy-0.005003/t/lib/IRC/Schema/ResultSet/Channel.pm0000644000175000017500000000021413132170544022001 0ustar frewfrewpackage IRC::Schema::ResultSet::Channel; use IRC::Schema::CandyRS; sub test_experimental { eval <<'EVAL' sub ($a) { $a + 1} EVAL } 1; DBIx-Class-Candy-0.005003/t/lib/IRC/Schema/ResultSet/User.pm0000644000175000017500000000016313132170544021352 0ustar frewfrewpackage IRC::Schema::ResultSet::User; use DBIx::Class::Candy::ResultSet -base => 'IRC::Schema::ResultSet'; 1; DBIx-Class-Candy-0.005003/t/lib/IRC/Schema/Result/0000775000175000017500000000000013132170544017424 5ustar frewfrewDBIx-Class-Candy-0.005003/t/lib/IRC/Schema/Result/Network.pm0000644000175000017500000000037013132170544021411 0ustar frewfrewpackage IRC::Schema::Result::Network; use IRC::Schema::Result; primary_column id => { data_type => 'int', is_auto_increment => 1, }; column name => { data_type => 'varchar', size => 100, }; unique_constraint [qw( name )]; 1; DBIx-Class-Candy-0.005003/t/lib/IRC/Schema/Result/Channel.pm0000644000175000017500000000111713132170544021330 0ustar frewfrewpackage IRC::Schema::Result::Channel; use IRC::Schema::Candy; primary_column id => { data_type => 'int', is_auto_increment => 1, }; column name => { data_type => 'varchar', size => 100, }; column network_id => { data_type => 'int', }; belongs_to network => 'IRC::Schema::Result::Network', 'network_id'; unique_constraint [qw( name )]; sub test_perl_version { eval <<'EVAL' no if $] > 5.017010, warnings => 'experimental::smartmatch'; given (1) { when (1) { return 'station' } } EVAL } sub test_experimental { eval <<'EVAL' sub ($a) { $a + 1} EVAL } 1; DBIx-Class-Candy-0.005003/t/lib/IRC/Schema/Result/Message.pm0000644000175000017500000000121013132170544021336 0ustar frewfrewpackage IRC::Schema::Result::Message; use IRC::Schema::Candy -base => 'DBIx::Class::Core'; table 'Messages'; primary_column id => { data_type => 'int', is_auto_increment => 1, }; column user_id => { data_type => 'int', }; column mode_id => { data_type => 'int', }; column channel_id => { data_type => 'int', }; column value => { data_type => 'varchar', size => 100, }; column when_said => { data_type => 'datetime', }; belongs_to user => 'IRC::Schema::Result::User', 'user_id'; belongs_to mode => 'IRC::Schema::Result::Mode', 'mode_id'; belongs_to channel => 'IRC::Schema::Result::Channel', 'channel_id'; 1; DBIx-Class-Candy-0.005003/t/lib/IRC/Schema/Result/Mode.pm0000644000175000017500000000045113132170544020644 0ustar frewfrewpackage IRC::Schema::Result::Mode; use IRC::Schema::Candy; primary_column id => { data_type => 'int', is_auto_increment => 1, }; unique_column name => { data_type => 'varchar', size => 30, }; unique_column code => { data_type => 'char', size => '1', }; 1; DBIx-Class-Candy-0.005003/t/lib/IRC/Schema/Result/User.pm0000644000175000017500000000052213132170544020675 0ustar frewfrewpackage IRC::Schema::Result::User; use DBIx::Class::Candy -autotable => v1, -base => 'IRC::Schema::Result'; column id => { data_type => 'int', is_auto_increment => 1, }; unique_column handle => { data_type => 'varchar', size => 30, }; primary_key 'id'; has_many messages => 'IRC::Schema::Result::Message', 'user_id'; 1; DBIx-Class-Candy-0.005003/t/lib/IRC/Schema/ResultSet.pm0000644000175000017500000000014313132170544020432 0ustar frewfrewpackage IRC::Schema::ResultSet; use strict; use warnings; use base 'DBIx::Class::ResultSet'; 1; DBIx-Class-Candy-0.005003/t/lib/IRC/Schema/CandyRS.pm0000644000175000017500000000033613132170544020007 0ustar frewfrewpackage IRC::Schema::CandyRS; use base 'DBIx::Class::Candy::ResultSet'; sub base { 'IRC::Schema::ResultSet' } sub perl_version { return 10 if $] >= 5.010 } sub experimental { return ['signatures'] if $] >= 5.020 } 1; DBIx-Class-Candy-0.005003/t/lib/IRC/Schema/Result.pm0000644000175000017500000000052713132170544017764 0ustar frewfrewpackage IRC::Schema::Result; use strict; use warnings; use base 'DBIx::Class::Core'; __PACKAGE__->load_components('Candy'); sub base() { $_[1] || 'IRC::Schema::Result' } sub perl_version() { return 10 if $] >= 5.010 } sub autotable() { 1 } sub gen_table { my $self = shift; my $ret = $self->next::method(@_); ucfirst $ret } 1; DBIx-Class-Candy-0.005003/t/lib/IRC/Schema/Candy.pm0000644000175000017500000000052113132170544017536 0ustar frewfrewpackage IRC::Schema::Candy; use base 'DBIx::Class::Candy'; sub base() { $_[1] || 'IRC::Schema::Result' } sub perl_version() { return 10 if $] >= 5.010 } sub experimental() { return ['signatures'] if $] >= 5.020 } sub autotable() { 1 } sub gen_table { my $self = shift; my $ret = $self->next::method(@_); ucfirst $ret } 1; DBIx-Class-Candy-0.005003/t/lib/IRC/Schema.pm0000644000175000017500000000024213132170544016500 0ustar frewfrewpackage IRC::Schema; use strict; use warnings; use base 'DBIx::Class::Schema'; __PACKAGE__->load_namespaces( default_resultset_class => 'ResultSet', ); 1; DBIx-Class-Candy-0.005003/t/lib/A/0000775000175000017500000000000013132170544014511 5ustar frewfrewDBIx-Class-Candy-0.005003/t/lib/A/Schema/0000775000175000017500000000000013132170544015711 5ustar frewfrewDBIx-Class-Candy-0.005003/t/lib/A/Schema/Result/0000775000175000017500000000000013132170544017167 5ustar frewfrewDBIx-Class-Candy-0.005003/t/lib/A/Schema/Result/Statistic.pm0000644000175000017500000000042613132170544021474 0ustar frewfrewpackage A::Schema::Result::Statistic; use DBIx::Class::Candy -base => 'A::Schema::Result'; table 'statistics'; primary_column song_id => { data_type => 'int' }; primary_column playtime => { data_type => 'int' }; belongs_to song => 'A::Schema::Result::Song', 'song_id'; 1; DBIx-Class-Candy-0.005003/t/lib/A/Schema/Result/Artist.pm0000644000175000017500000000046313132170544020774 0ustar frewfrewpackage A::Schema::Result::Artist; use A::Schema::Candy; table 'artists'; primary_column id => { data_type => 'int', is_auto_increment => 1, }; has_column name => ( data_type => 'varchar', size => 25, is_nullable => 1, ); has_many albums => 'A::Schema::Result::Album', 'artist_id'; 1; DBIx-Class-Candy-0.005003/t/lib/A/Schema/Result/Album.pm0000644000175000017500000000102313132170544020557 0ustar frewfrewpackage A::Schema::Result::Album; use DBIx::Class::Candy -base => 'A::Schema::Result'; table 'albums'; primary_column id => { data_type => 'int', is_auto_increment => 1, is_numeric => 1, }; has_column name => ( data_type => 'varchar', size => 25, is_nullable => 1, ); column artist_id => { data_type => 'int', is_nullable => 0, }; has_many songs => 'A::Schema::Result::Song', 'album_id'; sub test_strict { require Test::More; eval '$foo = 1'; Test::More::ok($@, 'strict mode is on'); } 1; DBIx-Class-Candy-0.005003/t/lib/A/Schema/Result/Song.pm0000644000175000017500000000063213132170544020432 0ustar frewfrewpackage A::Schema::Result::Song; use DBIx::Class::Candy -base => 'A::Schema::Result'; table 'songs'; column id => { data_type => 'int', is_auto_increment => 1, }; column name => { data_type => 'varchar', size => 25, is_nullable => 1, }; column album_id => { data_type => 'int', is_nullable => 0, }; primary_key 'id'; belongs_to album => 'A::Schema::Result::Album', 'album_id'; 1; DBIx-Class-Candy-0.005003/t/lib/A/Schema/Result.pm0000644000175000017500000000007613132170544017526 0ustar frewfrewpackage A::Schema::Result; use base 'DBIx::Class::Core'; 1; DBIx-Class-Candy-0.005003/t/lib/A/Schema/Candy.pm0000644000175000017500000000014013132170544017276 0ustar frewfrewpackage A::Schema::Candy; use base 'DBIx::Class::Candy'; sub base { 'A::Schema::Result' } 1; DBIx-Class-Candy-0.005003/t/lib/A/Component.pm0000644000175000017500000000016113132170544017005 0ustar frewfrewpackage A::Result; use DBIx::Class::Candy::Exports; sub giant_robot { 1 } export_methods ['giant_robot']; 1; DBIx-Class-Candy-0.005003/t/lib/A/Schema.pm0000644000175000017500000000013113132170544016240 0ustar frewfrewpackage A::Schema; use base 'DBIx::Class::Schema'; __PACKAGE__->load_namespaces(); 1; DBIx-Class-Candy-0.005003/t/recursion-bug.t0000644000175000017500000000066113132170544016535 0ustar frewfrewuse strict; use warnings; use Test::More; use Try::Tiny; use lib 't/lib', 't/lib2'; $SIG{__WARN__} = sub { die @_ if $_[0] =~ /Deep recursion/; warn @_; }; try { require IRC::Schema::Result::User; require IRC::Schema::Result::Message; require IRC::Schema::Result::Foo; require IRC::Schema::Result::Bar; } catch { ok($_ !~ m/Deep recursion/, q(didn't deeply recurse)) }; pass('did not crater perl'); done_testing; DBIx-Class-Candy-0.005003/t/irc-schema.t0000644000175000017500000001275013132170544015766 0ustar frewfrewuse strict; use warnings; use Test::More; use Test::Deep; use lib 't/lib'; use IRC::Schema; subtest Channel => sub { # {{{ my $result_class = IRC::Schema->resultset('Channel')->result_class; isa_ok $result_class, 'IRC::Schema::Result'; cmp_set [$result_class->columns], [qw(id name network_id)], 'columns get set correctly'; cmp_deeply $result_class->column_info('name'), { data_type => 'varchar', size => 100, }, 'name metadata set'; cmp_deeply $result_class->column_info('id'), { data_type => 'int', is_auto_increment => 1, }, 'id metadata set'; cmp_deeply $result_class->column_info('network_id'), { data_type => 'int', }, 'network_id metadata set'; ok $result_class->has_relationship('network'), 'network relationship works'; cmp_deeply([$result_class->primary_columns], [ 'id' ], 'id gets set to pk'); cmp_deeply({ $result_class->unique_constraints }, { Channels_name => [ 'name' ], primary => [ 'id' ], }, 'unqiue constraints get set correctly'); is( $result_class->table, 'Channels', 'table gets set correctly'); is( $result_class->test_perl_version, 'station', 'perl version gets set from base class') if $] >= 5.010; is( $result_class->test_experimental->(1), 2, 'experimental gets set from base class') if $] >= 5.020; is( IRC::Schema->resultset('Channel')->test_experimental->(2), 3, 'experimental gets set from base class of rs') if $] >= 5.020; }; # }}} subtest Message => sub { # {{{ my $result_class = IRC::Schema->resultset('Message')->result_class; isa_ok $result_class, 'DBIx::Class::Core'; ok(!$result_class->isa('IRC::Schema::Result'), 'Not a ::Result'); cmp_set [$result_class->columns], [qw(id user_id mode_id channel_id value when_said)], 'columns get set correctly'; cmp_deeply $result_class->column_info('id'), { data_type => 'int', is_auto_increment => 1, }, 'id metadata set'; cmp_deeply $result_class->column_info('user_id'), { data_type => 'int', }, 'user_id metadata set'; cmp_deeply $result_class->column_info('mode_id'), { data_type => 'int', }, 'mode_id metadata set'; cmp_deeply $result_class->column_info('channel_id'), { data_type => 'int', }, 'channel_id metadata set'; cmp_deeply $result_class->column_info('value'), { data_type => 'varchar', size => 100, }, 'value metadata set'; cmp_deeply $result_class->column_info('when_said'), { data_type => 'datetime', }, 'when_said metadata set'; ok $result_class->has_relationship('user'), 'user relationship works'; ok $result_class->has_relationship('channel'), 'channel relationship works'; ok $result_class->has_relationship('mode'), 'mode relationship works'; cmp_deeply([$result_class->primary_columns], [ 'id' ], 'id gets set to pk'); is( $result_class->table, 'Messages', 'table gets set correctly'); }; # }}} subtest Mode => sub { # {{{ my $result_class = IRC::Schema->resultset('Mode')->result_class; isa_ok $result_class, 'IRC::Schema::Result'; cmp_set [$result_class->columns], [qw(id name code)], 'columns get set correctly'; cmp_deeply $result_class->column_info('id'), { data_type => 'int', is_auto_increment => 1, }, 'id metadata set'; cmp_deeply $result_class->column_info('name'), { data_type => 'varchar', size => 30, }, 'name metadata set'; cmp_deeply $result_class->column_info('code'), { data_type => 'char', size => 1, }, 'code metadata set'; cmp_deeply([$result_class->primary_columns], [ 'id' ], 'id gets set to pk'); cmp_deeply({ $result_class->unique_constraints }, { Modes_name => [ 'name' ], Modes_code => [ 'code' ], primary => [ 'id' ], }, 'unqiue constraints get set correctly'); is( $result_class->table, 'Modes', 'table gets set correctly'); }; # }}} subtest Network => sub { # {{{ my $result_class = IRC::Schema->resultset('Network')->result_class; isa_ok $result_class, 'IRC::Schema::Result'; cmp_set [$result_class->columns], [qw(id name)], 'columns get set correctly'; cmp_deeply $result_class->column_info('id'), { data_type => 'int', is_auto_increment => 1, }, 'id metadata set'; cmp_deeply $result_class->column_info('name'), { data_type => 'varchar', size => 100, }, 'name metadata set'; cmp_deeply([$result_class->primary_columns], [ 'id' ], 'id gets set to pk'); cmp_deeply({ $result_class->unique_constraints }, { Networks_name => [ 'name' ], primary => [ 'id' ], }, 'unqiue constraints get set correctly'); is( $result_class->table, 'Networks', 'table gets set correctly'); }; # }}} subtest User => sub { # {{{ my $result_class = IRC::Schema->resultset('User')->result_class; isa_ok $result_class, 'IRC::Schema::Result'; cmp_set [$result_class->columns], [qw(id handle)], 'columns get set correctly'; cmp_deeply $result_class->column_info('id'), { data_type => 'int', is_auto_increment => 1, }, 'id metadata set'; cmp_deeply $result_class->column_info('handle'), { data_type => 'varchar', size => 30, }, 'handle metadata set'; ok $result_class->has_relationship('messages'), 'messages relationship works'; cmp_deeply([$result_class->primary_columns], [ 'id' ], 'id gets set to pk'); cmp_deeply({ $result_class->unique_constraints }, { users_handle => [ 'handle' ], primary => [ 'id' ], }, 'unqiue constraints get set correctly'); is( $result_class->table, 'users', 'table gets set correctly'); }; # }}} done_testing; # vim: foldmethod=marker DBIx-Class-Candy-0.005003/t/rs-imports.t0000644000175000017500000000051713132170544016070 0ustar frewfrewuse strict; use warnings; use Test::More; use MRO::Compat; use lib 't/lib'; use IRC::Schema; is(mro::get_mro('IRC::Schema::ResultSet::User'), 'c3', 'mro'); ok(IRC::Schema::ResultSet::User->isa('IRC::Schema::ResultSet'), 'base'); ok(IRC::Schema::ResultSet::Channel->isa('IRC::Schema::ResultSet'), 'base defaulted'); done_testing; DBIx-Class-Candy-0.005003/t/autotable.t0000644000175000017500000000201113132170544015720 0ustar frewfrewuse strict; use warnings; use Test::More; use Test::Fatal; use lib 't/lib'; require DBIx::Class::Candy; subtest v1 => sub { # {{{ is( DBIx::Class::Candy->gen_table('MyApp::Schema::Result::Cat', 1), 'cats', 'simple name' ); is( DBIx::Class::Candy->gen_table('MyApp::Schema::Result::Traffic::Ticket', 1), 'traffic_tickets', 'name with ::' ); is( DBIx::Class::Candy->gen_table('MyApp::DB::Result::Dog', 1), 'dogs', 'simple no ::Schema' ); like( exception { DBIx::Class::Candy->gen_table('MyApp::DB::Pal', 1) }, qr(^unrecognized naming scheme! at .*?t[\\/]autotable\.t), 'unknown naming scheme' ); }; subtest singular => sub { is( DBIx::Class::Candy->gen_table('MyApp::Schema::Result::Cat', 'singular'), 'cat', 'simple name' ); is( DBIx::Class::Candy->gen_table('MyApp::Schema::Result::Traffic::Ticket', 'singular'), 'traffic_ticket', 'name with ::' ); }; done_testing; DBIx-Class-Candy-0.005003/t/imports.t0000644000175000017500000000147413132170544015451 0ustar frewfrewuse strict; use warnings; use Test::More; use MRO::Compat; use lib 't/lib'; use A::Schema; use A::Schema::Result::Album; use A::Schema::Result::Statistic; my $result_class = A::Schema->resultset('Album')->result_class; isa_ok $result_class, 'DBIx::Class::Core'; is(mro::get_mro($result_class), 'c3', 'mro'); is( $result_class->table, 'albums', 'table set correctly' ); my @cols = $result_class->columns; is( $cols[0], 'id', 'id column set correctly' ); is( $cols[1], 'name', 'name column set correctly' ); A::Schema::Result::Album::test_strict; ok( !$result_class->can('column'), 'namespace gets cleaned'); my $artist_result = A::Schema->resultset('Artist')->result_class; isa_ok( $artist_result, 'A::Schema::Result'); is_deeply( [ A::Schema->source('Statistic')->primary_columns ], [qw(song_id playtime)]); done_testing; DBIx-Class-Candy-0.005003/weaver.ini0000644000175000017500000000024213132170544015306 0ustar frewfrew[@CorePrep] [Name] [Region / prelude] [Generic / SYNOPSIS] [Generic / DESCRIPTION] [Generic / OVERVIEW] [Leftovers] [Region / postlude] [Authors] [Legal] DBIx-Class-Candy-0.005003/META.json0000644000175000017500000000306213132170544014740 0ustar frewfrew{ "abstract" : "Sugar for your favorite ORM, DBIx::Class", "author" : [ "Arthur Axel \"fREW\" Schmidt " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.009, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "DBIx-Class-Candy", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "develop" : { "requires" : { "Test::Pod" : "1.41" } }, "runtime" : { "requires" : { "DBIx::Class" : "0.08123", "Lingua::EN::Inflect" : "0", "MRO::Compat" : "0.11", "Sub::Exporter" : "0.982", "namespace::clean" : "0.18" } }, "test" : { "requires" : { "Test::Deep" : "0", "Test::Fatal" : "0", "Test::More" : "0.94" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/frioux/DBIx-Class-Candy/issues" }, "homepage" : "https://github.com/frioux/DBIx-Class-Candy", "repository" : { "type" : "git", "url" : "https://github.com/frioux/DBIx-Class-Candy.git", "web" : "https://github.com/frioux/DBIx-Class-Candy" } }, "version" : "0.005003", "x_serialization_backend" : "Cpanel::JSON::XS version 3.0233" } DBIx-Class-Candy-0.005003/MANIFEST0000644000175000017500000000202413132170544014445 0ustar frewfrew# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.009. Changes LICENSE MANIFEST META.json META.yml Makefile.PL README cpanfile dist.ini lib/DBIx/Class/Candy.pm lib/DBIx/Class/Candy/Exports.pm lib/DBIx/Class/Candy/ResultSet.pm t/author-pod-syntax.t t/autotable.t t/imports.t t/irc-schema.t t/lib/A/Component.pm t/lib/A/Schema.pm t/lib/A/Schema/Candy.pm t/lib/A/Schema/Result.pm t/lib/A/Schema/Result/Album.pm t/lib/A/Schema/Result/Artist.pm t/lib/A/Schema/Result/Song.pm t/lib/A/Schema/Result/Statistic.pm t/lib/IRC/Schema.pm t/lib/IRC/Schema/Candy.pm t/lib/IRC/Schema/CandyRS.pm t/lib/IRC/Schema/Result.pm t/lib/IRC/Schema/Result/Channel.pm t/lib/IRC/Schema/Result/Message.pm t/lib/IRC/Schema/Result/Mode.pm t/lib/IRC/Schema/Result/Network.pm t/lib/IRC/Schema/Result/User.pm t/lib/IRC/Schema/ResultSet.pm t/lib/IRC/Schema/ResultSet/Channel.pm t/lib/IRC/Schema/ResultSet/User.pm t/lib2/IRC/Schema/Result/Bar.pm t/lib2/IRC/Schema/Result/Foo.pm t/recursion-bug.t t/release-changes_has_content.t t/rs-imports.t weaver.ini DBIx-Class-Candy-0.005003/META.yml0000644000175000017500000000154513132170544014574 0ustar frewfrew--- abstract: 'Sugar for your favorite ORM, DBIx::Class' author: - 'Arthur Axel "fREW" Schmidt ' build_requires: Test::Deep: '0' Test::Fatal: '0' Test::More: '0.94' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.009, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: DBIx-Class-Candy requires: DBIx::Class: '0.08123' Lingua::EN::Inflect: '0' MRO::Compat: '0.11' Sub::Exporter: '0.982' namespace::clean: '0.18' resources: bugtracker: https://github.com/frioux/DBIx-Class-Candy/issues homepage: https://github.com/frioux/DBIx-Class-Candy repository: https://github.com/frioux/DBIx-Class-Candy.git version: '0.005003' x_serialization_backend: 'YAML::Tiny version 1.70' DBIx-Class-Candy-0.005003/dist.ini0000644000175000017500000000063613132170544014767 0ustar frewfrewname = DBIx-Class-Candy author = Arthur Axel "fREW" Schmidt license = Perl_5 copyright_holder = Arthur Axel "fREW" Schmidt version = 0.005003 [NextRelease] [@Git] [@Filter] -bundle = @Basic -remove = Readme [GithubMeta] issues = 1 [MetaJSON] [PodWeaver] [PkgVersion] [Pod2Readme] [PodSyntaxTests] [Prereqs::FromCPANfile] [Test::ChangesHasContent] DBIx-Class-Candy-0.005003/cpanfile0000644000175000017500000000050413132170544015021 0ustar frewfrewrequires 'DBIx::Class' => 0.08123; requires 'Sub::Exporter' => 0.982; requires 'namespace::clean' => 0.18; requires 'MRO::Compat' => 0.11; requires 'Lingua::EN::Inflect' => 0; on test => sub { requires 'Test::More' => 0.94; requires 'Test::Fatal' => 0; requires 'Test::Deep' => 0; }; DBIx-Class-Candy-0.005003/LICENSE0000644000175000017500000004372713132170544014340 0ustar frewfrewThis software is copyright (c) 2017 by Arthur Axel "fREW" Schmidt. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2017 by Arthur Axel "fREW" Schmidt. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2017 by Arthur Axel "fREW" Schmidt. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End DBIx-Class-Candy-0.005003/Changes0000644000175000017500000000606413132170544014617 0ustar frewfrewRevision history for DBIx-Class-Candy 0.005003 2017-07-14 09:29:22-07:00 America/Los_Angeles - Stop depending on String::CamelCase (closes GH#15) (Good find Peter Rabbitson!) 0.005002 2016-04-29 09:20:41-07:00 America/Los_Angeles - Fix test issue when run under `prove -lr` (Thanks Peter Rabbitson!) 0.005001 2015-11-20 23:26:06-08:00 America/Los_Angeles - Fix test failure on Win32 (Thanks Peter Evans!) 0.005000 2015-08-02 20:37:38-07:00 America/Los_Angeles - Add 'singular' autotable version (Good idea Dagfinn Ilmari Mannsåker!) (Resolves GH#10) 0.004001 2015-07-01 15:13:21-07:00 America/Los_Angeles - Set C3 on ResultClasses in addition to ResultSets 0.004000 2015-06-04 23:05:14-07:00 America/Los_Angeles - Add `-experimental` import 0.003001 2015-04-14 13:01:19-05:00 America/Chicago - Fix Changes (frew--) 0.003000 2015-04-14 12:25:12-05:00 America/Chicago - Add DBIx::Class::Candy::ResultSet 0.002107 2014-10-30 19:53:58-05:00 America/Chicago - Fix `export_method_aliases` (Thanks Denis Ibaev! See GH#7) 0.002106 2014-10-17 15:26:43-05:00 America/Chicago - Fix bug causing infinite recursion when you redefine a package (Thanks Graham Knop for fix, and Wes Malone for bug report!) - Simplify sub installer by using Sub::Exporter more correctly (Thanks RJBS!) - Stop calling ->table many times per ResultClass (Good catch RJBS!) 0.002105 2014-04-12 08:51:04-05:00 America/Chicago - Fix warnings in test (thanks for the report Zefram!) (Fixes RT#91976) 0.002104 2013-05-13 09:29:37 CST6CDT - Fix stupid doc examples 0.002103 2012-12-23 17:42:36 CST6CDT - Lazily load deps for autotable - Remove HERE BE DRAGONS warning, this module is totally stable \o/ 0.002102 2012-11-17 15:43:18 CST6CDT - Put MetaYAML back in dist 0.002101 2012-08-21 17:47:50 America/Chicago - remove VERSION from pod because yuck - fix repo url 0.002100 2012-03-13 20:31:45 America/Chicago - primary_column may be called multiple times to define a multicolumn pk 0.002001 2011-08-10 20:03:18 CST6CDT - autotable v1 now dies on unrecognized naming scheme - autotable v1 works with simply ::Result:: and not just ::Schema::Result:: 0.002000 2011-03-09 12:03:50 CST6CDT - Add unique_column sugar - Allow Candy to automatically set table name - Allow Candy subclass to define default base and default perl version - Add missing docs for primary_column sugar 0.001006 2011-03-01 22:44:45 CST6CDT - Add primary_column sugar - Fix incorrectly named export (inflate_colum .= n) 0.001005 2010-12-25 10:06:15 CST6CDT - Initial sketches of "Moosey" API - Merry Christmas!!! 0.001004 2010-07-31 01:46:04 CST6CDT - Fix a bug that only appears in perl 5.8 0.001003 2010-07-29 20:20:14 CST6CDT - Fix more bugs, this time the are from inheriting from other other results - Make ::Exports actually work 0.001002 2010-07-24 01:21:49 CST6CDT - Fix bug uncovered by doing belongs_to twice in a class 0.001001 2010-07-21 17:48:14 CST6CDT - Don't require parent for tests 0.001000 2010-07-21 00:18:10 CST6CDT - Initial Release DBIx-Class-Candy-0.005003/README0000644000175000017500000002024213132170544014176 0ustar frewfrewNAME DBIx::Class::Candy - Sugar for your favorite ORM, DBIx::Class SYNOPSIS package MyApp::Schema::Result::Artist; use DBIx::Class::Candy -autotable => v1; primary_column id => { data_type => 'int', is_auto_increment => 1, }; column name => { data_type => 'varchar', size => 25, is_nullable => 1, }; has_many albums => 'A::Schema::Result::Album', 'artist_id'; 1; DESCRIPTION "DBIx::Class::Candy" is a simple sugar layer for definition of DBIx::Class results. Note that it may later be expanded to add sugar for more "DBIx::Class" related things. By default "DBIx::Class::Candy": * turns on strict and warnings * sets your parent class * exports a bunch of the package methods that you normally use to define your DBIx::Class results * makes a few aliases to make some of the original method names shorter or more clear * defines very few new subroutines that transform the arguments passed to them It assumes a DBIx::Class::Core-like API, but you can tailor it to suit your needs. IMPORT OPTIONS See "SETTING DEFAULT IMPORT OPTIONS" for information on setting these schema wide. -base use DBIx::Class::Candy -base => 'MyApp::Schema::Result'; The first thing you can do to customize your usage of "DBIx::Class::Candy" is change the parent class. Do that by using the "-base" import option. -autotable use DBIx::Class::Candy -autotable => v1; Don't waste your precious keystrokes typing "table 'buildings'", let "DBIx::Class::Candy" do that for you! See "AUTOTABLE VERSIONS" for what the existing versions will generate for you. -components use DBIx::Class::Candy -components => ['FilterColumn']; "DBIx::Class::Candy" allows you to set which components you are using at import time so that the components can define their own sugar to export as well. See DBIx::Class::Candy::Exports for details on how that works. -perl5 use DBIx::Class::Candy -perl5 => v10; I love the new features in Perl 5.10 and 5.12, so I felt that it would be nice to remove the boiler plate of doing "use feature ':5.10'" and add it to my sugar importer. Feel free not to use this. -experimental use DBIx::Class::Candy -experimental => ['signatures']; I would like to use signatures and postfix dereferencing in all of my "DBIx::Class" classes. This makes that goal trivial. IMPORTED SUBROUTINES Most of the imported subroutines are the same as what you get when you use the normal interface for result definition: they have the same names and take the same arguments. In general write the code the way you normally would, leaving out the "__PACKAGE__->" part. The following are methods that are exported with the same name and arguments: belongs_to has_many has_one inflate_column many_to_many might_have remove_column remove_columns resultset_attributes resultset_class sequence source_name table There are some exceptions though, which brings us to: IMPORTED ALIASES These are merely renamed versions of the functions you know and love. The idea is to make your result classes a tiny bit prettier by aliasing some methods. If you know your "DBIx::Class" API you noticed that in the "SYNOPSIS" I used "column" instead of "add_columns" and "primary_key" instead of "set_primary_key". The old versions work, this is just nicer. A list of aliases are as follows: column => 'add_columns', primary_key => 'set_primary_key', unique_constraint => 'add_unique_constraint', relationship => 'add_relationship', SETTING DEFAULT IMPORT OPTIONS Eventually you will get tired of writing the following in every single one of your results: use DBIx::Class::Candy -base => 'MyApp::Schema::Result', -perl5 => v12, -autotable => v1, -experimental => ['signatures']; You can set all of these for your whole schema if you define your own "Candy" subclass as follows: package MyApp::Schema::Candy; use base 'DBIx::Class::Candy'; sub base { $_[1] || 'MyApp::Schema::Result' } sub perl_version { 12 } sub autotable { 1 } sub experimental { ['signatures'] } Note the "$_[1] ||" in "base". All of these methods are passed the values passed in from the arguments to the subclass, so you can either throw them away, honor them, die on usage, or whatever. To be clear, if you define your subclass, and someone uses it as follows: use MyApp::Schema::Candy -base => 'MyApp::Schema::Result', -perl5 => v18, -autotable => v1, -experimental => ['postderef']; Your "base" method will get "MyApp::Schema::Result", your "perl_version" will get 18, your "experimental" will get "['postderef']", and your "autotable" will get 1. SECONDARY API has_column There is currently a single "transformer" for "add_columns", so that people used to the Moose api will feel more at home. Note that this may go into a "Candy Component" at some point. Example usage: has_column foo => ( data_type => 'varchar', size => 25, is_nullable => 1, ); primary_column Another handy little feature that allows you to define a column and set it as the primary key in a single call: primary_column id => { data_type => 'int', is_auto_increment => 1, }; If your table has multiple columns in its primary key, merely call this method for each column: primary_column person_id => { data_type => 'int' }; primary_column friend_id => { data_type => 'int' }; unique_column This allows you to define a column and set it as unique in a single call: unique_column name => { data_type => 'varchar', size => 30, }; AUTOTABLE VERSIONS Currently there are two versions: "v1" It looks at your class name, grabs everything after "::Schema::Result::" (or "::Result::"), removes the "::"'s, converts it to underscores instead of camel-case, and pluralizes it. Here are some examples if that's not clear: MyApp::Schema::Result::Cat -> cats MyApp::Schema::Result::Software::Building -> software_buildings MyApp::Schema::Result::LonelyPerson -> lonely_people MyApp::DB::Result::FriendlyPerson -> friendly_people MyApp::DB::Result::Dog -> dogs 'singular' It looks at your class name, grabs everything after "::Schema::Result::" (or "::Result::"), removes the "::"'s and converts it to underscores instead of camel-case. Here are some examples if that's not clear: MyApp::Schema::Result::Cat -> cat MyApp::Schema::Result::Software::Building -> software_building MyApp::Schema::Result::LonelyPerson -> lonely_person MyApp::DB::Result::FriendlyPerson -> friendly_person MyApp::DB::Result::Dog -> dog Also, if you just want to be different, you can easily set up your own naming scheme. Just add a "gen_table" method to your candy subclass. The method gets passed the class name and the autotable version, which of course you may ignore. For example, one might just do the following: sub gen_table { my ($self, $class) = @_; $class =~ s/::/_/g; lc $class; } Which would transform "MyApp::Schema::Result::Foo" into "myapp_schema_result_foo". Or maybe instead of using the standard "MyApp::Schema::Result" namespace you decided to be different and do "MyApp::DB::Table" or something silly like that. You could pre-process your class name so that the default "gen_table" will still work: sub gen_table { my $self = shift; my $class = $_[0]; $class =~ s/::DB::Table::/::Schema::Result::/; return $self->next::method(@_); } AUTHOR Arthur Axel "fREW" Schmidt COPYRIGHT AND LICENSE This software is copyright (c) 2017 by Arthur Axel "fREW" Schmidt. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.