Gitosis::Config::Reader - A class to read gitosis.conf files.


Gitosis-Config documentation Contained in the Gitosis-Config distribution.

Index


Code Index:

NAME

Top

Gitosis::Config::Reader - A class to read gitosis.conf files.

SYNOPSIS

Top

    use Gitosis::Config::Reader;
    my $cfg = Gitosis::Config::Reader->read_file( $args->{file} );

DESCRIPTION

Top

The Gitosis::Config::Reader class extends Config::INI::Reader.

METHODS

Top

All methods are exactly the same as Config::INI::Reader except as documented below.

can_ignore

Overridden to include lines starting with ; or #

parse_value_assignment

Overridden to allow for multiple lines per assignment. The current implementation is very hackish and may be replaced in the future.

Overriden

DEPENDENCIES

Top

Moose, Config::INI::Reader

BUGS AND LIMITATIONS

Top

None known currently, please email the author if you find any.

AUTHOR

Top

Chris Prather (chris@prather.org)

LICENCE

Top

Copyright 2009 by Chris Prather.

This software is free. It is licensed under the same terms as Perl itself.


Gitosis-Config documentation Contained in the Gitosis-Config distribution.

package Gitosis::Config::Reader;
use Moose;
extends qw(Config::INI::Reader);

sub can_ignore {
    my ( $self, $line ) = @_;
    return $line =~ /\A\s*(?:;|$|#)/ ? 1 : 0;    # Skip comments and empty lines
}

has _current_key => ( isa => 'Str', is => 'rw', );

around parse_value_assignment => sub {
    my ( $next, $self ) = splice @_, 0, 2;       # pull these off @_
    if ( my ( $key, $value ) = $self->$next(@_) ) {
        $self->_current_key($key);
        return ( $key, $value );
    }
    elsif ( $_[0] =~ /^\s*(.+)\s*$/ ) {
        return $self->_current_key, $1;
    }
    return;
};

no Moose;
1;
__END__