File Coverage

lib/App/Followme/FolderData.pm
Criterion Covered Total %
statement 282 283 99.6
branch 66 76 86.8
condition 20 28 71.4
subroutine 51 51 100.0
pod 2 43 4.6
total 421 481 87.5


line stmt bran cond sub pod time code
1             package App::Followme::FolderData;
2              
3 19     19   1027 use 5.008005;
  19         79  
4 19     19   116 use strict;
  19         37  
  19         424  
5 19     19   104 use warnings;
  19         45  
  19         562  
6 19     19   122 use integer;
  19         48  
  19         102  
7 19     19   560 use lib '../..';
  19         37  
  19         118  
8              
9 19     19   2491 use File::Spec::Functions qw(abs2rel catfile rel2abs splitdir);
  19         35  
  19         1269  
10              
11 19     19   150 use base qw(App::Followme::BaseData);
  19         45  
  19         8679  
12 19     19   147 use App::Followme::FIO;
  19         59  
  19         71519  
13              
14             our $VERSION = "2.03";
15              
16             #----------------------------------------------------------------------
17             # Read the default parameter values
18              
19             sub parameters {
20 368     368 1 668 my ($self) = @_;
21              
22             return (
23 368         2360 extension => '',
24             site_url => '',
25             remote_url => '',
26             author => '',
27             size_format => 'kb',
28             date_format => 'Mon d, yyyy h:mm',
29             exclude_index => 0,
30             exclude => '',
31             exclude_dirs => '.*,_*',
32             web_extension => 'html',
33             );
34             }
35              
36             #----------------------------------------------------------------------
37             # Return the author's name stored in the configuration file
38              
39             sub calculate_author {
40 14     14 0 803 my ($self, $filename) = @_;
41 14         43 return $self->{author};
42             }
43              
44             #----------------------------------------------------------------------
45             # Calculate the creation date from the modification date
46              
47             sub calculate_date {
48 5     5 0 801 my ($self, $filename) = @_;
49 5         17 return $self->get_mdate($filename);
50             }
51              
52             #----------------------------------------------------------------------
53             # Get the list of keywords from the file path
54              
55             sub calculate_keywords {
56 10     10 0 809 my ($self, $filename) = @_;
57 10         28 $filename = $self->dir_to_filename($filename);
58              
59 10         50 $filename = abs2rel($filename);
60 10         826 my @path = splitdir($filename);
61 10         61 pop(@path);
62              
63 10   100     49 my $keywords = pop(@path) || '';
64 10         31 return $keywords;
65             }
66              
67             #----------------------------------------------------------------------
68             # Calculate the title from the filename root
69              
70             sub calculate_title {
71 35     35 0 925 my ($self, $filename) = @_;
72 35         147 $filename = $self->dir_to_filename($filename);
73              
74 35         143 my ($dir, $file) = fio_split_filename($filename);
75 35         131 my ($root, $ext) = split(/\./, $file);
76              
77 35 100       106 if ($root eq 'index') {
78 12         36 my @dirs = splitdir($dir);
79 12   50     90 $root = pop(@dirs) || '';
80             }
81              
82 35 50       184 $root =~ s/^\d+// unless $root =~ /^\d+$/;
83 35         115 my @words = map {ucfirst $_} split(/[\-\_]/, $root);
  35         149  
84              
85 35         151 return join(' ', @words);
86             }
87              
88             #----------------------------------------------------------------------
89             # Check that filename is defined, die if not
90              
91             sub check_filename {
92 597     597 0 1273 my ($self, $name, $filename) = @_;
93              
94 597 50       1257 die "Cannot use \$$name outside of loop" unless defined $filename;
95 597         1182 return;
96             }
97              
98             #-----------------------------------------------------------------------
99             # Get the name of the web file a file will be converted to
100              
101             sub convert_filename {
102 12     12 0 38 my ($self, $filename) = @_;
103              
104 12         180 $filename =~ s/\.[^\.]*$/.$self->{web_extension}/;
105 12         49 return $filename;
106             }
107              
108             #-----------------------------------------------------------------------
109             # Get the name of the source directory for ConvertPage
110              
111             sub convert_source_directory {
112 9     9 0 28 my ($self, $directory) = @_;
113              
114             # Defaults to same as output directory
115 9         27 return $directory;
116             }
117              
118             #----------------------------------------------------------------------
119             # Get a filename if the directory happens to be a directory
120              
121             sub dir_to_filename {
122 220     220 0 2211 my ($self, $directory) = @_;
123              
124 220         334 my $filename;
125 220 100       3452 if (-d $directory) {
126 13         83 my $index = 'index.' . $self->{web_extension};
127 13         92 $filename = catfile($directory, $index);
128             } else {
129 207         579 $filename = $directory;
130             }
131              
132 220         602 return $filename;
133             }
134              
135             #----------------------------------------------------------------------
136             # Fetch data from all its possible sources
137              
138             sub fetch_data {
139 39     39 0 103 my ($self, $name, $filename, $loop) = @_;
140              
141             # Look under both sets of functions
142              
143 39         123 $self->check_filename($name, $filename);
144 39         118 my %data = $self->gather_data('get', $name, $filename, $loop);
145              
146             %data = (%data, $self->gather_data('calculate', $name, $filename, $loop))
147 39 100       125 unless exists $data{$name};
148              
149 39         116 return %data;
150             }
151              
152             #----------------------------------------------------------------------
153             # Convert filename to url
154              
155             sub filename_to_url {
156 103     103 0 287 my ($self, $directory, $filename, $ext) = @_;
157              
158 103         218 $filename = $self->dir_to_filename($filename);
159              
160 103         376 $filename = rel2abs($filename);
161 103         1409 $filename = abs2rel($filename, $directory);
162              
163 103 50       5859 my @path = $filename eq '.' ? () : splitdir($filename);
164              
165 103         573 my $url = join('/', @path);
166 103 100       689 $url =~ s/\.[^\.]*$/.$ext/ if defined $ext;
167              
168 103         431 return $url;
169             }
170              
171             #----------------------------------------------------------------------
172             # Find the filename at an offset to the current filename
173              
174             sub find_filename {
175 10     10 0 20 my ($self, $offset, $filename, $loop) = @_;
176 10 50       22 die "Can't use \$url_* outside of for\n" unless $loop;
177              
178 10         14 my $match = -999;
179 10         25 foreach my $i (0 .. @$loop) {
180 30 100       57 if ($loop->[$i] eq $filename) {
181 10         13 $match = $i;
182 10         18 last;
183             }
184             }
185              
186 10         13 my $index = $match + $offset;
187 10 100 100     36 if ($index < 0 || $index > @$loop-1) {
188 2         3 $filename = '';
189             } else {
190 8         13 $filename = $loop->[$index];
191             }
192              
193 10         20 return $filename;
194             }
195              
196             #----------------------------------------------------------------------
197             # Build a recursive list of directories with a breadth first search
198              
199             sub find_matching_directories {
200 37     37 0 95 my ($self, $directory) = @_;
201              
202 37         105 my ($filenames, $subdirectories) = fio_visit($directory);
203              
204 37         805 my @directories;
205 37         113 foreach my $subdirectory (@$subdirectories) {
206 14 50       48 next unless $self->match_directory($subdirectory);
207 14         42 push(@directories, $subdirectory);
208             }
209              
210 37         68 foreach my $subdirectory (@directories) {
211 14         53 push(@directories, $self->find_matching_directories($subdirectory));
212             }
213              
214 37         143 return @directories;
215             }
216              
217             #----------------------------------------------------------------------
218             # Build a list of matching files in a folder
219              
220             sub find_matching_files {
221 84     84 0 193 my ($self, $folder) = @_;
222              
223 84         247 my ($filenames, $folders) = fio_visit($folder);
224              
225 84         1832 my @files;
226 84         262 foreach my $filename (@$filenames) {
227 360 100       936 push(@files, $filename) if $self->match_file($filename);
228             }
229              
230 84         354 return @files;
231             }
232              
233             #----------------------------------------------------------------------
234             # Find the newest file in a set of files
235              
236             sub find_newest_file {
237 18     18 0 52 my ($self, @files) = @_;
238              
239 18         43 my ($newest_file, $newest_date);
240 18   100     91 while (@files && ! defined $newest_file) {
241 15         45 $newest_file = shift(@files);
242 15 100       66 $newest_date =fio_get_date($newest_file) if defined $newest_file;
243             }
244              
245 18         51 foreach my $file (@files) {
246 22 50 33     301 next unless defined $file && -e $file;
247              
248 22         85 my $date = fio_get_date($file);
249 22 100       66 if ($date > $newest_date) {
250 15         25 $newest_date = $date;
251 15         30 $newest_file = $file;
252             }
253             }
254              
255 18         49 return $newest_file;
256             }
257              
258             #----------------------------------------------------------------------
259             # Get the more recently changed files
260              
261             sub find_top_files {
262 17     17 0 71 my ($self, $folder, $augmented_files) = @_;
263              
264 17         47 my @files = $self->find_matching_files($folder);
265 17         127 my @sorted_files = $self->sort_with_field(\@files, 'mdate', 1);
266              
267 17         86 return $self->merge_augmented($augmented_files, \@sorted_files);
268             }
269              
270             #----------------------------------------------------------------------
271             # Format the file creation date
272              
273             sub format_date {
274 47     47 0 1033 my ($self, $sorted_order, $date) = @_;
275              
276 47 100       111 if ($sorted_order) {
277 1         4 $date = fio_format_date($date);
278             } else {
279 46         150 $date = fio_format_date($date, $self->{date_format});
280             }
281              
282 47         169 return $date;
283             }
284              
285             #----------------------------------------------------------------------
286             # Format the file modification date
287              
288             sub format_mdate {
289 94     94 0 196 my ($self, $sorted_order, $date) = @_;
290 94         246 return fio_format_date($date);
291             }
292              
293             #----------------------------------------------------------------------
294             # Make filenames sortable in a cross-os manner
295              
296             sub format_name {
297 134     134 0 278 my ($self, $sorted_order, $filename) = @_;
298              
299 134 50       453 $filename = join(' ', fio_split_filename($filename)) if $sorted_order;
300 134         632 return $filename;
301             }
302              
303             #----------------------------------------------------------------------
304             # Format the file size
305              
306             sub format_size {
307 2     2 0 1629 my ($self, $sorted_order, $size) = @_;
308              
309 2 100       5 if ($sorted_order) {
310 1         5 $size = sprintf("%012d", $size);
311              
312             } else {
313 1 50       4 if ($self->{size_format}) {
314 1         3 my $byte_size = $size;
315 1         2 my $fmt = lc($self->{size_format});
316              
317 1         3 foreach my $format (qw(b kb mb gb)) {
318 2 100       5 if ($fmt eq $format) {
319 1         2 undef $fmt;
320 1         2 last;
321             }
322 1         3 $byte_size /= 1024;
323             }
324              
325             $size = join('', int($byte_size), $self->{size_format})
326 1 50       5 unless $fmt;
327             }
328             }
329              
330 2         7 return $size;
331             }
332              
333             #----------------------------------------------------------------------
334             # Get the absolute url from a filename and the site url
335              
336             sub get_absolute_url {
337 1     1 0 764 my ($self, $filename) = @_;
338 1         4 $filename = $self->dir_to_filename($filename);
339              
340 1         4 my $site_url = $self->get_site_url($filename);
341 1         3 my $relative_url = $self->get_url($filename);
342 1         3 my $absolute_url = "$site_url/$relative_url";
343              
344 1         5 return $absolute_url;
345             }
346              
347             #----------------------------------------------------------------------
348             # Get a list of matching files in a folder and its subfolders
349              
350             sub get_all_files {
351 2     2 0 896 my ($self, $filename) = @_;
352              
353 2         7 my ($folder) = fio_split_filename($filename);
354 2         9 my @files = $self->find_matching_files($folder);
355              
356 2         11 my @folders = $self->find_matching_directories($folder);
357 2         5 foreach my $subfolder (@folders) {
358 1         3 push(@files, $self->find_matching_files($subfolder));
359             }
360              
361 2         8 return \@files;
362             }
363              
364             #----------------------------------------------------------------------
365             # Get a list of breadcrumb filenames
366              
367             sub get_breadcrumbs {
368 1     1 0 800 my ($self, $filename) = @_;
369              
370 1         5 my @path = splitdir(abs2rel($filename, $self->{top_directory}));
371 1         63 pop(@path);
372              
373 1         2 my @breadcrumbs;
374 1         4 for (;;) {
375             my $dir = @path ? catfile($self->{top_directory}, @path)
376 2 100       10 : $self->{top_directory};
377              
378 2         6 my $breadcrumb = $self->dir_to_filename($dir);
379 2         4 push (@breadcrumbs, $breadcrumb);
380              
381 2 100       6 last unless @path;
382 1         3 pop(@path);
383             }
384              
385 1         4 @breadcrumbs = reverse(@breadcrumbs);
386 1         4 return \@breadcrumbs;
387             }
388              
389             #----------------------------------------------------------------------
390             # Get the extension from a filename
391              
392             sub get_extension {
393 2     2 0 764 my ($self, $filename) = @_;
394              
395 2         7 my ($folder, $file) = fio_split_filename($filename);
396 2         14 my ($extension) = ($file =~ /\.([^\.]*)$/);
397              
398 2         10 return $extension;
399             }
400              
401              
402             #----------------------------------------------------------------------
403             # Get a list of matching files in a folder
404              
405             sub get_files {
406 47     47 0 598 my ($self, $filename) = @_;
407              
408 47         157 my ($folder) = fio_split_filename($filename);
409 47         231 my @files = $self->find_matching_files($folder);
410 47         171 return \@files;
411             }
412              
413             #-----------------------------------------------------------------------
414             # Get a list of matching directories
415              
416             sub get_folders {
417 45     45 0 796 my ($self, $filename) = @_;
418              
419 45         152 my ($folder) = fio_split_filename($filename);
420 45         198 my ($filenames, $subfolders) = fio_visit($folder);
421              
422 45         973 my @folders;
423 45         130 foreach my $subfolder (@$subfolders) {
424 25 100       112 next unless $self->match_directory($subfolder);
425 21         57 push(@folders, $subfolder);
426             }
427              
428 45         221 return \@folders;
429             }
430              
431             #-----------------------------------------------------------------------
432             # Get the url of the index page in the same folder as a file
433              
434             sub get_index_url {
435 7     7 0 776 my ($self, $filename) = @_;
436              
437 7         21 my ($dir, $file) = fio_split_filename($filename);
438 7         21 my $index_page = "index.$self->{web_extension}";
439 7         31 $index_page = catfile($dir, $index_page);
440              
441 7         28 return $self->get_url($index_page);
442             }
443              
444             #----------------------------------------------------------------------
445             # Set a flag indicating if the the filename is the index file
446              
447             sub get_is_index {
448 2     2 0 1589 my ($self, $filename) = @_;
449              
450 2         7 my ($folder, $file) = fio_split_filename($filename);
451 2         7 my ($root, $ext) = split(/\./, $file);
452              
453 2   66     12 my $is_index = $root eq 'index' && $ext eq $self->{web_extension};
454 2 100       8 return $is_index ? 1 : 0;
455             }
456              
457             #----------------------------------------------------------------------
458             # Get the modification time in epoch seconds
459              
460             sub get_mdate {
461 99     99 0 227 my ($self, $filename) = @_;
462              
463 99         271 return fio_get_date($filename);
464             }
465              
466             #----------------------------------------------------------------------
467             # Get the most recently modified file in a folder and its subfolders
468              
469             sub get_newest_file {
470 13     13 0 785 my ($self, $filename) = @_;
471              
472 13         45 my ($folder) = fio_split_filename($filename);
473 13         65 my @files = $self->find_matching_files($folder);
474              
475 13         76 my $newest_file = $self->find_newest_file(@files);
476 13         63 my @folders = $self->find_matching_directories($folder);
477              
478 13         32 foreach my $subfolder (@folders) {
479 5         16 @files = $self->find_matching_files($subfolder);
480 5         23 $newest_file = $self->find_newest_file($newest_file, @files);
481             }
482              
483 13 100       81 return defined $newest_file ? [$newest_file] : [];
484             }
485              
486             #----------------------------------------------------------------------
487             # Get a list of files with the same rootname as another filename
488              
489             sub get_related_files {
490 1     1 0 726 my ($self, $filename) = @_;
491 1         4 my ($folder, $file) = fio_split_filename($filename);
492              
493 1         3 my $root;
494 1         9 ($root = $file) =~ s/\.[^\.]*$//;
495              
496 1         2 my @related_files;
497 1         4 my ($filenames, $folders) = fio_visit($folder);
498 1         22 foreach my $filename (@$filenames) {
499 10         22 my ($folder, $file) = fio_split_filename($filename);
500              
501 10         19 my $rootname;
502 10         45 ($rootname = $file) =~ s/\.[^\.]*$//;
503 10 100       28 push(@related_files, $filename) if $root eq $rootname;
504             }
505              
506 1         5 return \@related_files;
507             }
508              
509             #----------------------------------------------------------------------
510             # Get the remote url from a filename and the remote url
511              
512             sub get_remote_url {
513 29     29 0 852 my ($self, $filename) = @_;
514              
515 29         42 my $remote_url;
516 29 50       63 if ($self->{remote_url}) {
517 29         75 my $relative_url = $self->get_url($filename);
518 29         90 $remote_url = "$self->{remote_url}/$relative_url";
519              
520             } else {
521 0         0 $remote_url = $self->get_absolute_url($filename);
522             }
523              
524 29         87 return $remote_url;
525             }
526              
527             #----------------------------------------------------------------------
528             # get the site url
529              
530             sub get_site_url {
531 35     35 0 836 my ($self, $filename) = @_;
532              
533 35         58 my $site_url ;
534 35 100       96 if ($self->{site_url}) {
535 18         30 $site_url = $self->{site_url};
536              
537             } else {
538 17         46 $site_url = 'file://' . $self->{top_directory};
539             }
540              
541 35         75 $site_url =~ s/\/$//;
542 35         89 return $site_url;
543             }
544              
545             #----------------------------------------------------------------------
546             # Get the file size
547              
548             sub get_size {
549 1     1 0 9 my ($self, $filename) = @_;
550              
551 1         4 return fio_get_size($filename);
552             }
553              
554             #----------------------------------------------------------------------
555             # Get a list of matching files in a directory and its subdirectories
556              
557             sub get_top_files {
558 9     9 0 757 my ($self, $filename) = @_;
559              
560 9         23 my $augmented_files = [];
561 9         29 my ($folder) = fio_split_filename($filename);
562 9         76 $augmented_files = $self->find_top_files($folder, $augmented_files);
563              
564 9         35 my @directories = $self->find_matching_directories($folder);
565              
566 9         42 foreach my $subfolder (@directories) {
567 8         23 $augmented_files = $self->find_top_files($subfolder,
568             $augmented_files);
569             }
570              
571 9         59 my @top_files = $self->strip_augmented(@$augmented_files);
572 9         35 return \@top_files;
573             }
574              
575             #----------------------------------------------------------------------
576             # Get a url from a filename
577              
578             sub get_url {
579 66     66 0 2799 my ($self, $filename) = @_;
580 66         162 $filename = $self->dir_to_filename($filename);
581              
582             return $self->filename_to_url($self->{top_directory},
583             $filename,
584 66         310 $self->{web_extension});
585             }
586              
587             #----------------------------------------------------------------------
588             # Get a url with no extension from a filename
589              
590             sub get_url_base {
591 1     1 0 740 my ($self, $filename) = @_;
592 1         4 $filename = $self->dir_to_filename($filename);
593              
594             my $url_base = $self->filename_to_url($self->{top_directory},
595 1         4 $filename, '');
596 1         3 chop($url_base); # remove trailing dot
597 1         3 return $url_base;
598             }
599              
600             #----------------------------------------------------------------------
601             # Get a url from the next filename in the loop
602              
603             sub get_url_next {
604 5     5 0 25 my ($self, $filename, $loop) = @_;
605              
606 5         13 $filename = $self->find_filename(1, $filename, $loop);
607 5 100       13 return $filename ? $self->get_url($filename) : '';
608             }
609              
610             #----------------------------------------------------------------------
611             # Get a url from the previous filename in the loop
612              
613             sub get_url_previous {
614 5     5 0 22 my ($self, $filename, $loop) = @_;
615              
616 5         10 $filename = $self->find_filename(-1, $filename, $loop);
617 5 100       14 return $filename ? $self->get_url($filename) : '';
618             }
619              
620             #----------------------------------------------------------------------
621             # Return true if this is an included directory
622              
623             sub match_directory {
624 39     39 0 82 my ($self, $directory) = @_;
625              
626 39   66     176 $self->{exclude_dir_patterns} ||= fio_glob_patterns($self->{exclude_dirs});
627              
628 39 100       110 return if $self->match_patterns($directory, $self->{exclude_dir_patterns});
629 35         135 return 1;
630             }
631              
632             #----------------------------------------------------------------------
633             # Return true if this is an included file
634              
635             sub match_file {
636 407     407 0 767 my ($self, $filename) = @_;
637              
638 407         952 my ($dir, $file) = fio_split_filename($filename);
639              
640 407 100       1232 if ($self->{exclude_index}) {
641 122         289 my $index_file = join('.', 'index', $self->{web_extension});
642 122 100       374 return if $file eq $index_file;
643             }
644              
645 370         1200 my @patterns = map {"*.$_"} split(/\s*,\s*/, $self->{extension});
  426         1235  
646 370         820 my $patterns = join(',', @patterns);
647              
648 370   66     1083 $self->{include_file_patterns} ||= fio_glob_patterns($patterns);
649 370   66     955 $self->{exclude_file_patterns} ||= fio_glob_patterns($self->{exclude});
650              
651 370 100       1073 return if $self->match_patterns($file, $self->{exclude_file_patterns});
652 361 100       1599 return unless $self->match_patterns($file, $self->{include_file_patterns});
653 221         859 return 1;
654             }
655              
656             #----------------------------------------------------------------------
657             # Return true if filename matches pattern
658              
659             sub match_patterns {
660 779     779 0 1449 my ($self, $file, $patterns) = @_;
661              
662 779         1546 my @path = splitdir($file);
663 779         3249 $file = pop(@path);
664              
665 779         1474 foreach my $pattern (@$patterns) {
666 479 100       3887 return 1 if $file =~ /$pattern/;
667             }
668              
669 545         1524 return;
670             }
671              
672             #----------------------------------------------------------------------
673             # Initialize the configuration parameters
674              
675             sub setup {
676 92     92 1 205 my ($self) = @_;
677              
678             # Set filename extension if unset
679 92   66     589 $self->{extension} ||= $self->{web_extension};
680              
681             # Remove any trailing slash from urls
682 92         183 foreach my $url (qw(remote_url site_url)) {
683 184 100       444 next unless $self->{$url};
684 23         53 $self->{$url} =~ s/\/$//;
685             }
686              
687 92         197 return;
688             }
689              
690             1;
691              
692             =pod
693              
694             =encoding utf-8
695              
696             =head1 NAME
697              
698             App::Followme::FolderData - Build metadata from folder information
699              
700             =head1 SYNOPSIS
701              
702             use Cwd;
703             use App::Followme::FolderData;
704             my $directory = getcwd();
705             my $data = App::Followme::FolderData->new();
706             my $filenames = $data->get_files($directory);
707             foreach my $filename (@$filenames) {
708             print "$filename\n";
709             }
710              
711             =head1 DESCRIPTION
712              
713             This module contains the methods that build metadata values that can be computed
714             from properties of the file system, that is, without opening a file or
715             without regard to the type of file. It serves as the base of all the metadata
716             classes that build metadata for specific file types.
717              
718             =head1 METHODS
719              
720             All data are accessed through the build method.
721              
722             =over 4
723              
724             =item my %data = $obj->build($name, $filename);
725              
726             Build a variable's value. The first argument is the name of the variable. The
727             second argument is the name of the file the metadata is being computed for. If
728             it is undefined, the filename in the object
729             is used.
730              
731             =back
732              
733             =head1 VARIABLES
734              
735             The folder metadata class can evaluate the following variables. When passing
736             a name to the build method, the sigil should not be used.
737              
738             =over 4
739              
740             =item @all_files
741              
742             A list of matching files in a directory and its subdirectories.
743              
744             =item @top_files
745              
746             A list of the most recently created files in a directory and its
747             subdirectory. The length of the list is determined by the
748             configuration parameter list_length.
749              
750             =item @breadcrumbs
751              
752             A list of breadcrumb filenames, which are the names of the index files
753             above the filename passed as the argument.
754              
755             =item @related_files
756              
757             A list of files with the same file root name as a specified file. This
758             list is not filtered by the configuration variables extension and exclude.
759              
760             =item @files
761              
762             A list of matching files in a directory.
763              
764             =item @folders
765              
766             A list of folders under the default folder that contain an index file.
767              
768             =item $author
769              
770             The name of the author of a file
771              
772             =item $absolute_url
773              
774             The absolute url of a web page from a filename.
775              
776             =item $date
777              
778             A date string built from the creation date of the file. The date is
779             built using the template in date_format which contains the fields:
780             C<weekday, month,day, year, hour, minute,> and C<second.>
781              
782             =item $mdate
783              
784             A date string built from the modification date of the file. The date is
785             built using the template in date_format which contains the fields:
786             C<weekday, month,day, year, hour, minute,> and C<second.>
787              
788             =item $is_current
789              
790             One if the filename matches the default filename, zero if it does not.
791              
792             =item $is_index
793              
794             One of the filename is an index file and zero if it is not.
795              
796             =item $keywords
797              
798             A list of keywords describing the file from the filename path.
799              
800             =item $remote_url
801              
802             The remote url of a web page from a filename.
803              
804             =item $site_url
805              
806             The url of the website. Does not have a trailing slash
807              
808             =item $index_url
809              
810             The url of the index page in the same folder as a file.
811              
812             =item $title
813              
814             The title of a file is derived from the file name by removing the filename
815             extension, removing any leading digits,replacing dashes with spaces, and
816             capitalizing the first character of each word.
817              
818             =item $url
819              
820             Build the relative url of a web page from a filename.
821              
822             =item $url_base
823              
824             Build the relative url of a filename minus any extension and trailing dot
825              
826             =item $extension
827              
828             The extension of a filename.
829              
830             =item $url_next
831              
832             Build the relative url of a web page from the next filename in the loop
833             sequence. Empty string if there is no next filename.
834              
835             =item $url_previous
836              
837             Build the relative url of a web page from the previous filename in the loop
838             sequence. Empty string if there is no previous filename.
839              
840             =back
841              
842             =head1 CONFIGURATION
843              
844             The following fields in the configuration file are used in this class and every
845             class based on it:
846              
847             =over 4
848              
849             =item filename
850              
851             The filename used to retrieve metatdata from if no filename is passed to the
852             build method.
853              
854             =item directory
855              
856             The directory used to retrieve metadata. This is used by list valued variables.
857              
858             =item extension
859              
860             A comma separated list of extensions of files to include in a list of files.
861             If it is left empty, it is set to the web extension.
862              
863             =item date_format
864              
865             The format used to produce date strings. The format is described in the
866             POD for Time::Format.
867              
868             =item remote_url
869              
870             The url of the remote website, e.g. http://www.cloudhost.com.
871              
872             =item site_url
873              
874             The url of the local website, e.g. http://www.example.com.
875              
876             =item sort_numeric
877              
878             If one, use numeric comparisons when sorting. If zero, use string comparisons
879             when sorting.
880              
881             =item exclude_index
882              
883             If the value of this variable is true (1) exclude the index page in the list
884             of files. If it is false (0) include the index page. The default value is 0.
885              
886             =item exclude
887              
888             The files to exclude when traversing the list of files. Leave as a zero length
889             string if there are no files to exclude.
890              
891             =item exclude_dirs
892              
893             The directories excluded while traversing the list of directories. The default
894             value of this parameter is '.*,_*',
895              
896             =item web_extension
897              
898             The extension used by web pages. This controls which files are returned. The
899             default value is 'html'.
900              
901             =back
902              
903             =head1 LICENSE
904              
905             Copyright (C) Bernie Simon.
906              
907             This library is free software; you can redistribute it and/or modify
908             it under the same terms as Perl itself.
909              
910             =head1 AUTHOR
911              
912             Bernie Simon E<lt>bernie.simon@gmail.comE<gt>
913              
914             =cut