Apache-Config-Preproc
view release on metacpan or search on metacpan
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
lib/Apache/Config/Preproc/locus.pm view on Meta::CPAN
if ($d->value =~ /^\"(.+)\"/) {
$self->context_push($1);
return 0;
}
} elsif ($d->name eq '$POP$') {
$self->context_pop();
return 0;
}
}
# Compute and attach a locus object.
$self->{line}++;
my $locus = new Text::Locus($self->filename, $self->{line});
if ($d->type eq 'section') {
$self->lpush($locus);
} elsif ($d->type eq 'directive') {
if ((my $nl = ($d->{raw}) =~ tr/\n//) > 1) {
my $l = $self->{line}+1;
$self->{line} += $nl-1;
$locus->add($self->filename, ($l..$self->{line}));
}
lib/Apache/Config/Preproc/locus.pm view on Meta::CPAN
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
=head1 SYNOPSIS
$x = new Apache::Config::Preproc '/path/to/httpd.conf',
-expand => [ qw(locus) ];
foreach ($x->select) {
print $_->locus
}
=head1 DESCRIPTION
B<Locus> attaches to each node in the parse tree a B<Text::Locus> object
which describes the location of the corresponding statement in the source
file. The location of a node can be accessed via the B<locus> method
as illustrated in the synopsis.
Technically speaking, this module replaces each instance of
B<Apache::Admin::Config::Tree> in the parse tree with an instance of its
derived class B<Apache::Config::Preproc::locus::node>, which provides the
B<locus> accessor.
=head1 SEE ALSO
( run in 0.559 second using v1.01-cache-2.11-cpan-e1769b4cff6 )