Config.pm 368 B

1234567891011121314151617
  1. package Trog::Config;
  2. use strict;
  3. use warnings;
  4. use Config::Simple;
  5. sub get {
  6. my $cf = {};
  7. my $home_cfg = "$ENV{HOME}/.tcms/main.cfg"; #XXX probably should pass this in and sanitize ENV
  8. Config::Simple->import_from($home_cfg, $cf) if -f $home_cfg;
  9. return $cf if %$cf;
  10. Config::Simple->import_from('config/default.cfg', $cf);
  11. return $cf;
  12. }
  13. 1;