@@ -1,6 +1,9 @@
Revision history for Perl extension Catalyst::Model::DBIC::Schema
-0.64 2014-07-22 23:0:00
+0.65 2014-08-04 11:00:00
+ - Make compose_namespaces and install model shortcuts optional
+
+0.64 2014-07-22 23:00:00
- Fix Replicated trait that got busted when someone assumed
Module::Runtime was a drop in replacement for Class::MOP::load_class
@@ -7,13 +7,13 @@ build_requires:
ExtUtils::MakeMaker: 6.59
Storable: 0
Test::Exception: 0
- Test::More: '0.94'
+ Test::More: 0.94
Test::Requires: 0
configure_requires:
ExtUtils::MakeMaker: 6.59
distribution_type: module
dynamic_config: 1
-generated_by: 'Module::Install version 1.10'
+generated_by: 'Module::Install version 1.06'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -23,21 +23,34 @@ no_index:
directory:
- inc
- t
+provides:
+ Catalyst::Helper::Model::DBIC::Schema:
+ file: lib/Catalyst/Helper/Model/DBIC/Schema.pm
+ version: 0.65
+ Catalyst::Model::DBIC::Schema:
+ file: lib/Catalyst/Model/DBIC/Schema.pm
+ version: 0.65
+ Catalyst::TraitFor::Model::DBIC::Schema::Caching:
+ file: lib/Catalyst/TraitFor/Model/DBIC/Schema/Caching.pm
+ Catalyst::TraitFor::Model::DBIC::Schema::PerRequestSchema:
+ file: lib/Catalyst/TraitFor/Model/DBIC/Schema/PerRequestSchema.pm
+ Catalyst::TraitFor::Model::DBIC::Schema::Replicated:
+ file: lib/Catalyst/TraitFor/Model/DBIC/Schema/Replicated.pm
+ Catalyst::TraitFor::Model::DBIC::Schema::SchemaProxy:
+ file: lib/Catalyst/TraitFor/Model/DBIC/Schema/SchemaProxy.pm
requires:
Carp::Clan: 0
Catalyst::Component::InstancePerContext: 0
- Catalyst::Devel: '1.0'
- Catalyst::Runtime: '5.80005'
- CatalystX::Component::Traits: '0.14'
- DBIx::Class: '0.08114'
- DBIx::Class::Cursor::Cached: 0
- DBIx::Class::Schema::Loader: '0.04005'
+ Catalyst::Runtime: 5.80005
+ CatalystX::Component::Traits: 0.14
+ DBIx::Class: 0.08114
+ DBIx::Class::Schema::Loader: 0.04005
Hash::Merge: 0
List::MoreUtils: 0
- Module::Runtime: '0.012'
- Moose: '1.12'
- MooseX::MarkAsMethods: '0.13'
- MooseX::NonMoose: '0.16'
+ Module::Runtime: 0.012
+ Moose: 1.12
+ MooseX::MarkAsMethods: 0.13
+ MooseX::NonMoose: 0.16
MooseX::Types: 0
MooseX::Types::LoadableClass: 0.009
Tie::IxHash: 0
@@ -48,4 +61,4 @@ requires:
resources:
license: http://dev.perl.org/licenses/
repository: git://git.shadowcat.co.uk/catagits/Catalyst-Model-DBIC-Schema.git
-version: '0.64'
+version: 0.65
@@ -273,6 +273,15 @@ CONFIG PARAMETERS
Catalyst::TraitFor::Model::DBIC::Schema::SchemaProxy
Catalyst::TraitFor::Model::DBIC::Schema::PerRequestSchema
+ compose_namespaces
+ This model calls "compose_namespaces" in DBIx::Class::Schema by default
+ to install classes into the model namespaces. You can turn that off by
+ setting this attribute to false. Default is true.
+
+ install_model_shortcuts
+ If you don't want shortcut models so you can do e.g.
+ "$c->model('DB::Book')" set this attribute to false, Default is true.
+
storage_type
Allows the use of a different "storage_type" than what is set in your
"schema_class" (which in turn defaults to "::DBI" if not set in current
@@ -331,11 +340,14 @@ METHODS
composed_schema
Accessor which returns the composed schema, which has no connection
- info, which was used in constructing the "schema" above. Useful for
- creating new connections based on the same schema/model. There are
- direct shortcuts from the model object for composed_schema->clone and
+ info, which was used in constructing the "schema". Useful for creating
+ new connections based on the same schema/model. There are direct
+ shortcuts from the model object for composed_schema->clone and
composed_schema->connect
+ If "compose_namespaces" is not true, "composed_schema" is equivalent to
+ "$model->schema_class->clone".
+
clone
Shortcut for ->composed_schema->clone
@@ -8,7 +8,7 @@ use ExtUtils::MakeMaker ();
use vars qw{$VERSION};
BEGIN {
- $VERSION = '1.10';
+ $VERSION = '1.06';
}
# special map on pre-defined feature sets
@@ -115,7 +115,7 @@ sub import {
print "*** $class version " . $class->VERSION . "\n";
print "*** Checking for Perl dependencies...\n";
- my $cwd = Cwd::getcwd();
+ my $cwd = Cwd::cwd();
$Config = [];
@@ -166,7 +166,7 @@ sub import {
$modules = [ %{$modules} ] if UNIVERSAL::isa( $modules, 'HASH' );
unshift @$modules, -default => &{ shift(@$modules) }
- if ( ref( $modules->[0] ) eq 'CODE' ); # XXX: bugward compatibility
+ if ( ref( $modules->[0] ) eq 'CODE' ); # XXX: bugward combatability
while ( my ( $mod, $arg ) = splice( @$modules, 0, 2 ) ) {
if ( $mod =~ m/^-(\w+)$/ ) {
@@ -345,26 +345,22 @@ sub install {
my $i; # used below to strip leading '-' from config keys
my @config = ( map { s/^-// if ++$i; $_ } @{ +shift } );
- my ( @modules, @installed, @modules_to_upgrade );
- while (my ($pkg, $ver) = splice(@_, 0, 2)) {
+ my ( @modules, @installed );
+ while ( my ( $pkg, $ver ) = splice( @_, 0, 2 ) ) {
- # grep out those already installed
- if (_version_cmp(_version_of($pkg), $ver) >= 0) {
- push @installed, $pkg;
- if ($UpgradeDeps) {
- push @modules_to_upgrade, $pkg, $ver;
- }
- }
- else {
- push @modules, $pkg, $ver;
- }
- }
+ # grep out those already installed
+ if ( _version_cmp( _version_of($pkg), $ver ) >= 0 ) {
+ push @installed, $pkg;
+ }
+ else {
+ push @modules, $pkg, $ver;
+ }
+ }
- if ($UpgradeDeps) {
- push @modules, @modules_to_upgrade;
- @installed = ();
- @modules_to_upgrade = ();
- }
+ if ($UpgradeDeps) {
+ push @modules, @installed;
+ @installed = ();
+ }
return @installed unless @modules; # nothing to do
return @installed if _check_lock(); # defer to the CPAN shell
@@ -615,7 +611,7 @@ sub _under_cpan {
require Cwd;
require File::Spec;
- my $cwd = File::Spec->canonpath( Cwd::getcwd() );
+ my $cwd = File::Spec->canonpath( Cwd::cwd() );
my $cpan = File::Spec->canonpath( $CPAN::Config->{cpan_home} );
return ( index( $cwd, $cpan ) > -1 );
@@ -931,4 +927,4 @@ END_MAKE
__END__
-#line 1197
+#line 1193
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.10';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -91,7 +91,3 @@ sub auto_install_now {
}
1;
-
-__END__
-
-#line 109
@@ -4,7 +4,7 @@ package Module::Install::Base;
use strict 'vars';
use vars qw{$VERSION};
BEGIN {
- $VERSION = '1.10';
+ $VERSION = '1.06';
}
# Suspend handler for "redefined" warnings
@@ -8,7 +8,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.10';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.10';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -91,7 +91,3 @@ END_FTP
}
1;
-
-__END__
-
-#line 109
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.10';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -32,7 +32,3 @@ sub auto_include_dependent_dists {
}
1;
-
-__END__
-
-#line 50
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.10';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -133,7 +133,7 @@ sub makemaker_args {
return $args;
}
-# For mm args that take multiple space-separated args,
+# For mm args that take multiple space-seperated args,
# append an argument to the current list.
sub makemaker_append {
my $self = shift;
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.10';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -347,7 +347,7 @@ sub name_from {
^ \s*
package \s*
([\w:]+)
- [\s|;]*
+ \s* ;
/ixms
) {
my ($name, $module_name) = ($1, $1);
@@ -453,40 +453,24 @@ sub author_from {
#Stolen from M::B
my %license_urls = (
+ perl => 'http://dev.perl.org/licenses/',
+ apache => 'http://apache.org/licenses/LICENSE-2.0',
+ apache_1_1 => 'http://apache.org/licenses/LICENSE-1.1',
+ artistic => 'http://opensource.org/licenses/artistic-license.php',
+ artistic_2 => 'http://opensource.org/licenses/artistic-license-2.0.php',
+ lgpl => 'http://opensource.org/licenses/lgpl-license.php',
+ lgpl2 => 'http://opensource.org/licenses/lgpl-2.1.php',
+ lgpl3 => 'http://opensource.org/licenses/lgpl-3.0.html',
+ bsd => 'http://opensource.org/licenses/bsd-license.php',
+ gpl => 'http://opensource.org/licenses/gpl-license.php',
+ gpl2 => 'http://opensource.org/licenses/gpl-2.0.php',
+ gpl3 => 'http://opensource.org/licenses/gpl-3.0.html',
+ mit => 'http://opensource.org/licenses/mit-license.php',
+ mozilla => 'http://opensource.org/licenses/mozilla1.1.php',
open_source => undef,
unrestricted => undef,
restrictive => undef,
unknown => undef,
-
-## from Software-License - should we be using S-L instead ?
-# duplicates commeted out, see hack above ^^
-# open_source => 'http://www.gnu.org/licenses/agpl-3.0.txt',
-# apache => 'http://www.apache.org/licenses/LICENSE-1.1',
- apache => 'http://www.apache.org/licenses/LICENSE-2.0.txt',
- artistic => 'http://www.perlfoundation.org/artistic_license_1_0',
- artistic_2 => 'http://www.perlfoundation.org/artistic_license_2_0',
- bsd => 'http://opensource.org/licenses/BSD-3-Clause',
-# unrestricted => 'http://creativecommons.org/publicdomain/zero/1.0/',
-# open_source => 'http://www.freebsd.org/copyright/freebsd-license.html',
-# open_source => 'http://www.gnu.org/licenses/fdl-1.2.txt',
-# open_source => 'http://www.gnu.org/licenses/fdl-1.3.txt',
-# gpl => 'http://www.gnu.org/licenses/old-licenses/gpl-1.0.txt',
-# gpl => 'http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt',
- gpl => 'http://www.gnu.org/licenses/gpl-3.0.txt',
-# lgpl => 'http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt',
- lgpl => 'http://www.gnu.org/licenses/lgpl-3.0.txt',
- mit => 'http://www.opensource.org/licenses/mit-license.php',
-# mozilla => 'http://www.mozilla.org/MPL/MPL-1.0.txt',
-# mozilla => 'http://www.mozilla.org/MPL/MPL-1.1.txt',
- mozilla => 'http://www.mozilla.org/MPL/2.0/index.txt',
-# restrictive => '',
-# open_source => 'http://www.openssl.org/source/license.html',
- perl => 'http://dev.perl.org/licenses/',
-# open_source => 'http://www.opensource.org/licenses/postgresql',
-# open_source => 'http://trolltech.com/products/qt/licenses/licensing/qpl',
-# unrestricted => 'http://h71000.www7.hp.com/doc/83final/BA554_90007/apcs02.html',
-# open_source => 'http://www.openoffice.org/licenses/sissl_license.html',
-# open_source => 'http://www.zlib.net/zlib_license.html',
);
sub license {
@@ -527,43 +511,31 @@ sub __extract_license {
my @phrases = (
'(?:under )?the same (?:terms|license) as (?:perl|the perl (?:\d )?programming language)' => 'perl', 1,
'(?:under )?the terms of (?:perl|the perl programming language) itself' => 'perl', 1,
-
- # the following are relied on by the test system even if they are wrong :(
+ 'Artistic and GPL' => 'perl', 1,
+ 'GNU general public license' => 'gpl', 1,
+ 'GNU public license' => 'gpl', 1,
+ 'GNU lesser general public license' => 'lgpl', 1,
+ 'GNU lesser public license' => 'lgpl', 1,
+ 'GNU library general public license' => 'lgpl', 1,
+ 'GNU library public license' => 'lgpl', 1,
+ 'GNU Free Documentation license' => 'unrestricted', 1,
+ 'GNU Affero General Public License' => 'open_source', 1,
'(?:Free)?BSD license' => 'bsd', 1,
'Artistic license 2\.0' => 'artistic_2', 1,
+ 'Artistic license' => 'artistic', 1,
+ 'Apache (?:Software )?license' => 'apache', 1,
+ 'GPL' => 'gpl', 1,
'LGPL' => 'lgpl', 1,
+ 'BSD' => 'bsd', 1,
+ 'Artistic' => 'artistic', 1,
'MIT' => 'mit', 1,
-
-## from Software-License
- 'The GNU Affero General Public License, Version 3, November 2007' => 'open_source', 1,
- 'The Apache Software License, Version 1.1' => 'apache', 1,
- 'The Apache License, Version 2.0, January 2004' => 'apache', 1,
- 'The Artistic License 1.0' => 'artistic', 1,
- 'The Artistic License 2.0 (GPL Compatible)' => 'artistic_2', 1,
- 'The (three-clause) BSD License' => 'bsd', 1,
- 'CC0 License' => 'unrestricted', 1,
- 'The (two-clause) FreeBSD License' => 'open_source', 1,
- 'GNU Free Documentation License v1.2' => 'open_source', 1,
- 'GNU Free Documentation License v1.3' => 'open_source', 1,
- 'The GNU General Public License, Version 1, February 1989' => 'gpl', 1,
- 'The GNU General Public License, Version 2, June 1991' => 'gpl', 1,
- 'The GNU General Public License, Version 3, June 2007' => 'gpl', 1,
- 'The GNU Lesser General Public License, Version 2.1, February 1999' => 'lgpl', 1,
- 'The GNU Lesser General Public License, Version 3, June 2007' => 'lgpl', 1,
- 'The MIT (X11) License' => 'mit', 1,
- 'The Mozilla Public License 1.0' => 'mozilla', 1,
- 'The Mozilla Public License 1.1' => 'mozilla', 1,
- 'Mozilla Public License Version 2.0' => 'mozilla', 1,
- '"No License" License' => 'restrictive', 1,
- 'OpenSSL License' => 'open_source', 1,
- 'the same terms as the perl 5 programming language system itself' => 'perl', 1,
- 'The PostgreSQL License' => 'open_source', 1,
- 'The Q Public License, Version 1.0' => 'open_source', 1,
- 'Original SSLeay License' => 'unrestricted', 1,
- 'Sun Internet Standards Source License (SISSL)' => 'open_source', 1,
- 'The zlib License' => 'open_source', 1,
+ 'Mozilla Public License' => 'mozilla', 1,
+ 'Q Public License' => 'open_source', 1,
+ 'OpenSSL License' => 'unrestricted', 1,
+ 'SSLeay License' => 'unrestricted', 1,
+ 'zlib License' => 'open_source', 1,
+ 'proprietary' => 'proprietary', 0,
);
-
while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
$pattern =~ s#\s+#\\s+#gs;
if ( $license_text =~ /\b$pattern\b/i ) {
@@ -733,7 +705,7 @@ sub _write_mymeta_data {
my @yaml = Parse::CPAN::Meta::LoadFile('META.yml');
my $meta = $yaml[0];
- # Overwrite the non-configure dependency hashes
+ # Overwrite the non-configure dependency hashs
delete $meta->{requires};
delete $meta->{build_requires};
delete $meta->{recommends};
@@ -748,7 +720,3 @@ sub _write_mymeta_data {
}
1;
-
-__END__
-
-#line 766
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.10';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -62,7 +62,3 @@ END_MESSAGE
}
1;
-
-__END__
-
-#line 80
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.10';
+ $VERSION = '1.06';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
@@ -61,7 +61,3 @@ sub WriteAll {
}
1;
-
-__END__
-
-#line 79
@@ -17,7 +17,7 @@ package Module::Install;
# 3. The ./inc/ version of Module::Install loads
# }
-use 5.006;
+use 5.005;
use strict 'vars';
use Cwd ();
use File::Find ();
@@ -31,7 +31,7 @@ BEGIN {
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '1.10';
+ $VERSION = '1.06';
# Storage for the pseudo-singleton
$MAIN = undef;
@@ -156,10 +156,10 @@ END_DIE
sub autoload {
my $self = shift;
my $who = $self->_caller;
- my $cwd = Cwd::getcwd();
+ my $cwd = Cwd::cwd();
my $sym = "${who}::AUTOLOAD";
$sym->{$cwd} = sub {
- my $pwd = Cwd::getcwd();
+ my $pwd = Cwd::cwd();
if ( my $code = $sym->{$pwd} ) {
# Delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
@@ -239,7 +239,7 @@ sub new {
# ignore the prefix on extension modules built from top level.
my $base_path = Cwd::abs_path($FindBin::Bin);
- unless ( Cwd::abs_path(Cwd::getcwd()) eq $base_path ) {
+ unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) {
delete $args{prefix};
}
return $args{_self} if $args{_self};
@@ -338,7 +338,7 @@ sub find_extensions {
if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) {
my $content = Module::Install::_read($subpath . '.pm');
my $in_pod = 0;
- foreach ( split /\n/, $content ) {
+ foreach ( split //, $content ) {
$in_pod = 1 if /^=\w/;
$in_pod = 0 if /^=cut/;
next if ($in_pod || /^=cut/); # skip pod text
@@ -434,7 +434,7 @@ END_OLD
# _version is for processing module versions (eg, 1.03_05) not
# Perl versions (eg, 5.8.1).
-sub _version {
+sub _version ($) {
my $s = shift || 0;
my $d =()= $s =~ /(\.)/g;
if ( $d >= 2 ) {
@@ -450,12 +450,12 @@ sub _version {
return $l + 0;
}
-sub _cmp {
+sub _cmp ($$) {
_version($_[1]) <=> _version($_[2]);
}
# Cloned from Params::Util::_CLASS
-sub _CLASS {
+sub _CLASS ($) {
(
defined $_[0]
and
@@ -467,7 +467,4 @@ sub _CLASS {
1;
-
-__END__
-
-#line 485
+# Copyright 2008 - 2012 Adam Kennedy.
@@ -4,7 +4,7 @@ use namespace::autoclean;
use Moose;
no warnings 'uninitialized';
-our $VERSION = '0.63';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
use Carp;
@@ -5,7 +5,7 @@ use mro 'c3';
extends 'Catalyst::Model';
with 'CatalystX::Component::Traits';
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
use namespace::autoclean;
@@ -306,6 +306,17 @@ Traits that come with the distribution:
=back
+=head2 compose_namespaces
+
+This model calls L<DBIx::Class::Schema/compose_namespaces> by default to
+install classes into the model namespaces. You can turn that off by
+setting this attribute to false. Default is true.
+
+=head2 install_model_shortcuts
+
+If you don't want shortcut models so you can do e.g. C<< $c->model('DB::Book')
+>> set this attribute to false, Default is true.
+
=head2 storage_type
Allows the use of a different C<storage_type> than what is set in your
@@ -376,10 +387,13 @@ schema->resultset, schema->source, and schema->class.
=head2 composed_schema
Accessor which returns the composed schema, which has no connection info,
-which was used in constructing the C<schema> above. Useful for creating
+which was used in constructing the L</schema>. Useful for creating
new connections based on the same schema/model. There are direct shortcuts
from the model object for composed_schema->clone and composed_schema->connect
+If L</compose_namespaces> is not true, L</composed_schema> is equivalent to
+C<< $model->schema_class->clone >>.
+
=head2 clone
Shortcut for ->composed_schema->clone
@@ -422,6 +436,10 @@ has schema_class => (
required => 1
);
+has compose_namespaces => (is => 'ro', default => sub { 1 });
+
+has install_model_shortcuts => (is => 'ro', default => sub { 1 });
+
has storage_type => (is => 'rw', isa => Str);
has connect_info => (is => 'rw', isa => ConnectInfo, coerce => 1);
@@ -476,8 +494,13 @@ sub BUILD {
my $is_installed = defined $self->composed_schema;
- $self->composed_schema($schema_class->compose_namespace($class))
- unless $is_installed;
+ if (not $is_installed) {
+ $self->composed_schema($self->compose_namespaces ?
+ $schema_class->compose_namespace($class)
+ :
+ $schema_class->clone
+ );
+ }
$self->schema($self->composed_schema->clone)
unless $self->schema;
@@ -487,7 +510,9 @@ sub BUILD {
$self->schema->connection($self->connect_info);
- $self->_install_rs_models unless $is_installed;
+ if ((not $is_installed) && $self->install_model_shortcuts) {
+ $self->_install_rs_models;
+ }
}
sub clone { shift->composed_schema->clone(@_); }