# HG changeset patch # User Heiko Schlittermann # Date 1473880507 -7200 # Node ID 705353a1d27499953279642af55b0b0ff88a98c5 # Parent eb152cd8d2bc2f03864a4983cf94907ec2ef3dd2 moved to git.schlittermann.de diff -r eb152cd8d2bc -r 705353a1d274 Build.PL --- a/Build.PL Mon Jan 12 15:08:08 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -#! /usr/bin/perl -use strict; -use warnings; -use Module::Build; - -Module::Build->new( - dist_name => 'read-httpd-conf', - dist_version_from => 'lib/App/read_httpd_conf.pm', - dist_abstract => 'simple config parser for apache', - bin_files => [qw(bin/read-httpd-conf)], - requires => { - perl => '0', - }, -)->create_build_script; diff -r eb152cd8d2bc -r 705353a1d274 MANIFEST --- a/MANIFEST Mon Jan 12 15:08:08 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -.hgignore -bin/read-httpd-conf -Build.PL -lib/App/read_httpd_conf.pm -MANIFEST This list of files -t/00-basic.t diff -r eb152cd8d2bc -r 705353a1d274 MANIFEST.SKIP --- a/MANIFEST.SKIP Mon Jan 12 15:08:08 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ - -#!start included /usr/share/perl/5.14/ExtUtils/MANIFEST.SKIP -# Avoid version control files. -\bRCS\b -\bCVS\b -\bSCCS\b -,v$ -\B\.svn\b -\B\.git\b -\B\.gitignore\b -\b_darcs\b -\B\.cvsignore$ -\B\.hg\b - -# Avoid VMS specific MakeMaker generated files -\bDescrip.MMS$ -\bDESCRIP.MMS$ -\bdescrip.mms$ - -# Avoid Makemaker generated and utility files. -\bMANIFEST\.bak -\bMakefile$ -\bblib/ -\bMakeMaker-\d -\bpm_to_blib\.ts$ -\bpm_to_blib$ -\bblibdirs\.ts$ # 6.18 through 6.25 generated this - -# Avoid Module::Build generated and utility files. -\bBuild$ -\b_build/ -\bBuild.bat$ -\bBuild.COM$ -\bBUILD.COM$ -\bbuild.com$ - -# Avoid temp and backup files. -~$ -\.old$ -\#$ -\b\.# -\.bak$ -\.tmp$ -\.# -\.rej$ - -# Avoid OS-specific files/dirs -# Mac OSX metadata -\B\.DS_Store -# Mac OSX SMB mount metadata files -\B\._ - -# Avoid Devel::Cover and Devel::CoverX::Covered files. -\bcover_db\b -\bcovered\b - -# Avoid MYMETA files -^MYMETA\. -#!end included /usr/share/perl/5.14/ExtUtils/MANIFEST.SKIP - -# Avoid configuration metadata file -^MYMETA\. - -# Avoid Module::Build generated and utility files. -\bBuild$ -\bBuild.bat$ -\b_build -\bBuild.COM$ -\bBUILD.COM$ -\bbuild.com$ -^MANIFEST\.SKIP - -# Avoid archives of this distribution -\bread-httpd-conf-[\d\.\_]+ diff -r eb152cd8d2bc -r 705353a1d274 README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Wed Sep 14 21:15:07 2016 +0200 @@ -0,0 +1,1 @@ +Moved to git://git.schlittermann.de/apache-read-config diff -r eb152cd8d2bc -r 705353a1d274 bin/read-httpd-conf --- a/bin/read-httpd-conf Mon Jan 12 15:08:08 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -#!/usr/bin/perl -#line 3 -use 5.010; -use strict; -use warnings; -use App::read_httpd_conf; -use Pod::Usage; - -pod2usage if not @ARGV; -exit App::read_httpd_conf->main(@ARGV); - -1; - -__END__ - -=head1 NAME - - read-httpd-conf - -=head1 SYNOPSIS - - read-httpd-conf file - -=head1 DESCRIPTION - -This small tool reads the apache config file and obeyes all the includes. You may -then parse the output. - -=head1 OPTIONS - -None so far. - -=cut diff -r eb152cd8d2bc -r 705353a1d274 lib/App/read_httpd_conf.pm --- a/lib/App/read_httpd_conf.pm Mon Jan 12 15:08:08 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -package App::read_httpd_conf; - -use 5.010; -use strict; -use warnings; -use Carp; -use File::Basename; -use Pod::Usage; - -our $VERSION = '0.1'; - -sub main { - shift if $_[0] eq __PACKAGE__; - return read_file(@_) ? 0 : 1; -} - -sub read_file { - my ($file, $basedir) = @_; - $file =~ s{/+}{/}g; - $basedir //= dirname $file; - open(my $fh, '<', $file) - or croak "Can't open $file: $!\n"; - say "# 1 $file"; - while (<$fh>) { - if (s{\\$}{}) { - chomp; - $_ .= <$fh>; - redo; - } - if (/^\s*include(?:optional)?\s+(?["'])?(?.*?)\k?\s*$/i) { - my $include_file = substr($+{file}, 0, 1) eq '/' ? $+{file} : "$basedir/$+{file}"; - say "# $. $file INCLUDE $include_file"; - read_file($_, $basedir) foreach (glob -d $include_file ? "$include_file/*" : $include_file); - next; - } - - print; - } - return 1; -} - -1; - -__END__ - -=head1 NAME - - App::read_httpd_conf - -=head1 SYNOPSIS - - use App::read_httpd_conf; - App::read_httpd_conf->main($file); - -=head1 DESCRIPTION - -This small package reads the apache config file and writes the parsed -and included files to the standard file descriptor. If you want to proceess -the output in your own script, do something like this: - - my $output; - open(my $fh, '>', \$output); - my $oldfh = select($fh); - App::read_httpd_conf->read_file($config)); - select($oldfh); - -=head1 AUTHOR - -Heiko Schlittermann L - -=cut diff -r eb152cd8d2bc -r 705353a1d274 t/00-basic.t --- a/t/00-basic.t Mon Jan 12 15:08:08 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -use Test::More; - -use_ok 'App::read_httpd_conf' or BAIL_OUT 'Fatal errors.'; -can_ok 'App::read_httpd_conf', qw(main) or BAIL_OUT 'Fatal errors';; - - -done_testing;