Apache-Config-Preproc
view release on metacpan or search on metacpan
lib/Apache/Config/Preproc.pm view on Meta::CPAN
install_preproc_default()
} elsif ($kw eq ':optimized') {
install_preproc_optimized()
} else {
croak "Unrecognized import parameter: $kw"
}
}
if (@_) {
croak "Too many import parameters";
}
$class->SUPER::import();
}
sub new {
my $class = shift;
my $file = shift;
my $explist = Apache::Admin::Config::Tree::_get_arg(\@_, '-expand')
|| [ qw(include) ];
my $self = $class->SUPER::new($file, @_) or return;
bless $self, $class;
$self->{_filename} = $file;
$self->{_options} = \@_;
eval {
$self->_preproc($explist);
};
if ($@) {
$Apache::Admin::Config::ERROR = $@;
return;
lib/Apache/Config/Preproc/ifdefine.pm view on Meta::CPAN
package Apache::Config::Preproc::ifdefine;
use parent 'Apache::Config::Preproc::Expand';
use strict;
use warnings;
use Carp;
our $VERSION = '1.03';
sub new {
my ($class, $conf) = @_;
my $self = $class->SUPER::new($conf);
@{$self->{D}}{@_} = (1) x @_;
return $self;
}
sub find_define {
my ($self,$elt,$id) = @_;
while (my $p = $elt->parent) {
if (grep {
(split /\s+/, $_->value)[0] eq $id
lib/Apache/Config/Preproc/ifmodule.pm view on Meta::CPAN
use strict;
use warnings;
use Carp;
use IPC::Open3;
our $VERSION = '1.03';
sub new {
my $class = shift;
my $conf = shift;
my $self = $class->SUPER::new($conf);
local %_ = @_;
my $v;
if ($v = delete $_{preloaded}) {
croak "preloaded must be an arrayref" unless ref($v) eq 'ARRAY';
@{$self->{preloaded}}{@$v} = @$v;
}
if ($v = delete $_{probe}) {
if (ref($v) eq 'ARRAY') {
$self->probe(@$v);
} else {
lib/Apache/Config/Preproc/include.pm view on Meta::CPAN
use File::Spec;
use Cwd 'abs_path';
use IPC::Open3;
use Carp;
our $VERSION = '1.03';
sub new {
my $class = shift;
my $conf = shift;
my $self = $class->SUPER::new($conf);
$self->{context} = [];
local %_ = @_;
$self->{server_root} = delete $_{server_root};
if (my $v = delete $_{probe}) {
if (ref($v) eq 'ARRAY') {
$self->probe(@$v);
} else {
$self->probe;
}
}
lib/Apache/Config/Preproc/locus.pm view on Meta::CPAN
package Apache::Config::Preproc::locus;
use parent 'Apache::Config::Preproc::Expand';
use strict;
use warnings;
use Text::Locus;
our $VERSION = '1.03';
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
$self->{filename} = $self->conf->filename;
$self->{line} = 0;
$self->{context} = [];
return $self;
}
sub filename { shift->{filename} }
sub context_push {
my ($self,$file) = @_;
lib/Apache/Config/Preproc/locus.pm view on Meta::CPAN
my ($class, $orig, $locus) = @_;
my $self = bless $orig->clone;
$self->{_locus} = $locus;
return $self;
}
sub locus { shift->{_locus} }
sub clone {
my ($self) = @_;
my $clone = bless $self->SUPER::clone;
$clone->{_locus} = $clone->{_locus}->clone();
return $clone;
}
1;
__END__
=head1 NAME
Apache::Config::Preproc::locus - attach file location to each parse node
lib/Apache/Config/Preproc/macro.pm view on Meta::CPAN
use strict;
use warnings;
use Text::ParseWords;
use Carp;
our $VERSION = '1.03';
sub new {
my $class = shift;
my $conf = shift;
my $self = $class->SUPER::new($conf);
$self->{keep} = {};
croak "bad number of arguments: @_" if @_ % 2;
local %_ = @_;
my $v;
if ($v = delete $_{keep}) {
if (ref($v)) {
croak "keep argument must be a scalar or listref"
unless ref($v) eq 'ARRAY';
} else {
$v = [$v];
t/TestPreproc.pm view on Meta::CPAN
use Carp;
use File::Basename;
use File::Temp;
use File::Spec;
use File::Path qw /make_path/;
use Cwd;
use autodie;
sub import {
my $class = shift;
$class->SUPER::import($ENV{APACHE_CONFIG_PREPROC});
}
sub new {
my $class = shift;
my $expect_fail;
if (@_ && $_[0] eq '-expect_fail') {
shift;
$expect_fail = 1;
}
my $dir = File::Temp->newdir('expXXXXXX');
t/TestPreproc.pm view on Meta::CPAN
open($fd, '>', \$text);
} elsif (/!\$\s*$/) {
close($fd) if $fd;
$fd = undef;
} elsif ($fd) {
s/\$server_root/$dir/;
print $fd $_;
}
}
close($fd) if $fd;
my $self = $class->SUPER::new($confname, @_);
if ($self) {
$self->{_expect} = $text;
$self->{_cwd} = getcwd;
} elsif (!$expect_fail) {
croak $Apache::Admin::Config::ERROR;
}
return $self;
}
sub dump_expect { shift->{_expect} }
( run in 1.095 second using v1.01-cache-2.11-cpan-49f99fa48dc )