App-FuguWeb

 view release on metacpan or  search on metacpan

lib/App/FuguWeb.pm  view on Meta::CPAN


	return $escaped;
}

# list_dir($dir):
#	The names in one directory, sorted, without '.' and '..'. The
#	function returns an array reference, or undef with the reason
#	in $!, so a caller can tell an empty directory from one it
#	cannot read.
#
#	The sort compares bytes and never reads the locale of the
#	builder: a site must not depend on the machine that built it.
sub list_dir ($dir)
{
	opendir my $dh, $dir or return;
	my @names = sort grep { $_ ne '.' && $_ ne '..' } readdir $dh;
	closedir $dh;

	return \@names;
}

lib/App/FuguWeb.pod  view on Meta::CPAN


=head2 list_dir

    my $names = App::FuguWeb::list_dir($dir) or die "cannot read: $!";

The names in one directory, sorted, without C<.> and C<..>. The
function returns an array reference, or C<undef> with the reason in
C<$!>, so a caller can tell an empty directory from one it cannot
read.

The sort compares bytes and never reads the locale of the builder: a
site must not depend on the machine that built it.

=head2 path_below

    App::FuguWeb::path_below($path, $root)

Report whether C<$path> is C<$root> or lies below it. A trailing slash
on either does not change the answer. Both paths must be of the same
kind: both absolute, or both relative to the same directory.

lib/App/FuguWeb/Config.pm  view on Meta::CPAN

	    $self->{kind} eq 'manuals'
	    ? [ $self->_mdoc_manuals ]
	    : [ $self->_pod_manuals ];

	return @{ $self->{manuals} };
}

# $self->_mdoc_manuals:
#	Every mdoc source in the directory, by section in the order 1,
#	3p, 5, 8, and then by file name. The sort compares bytes and
#	never reads the locale of the builder: a site must not depend
#	on the machine that built it.
#
#	The method reads the directory rather than globs it. Perl's
#	glob splits its pattern on whitespace and reads [ ] { } ? ~, so
#	a project whose path holds one of them would lose its manuals
#	or collect a sibling directory's. It also matches a directory,
#	and a directory named tool.1 is not a manual.
sub _mdoc_manuals ($self)
{
	my $names = App::FuguWeb::list_dir( $self->{dir} ) or return ();

lib/App/FuguWeb/Config.pod  view on Meta::CPAN

sibling directory's. It sorts by section, in the order 1, 3p, 5, 8, and
then by file name. The
C<namespace> setting prefixes the name and the staged file name, so
F<man/fugu/Daemon.3p> becomes C<Fugu::Daemon(3p)>.

A C<modules> group finds every F<.pod> file below its directory, and the
sidecar that names the directory itself: F<lib/App/FuguWeb.pod> is the
umbrella of F<lib/App/FuguWeb/>. It sorts by path, so F<Store.pod> stays
before F<Store/Memory.pod>.

Both sorts compare bytes and never read the locale of the builder. A
site must not depend on the machine that built it.

Never name a directory that holds more than one namespace. In this
repository F<lib/App> is such a directory, and one group there would
swallow three namespaces.

=head1 SEE ALSO

L<App::FuguWeb>, L<App::FuguWeb::Manual>, L<Fugu::Config>,
L<fuguweb(1)>



( run in 6.706 seconds using v1.01-cache-2.11-cpan-a5162978ef8 )