Skip Menu |

This queue is for tickets about the Pod-Webserver CPAN distribution.

Report information
The Basics
Id: 55106
Status: resolved
Worked: 2 hours (120 min)
Priority: 0/
Queue: Pod-Webserver

People
Owner: Nobody in particular
Requestors: COSMICNET [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 3.05
Fixed in: (no value)



Subject: Addition of folder search and exclusion options, plus fix for bug 44520
Hi Allison, This patch fixes the bug outlined in 44520 that I confirmed with Perl 5.10 on Win32 and Debian Linux. It also adds 2 new options. -d to ignore @INC and specify the library folder to search. -e to specify folders that should be ignored in the output. I added these so that Pod::Webserver could only return POD info for libraries in the actual project I was working on, as opposed to all installed libraries. If you are happy with the new features, but want more documentation, etc, just let me know and I'll make a new patch. Lyle
Subject: Webserver.pm.patch
--- Webserver_old.pm Mon Mar 01 14:54:55 2010 +++ Webserver.pm Mon Mar 01 15:17:00 2010 @@ -20,6 +20,7 @@ use Pod::Simple; use Carp (); use IO::Socket; +use File::Spec (); use File::Spec::Unix (); @ISA = ('Pod::Simple::HTMLBatch'); @@ -28,6 +29,8 @@ 'httpd_host', 'httpd_timeout', 'skip_indexing', + 'dir_search', + 'dir_exclude', ); httpd() unless caller; @@ -64,7 +67,7 @@ my %o; die "Aborting" unless - Getopt::Std::getopts( "p: H: q v h V" => \%o ) || die "Aborting\n"; + Getopt::Std::getopts( "p:H:d:e:qvhV" => \%o ) || die "Aborting\n"; # The three switches that shortcut the run: $o{'h'} and exit( $self->_arg_h || 0); @@ -75,6 +78,8 @@ $self->skip_indexing(1) if $o{'q'}; $self->httpd_host( $o{'H'} ) if $o{'H'}; $self->httpd_port( $o{'p'} ) if $o{'p'}; + $self->dir_search( [ map File::Spec->canonpath($_), split(/:|;/, $o{'d'}) ] ) if $o{'d'}; + $self->dir_exclude( [ map File::Spec->canonpath($_), split(/:|;/, $o{'e'}) ] ) if $o{'e'}; return; } @@ -86,6 +91,8 @@ " podwebserver = start podwebserver on localhost:8020", " podwebserver -p 1234 = start podwebserver on localhost:1234", " podwebserver -p 1234 -H blorp = start podwebserver on blorp:1234", + " podwebserver -d /path/to/lib = only search within /path/to/lib", + " podwebserver -e /path/to/skip = do not include /path/to/skip files", " podwebserver -q = quick startup (but no Table of Contents)", " podwebserver -v = run with verbose output to STDOUT", " podwebserver -h = see this message", @@ -219,16 +226,29 @@ } my $search = $Pod::Simple::HTMLBatch::SEARCH_CLASS->new; + my $dir_search = $self->dir_search; if(DEBUG > -1) { - print " Indexing all of \@INC -- this might take a minute.\n", - "\@INC = [ @INC ]\n"; + if ($self->dir_search) { + print " Indexing all of @$dir_search -- this might take a minute.\n"; + } + else { + print " Indexing all of \@INC -- this might take a minute.\n", + "\@INC = [ @INC ]\n"; + } $self->{'httpd_has_noted_inc_already'} ++; } - $m2p = $self->modnames2paths(); + $m2p = $self->modnames2paths($dir_search ? $dir_search : undef); $self->progress(0); + # Filter out excluded folders + while ( my ($key, $value) = each %$m2p ) { + print "ED $value, " . grep $value =~ /^\Q$_\E/, @{ $self->dir_exclude }; print "\n"; + delete $m2p->{$key} if grep $value =~ /^\Q$_\E/, @{ $self->dir_exclude }; + } + die "What, no name2path?!" unless $m2p and keys %$m2p; - DEBUG > -1 and print " Done scanning \@INC\n"; + DEBUG > -1 and print " Done scanning ", + $dir_search ? "@$dir_search" : '@INC', "\n"; foreach my $modname (sort keys %$m2p) { my @namelets = split '::', $modname;
Fix in V 3.06. V 3.07 is on CPAN. Thanx for the patches.