Skip Menu |

This queue is for tickets about the Template-Toolkit CPAN distribution.

Report information
The Basics
Id: 39788
Status: resolved
Worked: 20 min
Priority: 0/
Queue: Template-Toolkit

People
Owner: Nobody in particular
Requestors: tokuhirom+cpan [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.20
Fixed in: (no value)



Subject: TT 2.20's --accept option has different behaviour with 2.19
I'm using "ttree --recurse --accept=\.html$" with TT 2.19. but, that command doesn't works with TT 2.20 because, ttree in TT 2.20 matches --accept option with directory. /usr/local/bin/ttree -v --all --recurse -s /home/tokuhirom/project/perl- users.jp/ttroot -d /home/tokuhirom/project/perl-users.jp/html -- accept=\.html$ ttree 2.9 (Template Toolkit version 2.20) Source: /home/tokuhirom/project/perl-users.jp/ttroot Destination: /home/tokuhirom/project/perl-users.jp/html Include Path: [ ] Ignore: [ \b(CVS|RCS)\b, ^# ] Copy: [ \.png$, \.gif$ ] Accept: [ \.html$ ] Suffix: [ ] - expert_perl (not accepted) + nowpast.html - favicon.ico (not accepted) + index.html - moose_design_pattern (not accepted) - dont (not accepted) + books.html - acotie (not accepted) - modern_introduction_perl (not accepted) - modules (not accepted) - header.tt (not accepted) + keywords.html - footer.tt (not accepted) - mobile (not accepted) + use_case.html - wrapper.tt (not accepted) + whoswho.html
+1
Here's my patch. Is not fully tested but solves my setup.
From ecc35da0f56619de8e2361bfeddec2f713b86574 Mon Sep 17 00:00:00 2001 From: Hugo Salgado <huguei@cpan.org> Date: Wed, 18 Feb 2009 16:53:11 -0300 Subject: [PATCH] Unofficial patch to Template module, bug #39788 --- bin/ttree | 27 +++++++++++++++++++-------- 1 files changed, 19 insertions(+), 8 deletions(-) diff --git a/bin/ttree b/bin/ttree index 73bb3a4..c430e4b 100755 --- a/bin/ttree +++ b/bin/ttree @@ -253,14 +253,12 @@ sub process_tree { } } - # check against acceptance list - if (@$accept) { - unless (grep { $path =~ /$_/ } @$accept) { - printf " - %-32s (not accepted)\n", $path - if $verbose; - next FILE; - } - } + # This is an UNOFFICIAL patch to the bug reported here: + # http://rt.cpan.org/Public/Bug/Display.html?id=39788 + # Author: huguei@cpan.org + # + # moving acceptance check inside process_file + # to be able to recurse directories !! if (-d $abspath) { if ($recurse) { @@ -378,6 +376,19 @@ sub process_file { return; } + # This is an UNOFFICIAL patch to the bug reported here: + # http://rt.cpan.org/Public/Bug/Display.html?id=39788 + # Author: huguei@cpan.org + # + # Now we check against acceptance list, just before processing + if (@$accept) { + unless (grep { $file =~ /$_/ } @$accept) { + printf " - %-32s (not accepted)\n", $file + if $verbose; + return; + } + } + if ($verbose) { printf(" + %-32s", $file); print " (changed suffix to $new_suffix)" if $new_suffix; -- 1.6.0.6
+1 The above patch works for me.
I believe this has been fixed in 2.21. The accept check has an additional test to handle recursing into directories. if (@$accept) { unless ((-d $abspath && $recurse) || grep { $path =~ /$_/ } @$accept) { printf yellow(" - %-32s (not accepted)\n"), $path if $verbose > 1; $n_skip++; next FILE; } } Please re-open this bug if it doesn't do what you want.