App-MPDJ

 view release on metacpan or  search on metacpan

lib/App/MPDJ.pm  view on Meta::CPAN

    'conlog|l=s'   => { DEFAULT => '' },
    'help|h'       => { ACTION  => \&help, },
    'version|V'    => { ACTION  => \&version, });

  $self->_getopt(@args);    # to get --conf option, if any

  my @configs =
    $self->config->get('conf') || ('/etc/mpdj.conf', "$ENV{HOME}/.mpdjrc");
  foreach my $config (@configs) {
    if (-e $config) {
      say "Loading config ($config)" if $self->config->get('conlog');
      $self->config->file($config);
    } else {
      say "Config file skipped ($config)" if $self->config->get('conlog');
    }
  }

  $self->_getopt(@args);    # to override config file
}

sub _getopt {
  my ($self, @args) = @_;

  $self->config->getopt([@args]);    # do not consume @args

lib/App/MPDJ.pm  view on Meta::CPAN

}

sub time_for_call {
  my ($self) = @_;

  return unless $self->config->get('calls-freq');
  return time - $self->{last_call} > $self->config->get('calls-freq');
}

sub version {
  say "mpdj (App::MPDJ) version $VERSION";
  exit;
}

sub help {
  print <<'HELP';
Usage: mpdj [options]

Options:
  --mpd             MPD connection string (password@host:port)
  -s,--syslog       Turns on syslog output (debug, info, notice, warn[ing], error, etc)



( run in 3.038 seconds using v1.01-cache-2.11-cpan-d7a12ab2c7f )