=back
+=head2 Directory Name Objects
+
+Package C<Local::DirName> provides a simple directory name object that
+stores an array of name components with automatic string conversion to a
+POSIX-style relative directory name.
+
+These objects are used as part of a "parse once" model and refer to
+directories within the managed file tree, relative to its base.
+
+=over
+
+=cut
+
+{
+ package Local::DirName;
+
+ use overload '""' => sub { File::Spec::Unix->catdir(@{(shift)}) };
+
+=item Local::DirName->new $arrayref
+
+=item Local::DirName->new $directory
+
+=item Local::DirName->new @directory
+
+Construct a directory name object. The arguments are any combination of
+arrayrefs of directory name elements, strings containing '/' delimiters,
+and directory name elements.
+
+=cut
+
+ sub new {
+ my $class = shift;
+
+ my @ob;
+
+ for (@_) {
+ if ('ARRAY' eq ref) { push @ob, @$_ }
+ elsif (m[/]) { push @ob, File::Spec::Unix->splitdir($_) }
+ else { push @ob, $_ }
+ }
+
+ bless \@ob, $class
+ }
+
+}
+
+\f
+
+=back
+
=head2 Exception Definitions and Utilities
=cut
next;
}
- $header{directory} = $val; # ok.
+ $header{directory} = Local::DirName->new(@dirs); # ok.
$header{package} = $dirs[0]; # top-level name, no subdir
} elsif ($tainted_cmd eq 'filename') {
# We use the same filename restrictions as scan_incoming