From: "Darren Duncan" <dar...@darrenduncan.net> > For any configuration details that might vary either per application or per > deployment, make these user-configurable parameters of MyDBLib, with then > each > of your applications would supply arguments to it when instantiating a > MyDBLib > object; in the Catalyst app's case, said arguments would be in your Catalyst > app > config file as is normal for MyApp::Model::DB. > > For any configuration details that are unlikely to vary per application or > per > deployment, especially if they are details for which your actual code would > vary, then put these directly in your MyDBLib code instead.
Yes you are right. > Octavian Rasnita wrote: >> The best idea would be to put the connection information in the >> application's config file like in the example below. (This example uses a >> Perl data structure, but you can use any configuration type accepted by >> Config::Any). >> >> 'Model::DB' => { >> schema_class => 'MyApp::Schema', >> connect_info => { >> dsn => 'dbi:Oracle:host=10.10.10.10;port=1521;sid=ora8', >> user => 'user', >> password => "password", >> #name_sep => '.', >> LongReadLen => 100*1024*1024, >> LongTruncOk => 1, >> on_connect_call => 'datetime_setup', >> on_connect_do => [ >> "alter session set NLS_COMP='LINGUISTIC'", >> "alter session set NLS_SORT='BINARY_AI'", >> ], >> }, >> }, >> [snip] > Now some of this looks wrong to me; a lot of those details should be in your > MyDBLib code instead of the config file. Your config file should instead > look > more like this: > > 'Model::DB' => { > schema_class => 'MyApp::Schema', > connect_info => { > host => '10.10.10.10', > port => 1521, > user => 'user', > password => "password", > }, > }, > > These are more details that a non-programmer user would set. I agree and yes, that sample code could give bad ideas. In my case I am the app designer, coder, maintainer, site admin, everything but the web designer and I've done it so for not specifying these settings in more places. Is there another place where I could put these settings for a certain DBIC schema? For example, can I put them in the MyApp/Schema.pm, orsomewhere else? Can you give an example? Thanks. Octavian _______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/