Configd

 view release on metacpan or  search on metacpan

lib/Configd/Syntax/Spaced.pm  view on Meta::CPAN


    return $out;
}


1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Configd::Syntax::Spaced - Config files that are a directive, some whitespace and a value.

=head1 VERSION

version 0.002

=head1 SYNOPSIS

    package Configd::Language::spaced_example;

    use parent qw{Configd::Syntax::Spaced};

    sub files   { return ( { path => '/etc/example.conf', mode => 0o644 } ) }
    sub units   { return ('example.service') }
    sub repeats { my ( $self, $key ) = @_; return $key eq 'listen' }

=head1 DESCRIPTION

Four of the files here are the same shape:

    Syslog                  yes
    Canonicalization        relaxed/simple

opendkim, opendmarc, redis and chrony all write configuration this way -- a
directive, whitespace, and the rest of the line -- and differ only in which
directives may be said twice.  One reader and one writer between them, rather
than four that drift apart.

A language in this shape subclasses this rather than L<Configd::Language>, and
says only what is its own: its files, its units, and which of its directives may
be said more than once.

It lives under C<Configd::Syntax::> rather than C<Configd::Language::> because
L<Configd> finds languages by looking for modules under the latter, and a base
class put there would be offered as a language somebody could adopt.

=head1 NAME

Configd::Syntax::Spaced - config files that are a directive, some whitespace and
a value.

=head1 METHODS

=head2 $language->parse($text)

The directives in a fragment.  Comments and blank lines come back as text with
no key, so they keep their place in a file that is not merged.

=head2 $language->emit($directives)

The file those directives make.

Written as C<directive value>, one space, rather than reproducing whatever
column alignment the original had.  Alignment is a property of a file somebody
maintained by hand, and this file is generated from several of them.

=head1 SEE ALSO

Please see those modules/websites for more information related to this module.

=over 4

=item *

L<Configd|Configd>

=item *

L<Configd::Language>

=back

=head1 BUGS

Please report any bugs or feature requests on the bugtracker website
L<https://github.com/teodesian/perl-configd/issues>

When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.

=head1 AUTHORS

Current Maintainers:

=over 4

=item *

George S. Baugh <george@troglodyne.net>

=back

=head1 COPYRIGHT AND LICENSE

Copyright (c) 2026 Troglodyne LLC


Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.



( run in 0.646 second using v1.01-cache-2.11-cpan-364913b4093 )