Author: joes
Date: Tue Mar 18 13:46:17 2014
New Revision: 1578888

URL: http://svn.apache.org/r1578888
Log:
promote dir_wrapper to ASF::View

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

Modified: thrift/cms-site/trunk/lib/view.pm
URL: 
http://svn.apache.org/viewvc/thrift/cms-site/trunk/lib/view.pm?rev=1578888&r1=1578887&r2=1578888&view=diff
==============================================================================
--- thrift/cms-site/trunk/lib/view.pm (original)
+++ thrift/cms-site/trunk/lib/view.pm Tue Mar 18 13:46:17 2014
@@ -1,31 +1,4 @@
 package view;
 use base 'ASF::View';
-use ASF::Util qw/read_text_file parse_filename/;
-
-sub dir_wrapper {
-    my %args = @_;
-    # must end w/ trailing slash if passed as a 'dir' arg
-    my $dir = delete $args{dir} || (parse_filename $args{path})[1];
-    my @d;
-    opendir my $dh, "content$dir" or die "Can't opendir content$dir: $!";
-    for (grep $_ ne "." && $_ ne "..", readdir $dh) {
-        my $f = -d $_ ? (glob "$_/index.*")[0] : $_;
-        my $file = "$dir$f";
-        next if $file eq $args{path};
-        my ($filename) = parse_filename $f;
-        my $a;
-        for my $p (@path::patterns) {
-            my ($re, $method, $args) = @$p;
-            next unless $file =~ $re;
-            my $s = view->can($method) or die "Can't locate method: $method\n";
-            my ($content, $ext, $vars) = $s->(%args, path => $file);
-            $file = "$dir$filename.$ext";
-            $a = $vars;
-            last;
-        }
-        push @d, [ $file, $a->{headers}->{title} // $filename ];
-    }
-    return view->can($args{view})->(dir => [sort {lc $a->[1] cmp lc $b->[1]} 
@d], %args);
-}
 
 1;


Reply via email to