Author: joes
Date: Sat Mar 22 02:27:36 2014
New Revision: 1580127

URL: http://svn.apache.org/r1580127
Log:
walk tree

Modified:
    thrift/cms-site/trunk/lib/path.pm

Modified: thrift/cms-site/trunk/lib/path.pm
URL: 
http://svn.apache.org/viewvc/thrift/cms-site/trunk/lib/path.pm?rev=1580127&r1=1580126&r2=1580127&view=diff
==============================================================================
--- thrift/cms-site/trunk/lib/path.pm (original)
+++ thrift/cms-site/trunk/lib/path.pm Sat Mar 22 02:27:36 2014
@@ -1,8 +1,6 @@
 package path;
-
+use ASF::Util qw/walk_content_tree/;
 use YAML::XS;
-use File::Find;
-use Cwd;
 use strict;
 use warnings;
 
@@ -33,22 +31,19 @@ our $runners = 1; # maximize page memoiz
 
 our %dependencies;
 
-my $cwd = cwd;
-find({ wanted => sub {
-           $File::Find::prune = 1, return if -d and m!\.page$!;
-           s!^\Q$cwd/content!!;
-           if (/\.md(?:text)?$/ or m!/index\.html$!) {
-               # basically grep s/^content//, glob "content/**/*.{md,mdtext}"
-               # if perl's glob was as smart as zsh's glob
-               push @{$dependencies{"/sitemap.html"}}, $_;
-           }
-           if (s!/index\.html$!!) {
-               $dependencies{"$_/index.html"} = [
-                   grep s/^content//, glob("content$_/*.{md,mdtext}"),
-                                      glob("content$_/*/index.html")
-               ];
-           }
-       }, no_chdir => 1 }, "$cwd/content");
+walk_content_tree {
+    if (/\.md(?:text)?$/ or m!/index\.html$!) {
+        # basically grep s/^content//, glob "content/**/*.{md,mdtext}"
+        # if perl's glob was as smart as zsh's glob
+        push @{$dependencies{"/sitemap.html"}}, $_;
+    }
+    if (s!/index\.html$!!) {
+        $dependencies{"$_/index.html"} = [
+            grep s/^content//, glob("content$_/*.{md,mdtext}"),
+            glob("content$_/*/index.html")
+            ];
+    }
+};
 
 1;
 


Reply via email to