| 1 | package Apache::Pod; | ||||||||||
| 2 | |||||||||||
| 3 | =head1 NAME | ||||||||||
| 4 | |||||||||||
| 5 | Apache::Pod - base class for converting Pod files to prettier forms | ||||||||||
| 6 | |||||||||||
| 7 | =head1 VERSION | ||||||||||
| 8 | |||||||||||
| 9 | Version 0.22 | ||||||||||
| 10 | |||||||||||
| 11 | =cut | ||||||||||
| 12 | |||||||||||
| 13 | 3 | ▶ | use vars qw( $VERSION ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 3 | $VERSION = '0.22'; | |||||||||
| 17 | |||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||
| 19 | |||||||||||
| 20 | The Apache::Pod::* are mod_perl handlers to easily convert Pod to HTML | ||||||||||
| 21 | or other forms. You can also emulate F<perldoc>. | ||||||||||
| 22 | |||||||||||
| 23 | =head1 CONFIGURATION | ||||||||||
| 24 | |||||||||||
| 25 | All configuration is done in one of the subclasses. | ||||||||||
| 26 | |||||||||||
| 27 | =head1 TODO | ||||||||||
| 28 | |||||||||||
| 29 | I could envision a day when the user can specify which output format | ||||||||||
| 30 | he'd like from the URL, such as | ||||||||||
| 31 | |||||||||||
| 32 | http://your.server/perldoc/f/printf?rtf | ||||||||||
| 33 | |||||||||||
| 34 | =head1 FUNCTIONS | ||||||||||
| 35 | |||||||||||
| 36 | No functions are exported. I don't want to dink around with Exporter | ||||||||||
| 37 | in mod_perl if I don't need to. | ||||||||||
| 38 | |||||||||||
| 39 | =head2 getpodfile( I<$r> ) | ||||||||||
| 40 | |||||||||||
| 41 | Returns the filename requested off of the C<$r> request object, or what | ||||||||||
| 42 | Perldoc would find, based on Pod::Find. | ||||||||||
| 43 | |||||||||||
| 44 | =cut | ||||||||||
| 45 | |||||||||||
| 46 | 3 | ▶ | use Pod::Find; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 47 | |||||||||||
| 48 | 0 | ▶ | sub getpodfile { | ||||||||
|
Subroutine
getpodfile: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 49 | 0 | my $r = shift; | |||||||||
| 50 | |||||||||||
| 51 | 0 | my $filename; | |||||||||
| 52 | |||||||||||
| 53 | 0 | ▶ | if ($r->filename =~ m/\.pod$/i) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | 0 | $filename = $r->filename; | |||||||||
| 55 | } else { | ||||||||||
| 56 | 0 | my $module = $r->path_info; | |||||||||
| 57 | 0 | $module =~ s|/||; | |||||||||
| 58 | 0 | $module =~ s|/|::|g; | |||||||||
| 59 | 0 | $module =~ s|\.html?$||; # Intermodule links end with .html | |||||||||
| 60 | |||||||||||
| 61 | 0 | $filename = Pod::Find::pod_where( {-inc=>1}, $module ); | |||||||||
| 62 | |||||||||||
| 63 | # XXX Unimplemented | ||||||||||
| 64 | # $pod =~ s/^f::/-f /; # If we specify /f/ as our "base", it's a function search | ||||||||||
| 65 | } | ||||||||||
| 66 | |||||||||||
| 67 | 0 | return $filename; | |||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | 3 | 1; | |||||||||
| 71 | |||||||||||
| 72 | =head1 AUTHOR | ||||||||||
| 73 | |||||||||||
| 74 | Andy Lester <andy at petdance.com> | ||||||||||
| 75 | |||||||||||
| 76 | =head1 ACKNOWLEDGEMENTS | ||||||||||
| 77 | |||||||||||
| 78 | Adapted from Apache::Perldoc by Rich Bowen. Thanks also to | ||||||||||
| 79 | Pete Krawczyk, | ||||||||||
| 80 | Kjetil Skotheim, | ||||||||||
| 81 | Kate Yoak | ||||||||||
| 82 | and | ||||||||||
| 83 | Chris Eade | ||||||||||
| 84 | for contributions. | ||||||||||
| 85 | |||||||||||
| 86 | =head1 LICENSE | ||||||||||
| 87 | |||||||||||
| 88 | This package is licensed under the same terms as Perl itself. | ||||||||||
| 89 | |||||||||||
| 90 | =cut | ||||||||||