Another approach is to subclass the module, or intercept calls. For a work project, I wasn't happy with the Pod::Html output, so I hacked in some changes that vary depending on the version: sub per_version {
if ($Pod::Html::VERSION eq '1.01') {
# perl5.005_03
*Pod::Html::process_text2 = \&Pod::Html::process_text1;
undef *Pod::Html::process_text1;
*Pod::Html::process_text1 = \&my_process;
@options = qw/ --recurse --header /;
} elsif ($Pod::Html::VERSION =~ /^1\.0[34]$/) {
# perl-5.6.0, 5.6.1, 5.8.0
*Pod::Html::process_L2 = \&Pod::Html::process_L;
undef *Pod::Html::process_L;
*Pod::Html::process_L = \&my_oldprocess;
@options = qw/ --recurse /;
} else {
die "Don't know how to hack Pod::Html v$Pod::Html::VERSION\n";
}
sub my_process ($$;$$) {
my($lev, $rstr, $func, $closing) = @_;
my $closer = '>' x (($closing||0) + 1);
if ($func && $func eq 'L') {
# suppress 'the ... manpage' markup
$$rstr =~ s{^
^ ( \w+ (?: ::\w+ )* )
(?: -(?!$closer)> (\w+) )?
(.*?) (\s* $closer)
}{
defined($2) ? qq{$1-E<gt>$2$3|$1/"item_$2$4} : "$1$3|$1$4"
}xe;
}
Pod::Html::process_text2($lev, $rstr, $func, $closing);
}
sub my_oldprocess {
my($str) = @_;
$str =~ s,^(\w+(::\w+)*)$,$1|$1/,;
Pod::Html::process_L2($str);
}
This approach isn't always the right one, but it's a useful tool to have.
Hugo
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|