Config.pm 565 B

12345678910111213141516171819202122232425262728
  1. package Trog::Config;
  2. use strict;
  3. use warnings;
  4. use Config::Simple;
  5. =head1 Trog::Config
  6. A thin wrapper around Config::Simple which reads the configuration from the appropriate place.
  7. =head2 Trog::Config::get() = Config::Simple
  8. Returns a configuration object that will be used by server.psgi, the data model and Routing modules.
  9. =cut
  10. our $home_cfg = "$ENV{HOME}/.tcms/main.cfg";
  11. sub get {
  12. my $cf;
  13. $cf = Config::Simple->new($home_cfg) if -f $home_cfg;
  14. return $cf if $cf;
  15. $cf = Config::Simple->new('config/default.cfg');
  16. return $cf;
  17. }
  18. 1;