[Catalyst-commits] r11358 - in branches/Catalyst-Model-DBI/theory: . lib/Catalyst/Helper/Model lib/Catalyst/Model

theory at dev.catalyst.perl.org theory at dev.catalyst.perl.org
Sat Sep 12 20:57:05 GMT 2009


Author: theory
Date: 2009-09-12 20:57:04 +0000 (Sat, 12 Sep 2009)
New Revision: 11358

Modified:
   branches/Catalyst-Model-DBI/theory/Changes
   branches/Catalyst-Model-DBI/theory/lib/Catalyst/Helper/Model/DBI.pm
   branches/Catalyst-Model-DBI/theory/lib/Catalyst/Model/DBI.pm
Log:
Use "username" in the config instead of "user". Still allow "user", though,
and also allow "pass" in addition to the existing "password", for parity.


Modified: branches/Catalyst-Model-DBI/theory/Changes
===================================================================
--- branches/Catalyst-Model-DBI/theory/Changes	2009-09-12 20:53:35 UTC (rev 11357)
+++ branches/Catalyst-Model-DBI/theory/Changes	2009-09-12 20:57:04 UTC (rev 11358)
@@ -4,6 +4,8 @@
       exceptions.
     - Added `use warnings;` and switched from `base` to `parent` like the rest
       of Catalyst.
+    - Switched the config key from "user" to "username" and added "password".
+      "user" is still supported, and "pass" has been added for parity.
 0.20  Sun Dec 07 17:36:00 2008 
 	- fixed issue: http://rt.cpan.org/Public/Bug/Display.html?id=38121
 	- fixed issue: http://rt.cpan.org/Public/Bug/Display.html?id=39884

Modified: branches/Catalyst-Model-DBI/theory/lib/Catalyst/Helper/Model/DBI.pm
===================================================================
--- branches/Catalyst-Model-DBI/theory/lib/Catalyst/Helper/Model/DBI.pm	2009-09-12 20:53:35 UTC (rev 11357)
+++ branches/Catalyst-Model-DBI/theory/lib/Catalyst/Helper/Model/DBI.pm	2009-09-12 20:57:04 UTC (rev 11358)
@@ -70,7 +70,7 @@
 
 __PACKAGE__->config(
     dsn           => '[% dsn %]',
-    user          => '[% user %]',
+    username      => '[% user %]',
     password      => '[% pass %]',
     options       => {},
 );

Modified: branches/Catalyst-Model-DBI/theory/lib/Catalyst/Model/DBI.pm
===================================================================
--- branches/Catalyst-Model-DBI/theory/lib/Catalyst/Model/DBI.pm	2009-09-12 20:53:35 UTC (rev 11357)
+++ branches/Catalyst-Model-DBI/theory/lib/Catalyst/Model/DBI.pm	2009-09-12 20:57:04 UTC (rev 11358)
@@ -17,7 +17,7 @@
 =head1 SYNOPSIS
 
 	# use the helper
-	create model DBI DBI dsn user password
+	create model DBI DBI dsn username password
 	
 	# lib/MyApp/Model/DBI.pm
 	package MyApp::Model::DBI;
@@ -27,7 +27,7 @@
 	__PACKAGE__->config(
 		dsn           => 'dbi:Pg:dbname=myapp',
 		password      => '',
-		user          => 'postgres',
+		username      => 'postgres',
 		options       => { AutoCommit => 1 },
 	);
 	
@@ -120,8 +120,8 @@
 	my $dbh = eval {
 		DBI->connect(
 			$self->{dsn},
-			$self->{user},
-			$self->{password},
+			$self->{username} || $self->{user},
+			$self->{password} || $self->{pass},
 			$self->{options}
 		);
 	};




More information about the Catalyst-commits mailing list