Bryar::Config::YAML - Bryar configuration stored in YAML


Bryar-Config-YAML documentation Contained in the Bryar-Config-YAML distribution.

Index


Code Index:

NAME

Top

Bryar::Config::YAML - Bryar configuration stored in YAML

VERSION

Top

version 0.103

SYNOPSIS

Top

 Bryar::Config::YAML->new(...);
 Bryar::Config::YAML->load(...);

DESCRIPTION

Top

This encapsulates a Bryar configuration. It can be used to load a new configuration from a file, or provide a reasonable set of defaults.

It loads Bryar configuration from a YAML file.

METHODS

Top

load

    $self->load($file)

Load the configuration file from somewhere and return the arguments as a hash.

AUTHOR

Top

Ricardo SIGNES, <rjbs@cpan.org>

BUGS

Top

Please report any bugs or feature requests to bug-bryar-config-yaml@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT

Top


Bryar-Config-YAML documentation Contained in the Bryar-Config-YAML distribution.
use strict;
use warnings;

package Bryar::Config::YAML;
use base qw(Bryar::Config);

use YAML::Syck qw(LoadFile);

our $VERSION = '0.103';

sub load {
  my ($self, $file) = @_;
  my %args;
  my $datadir = $self->{datadir};
  if (!-r $file) {
    if (-r "$datadir/$file") {
      $file = "$datadir/$file";
    } else {
      return;
    }
  }
  %args = %{ (LoadFile($file))[0] };
  return %args;
}

1;