[Templates] ttree enhancement request
Bryce Harrington
bryce@osdl.org
Fri, 3 Oct 2003 16:33:30 -0700 (PDT)
On 3 Oct 2003, David Dyer-Bennet wrote:
> Bryce Harrington <bryce@osdl.org> writes:
>
> > On 3 Oct 2003, David Dyer-Bennet wrote:
> >
> > > There doesn't seem to be any way to set the ABSOLUTE or RELATIVE
> > > attributes when processing through ttree. It's good to have control
> > > over what kind of pathnames are allowed -- but the dangerous situation
> > > is when running via CGI or mod_perl, with untrusted user inputs; when
> > > running via ttree, it's a much more controlled environment, and I'd
> > > like to turn on more flexible path rules, but there isn't any way to.
> >
> > Maybe this'd do it for you...
>
> [patch snipped]
>
> That looks about right; although I believe it's not absolute *vs.*
> relative; it's turning on either or both of absolute and relative
> independently, and the alternative is paths descending only from
> things in the library directory list. I don't actually like having
> too many things in that list, since name duplications could be, um,
> too exciting.
Hmm, ok well the enclosed patch makes both configurable.
> Forgive me for not knowing the "power structure" around here -- is
> that patch or something like it likely to get into the development
> tree, or will any patch I apply for this be my own problem for all
> future versions?
No clue, I'm just a user like you.
Bryce
--- /usr/bin/ttree 2003-07-22 18:08:55.000000000 -0700
+++ ttree 2003-10-03 16:19:47.000000000 -0700
@@ -71,6 +71,8 @@
my $ignore = $config->ignore;
my $copy = $config->copy;
my $accept = $config->accept;
+my $absolute = $config->absolute;
+my $relative = $config->relative;
my $srcdir = $config->src
|| die "Source directory not set (-s)\n";
my $destdir = $config->dest
@@ -107,7 +109,8 @@
# now create complete parameter hash for creating template processor
my $ttopts = {
%$ucttopts,
- RELATIVE => 1,
+ RELATIVE => $relative,
+ ABSOLUTE => $absolute,
# INCLUDE_PATH => [ @$libdir, '.' ],
INCLUDE_PATH => [ $srcdir, @$libdir ],
OUTPUT_PATH => $destdir,
@@ -336,6 +339,8 @@
'preserve|p' => { DEFAULT => 0 },
'all|a' => { DEFAULT => 0 },
'debug|dbg' => { DEFAULT => 0 },
+ 'absolute' => { DEFAULT => 0 },
+ 'relative' => { DEFAULT => 0 },
'define=s%',
'ignore=s@',
'copy=s@',
@@ -419,6 +424,11 @@
# recurse into any sub-directories and process files (-r)
recurse
+# Turn on absolute paths
+#absolute
+
+# Turn on relative paths
+relative
#------------------------------------------------------------------------
# The 'cfg' option defines a directory in which other ttree configuration
@@ -622,6 +632,8 @@
For example:
interpolate
+ absolute
+ relative
post_chomp
pre_process = header
post_process = footer
@@ -653,4 +665,4 @@
=head1 SEE ALSO
-L<tpage|Template::Tools::tpage>
\ No newline at end of file
+L<tpage|Template::Tools::tpage>