[Catalyst-commits] r10919 - in trunk/Catalyst-Model-DBIC-Schema:
lib/Catalyst/Helper/Model/DBIC t
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Fri Jul 17 19:35:31 GMT 2009
Author: caelum
Date: 2009-07-17 19:35:29 +0000 (Fri, 17 Jul 2009)
New Revision: 10919
Modified:
trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Helper/Model/DBIC/Schema.pm
trunk/Catalyst-Model-DBIC-Schema/t/08helper.t
Log:
detect wrong case for "dbi:" DSN part in DBIC helper
Modified: trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Helper/Model/DBIC/Schema.pm
===================================================================
--- trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Helper/Model/DBIC/Schema.pm 2009-07-17 11:41:49 UTC (rev 10918)
+++ trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Helper/Model/DBIC/Schema.pm 2009-07-17 19:35:29 UTC (rev 10919)
@@ -189,7 +189,12 @@
$helper->{loader_args} = $self->_build_helper_loader_args;
- if (first { /^dbi:/i } @args) {
+ my $dbi_dsn_part;
+ if (first { ($dbi_dsn_part) = /^(dbi):/i } @args) {
+ die
+qq{DSN must start with 'dbi:' not '$dbi_dsn_part' (case matters!)}
+ if $dbi_dsn_part ne 'dbi';
+
$helper->{setup_connect_info} = 1;
$helper->{connect_info} =
@@ -269,7 +274,7 @@
my %loader_args;
- while (@$args && $args->[0] !~ /^dbi:/) {
+ while (@$args && $args->[0] !~ /^dbi:/i) {
my ($key, $val) = split /=/, shift(@$args), 2;
if ($self->_is_struct($val)) {
Modified: trunk/Catalyst-Model-DBIC-Schema/t/08helper.t
===================================================================
--- trunk/Catalyst-Model-DBIC-Schema/t/08helper.t 2009-07-17 11:41:49 UTC (rev 10918)
+++ trunk/Catalyst-Model-DBIC-Schema/t/08helper.t 2009-07-17 19:35:29 UTC (rev 10919)
@@ -10,7 +10,7 @@
use Storable 'dclone';
eval "use Catalyst::Helper";
plan skip_all => 'Catalyst::Helper required for tests' if $@;
-plan tests => 40;
+plan tests => 41;
my $helper = Catalyst::Helper->new;
$helper->{base} = $Bin;
@@ -26,6 +26,9 @@
$i = instance(schema_class => 'ASchemaClass');
is $i->old_schema, 1, '->load_classes detected correctly';
+throws_ok { $i = instance(args => [$static, 'DbI:SQLite:myapp.db']) }
+ qr/case matters/i, "wrong case for 'dbi:' DSN part";
+
$i = instance(args => ['traits=Caching']);
is_deeply $i->traits, ['Caching'], 'one trait';
is $i->helper->{traits}, "['Caching']", 'one trait as string';
More information about the Catalyst-commits
mailing list