おれおれMojoliciousテンプレート
/xyz_web/lib |-- Xyz | |-- DB | | |-- Row | | | `-- Data.pm | | `-- Schema.pm | |-- DB.pm | |-- Model | | |-- Category.pm | | `-- Event.pm | |-- Model.pm | |-- Web | | `-- Controller | | |-- Event.pm | | `-- Example.pm | `-- Web.pm `-- Xyz.pm
/xyz_web/lib/Xyz.pm
もちろん外へ出してもいいけど、ここに直接config書いちゃう。
our $CONFIG = { default => { db => { connect_info => [ 'dbi:mysql:xyz', 'root', '', { RaiseError => 1, PrintError => 0, AutoCommit => 1, mysql_enable_utf8 => 1 } ], }, web_root => '', }, dev => { db => { connect_info => [ 'dbi:mysql:xyz', 'dev_user', '', { RaiseError => 1, PrintError => 0, AutoCommit => 1, mysql_enable_utf8 => 1 } ], }, web_root => '/bloc2', }, }; sub config { my $config_name = $ENV{BLOC_CONFIG} || 'default'; return $CONFIG->{$config_name}; }