SPUG:POD link question
Yitzchak Scott-Thoennes
sthoenna at efn.org
Wed Feb 19 17:56:12 CST 2003
On Wed, 19 Feb 2003 15:14:37 -0800, asa.martin at attws.com wrote:
>I would like to replace all references to B<Module::Name> in my POD with <A HREF="Module_Name.html">Module::Name</A>. References to scripts could occur multiple times per line.
>
>I tried doing this with a regular expression, but I got stuck. It seemed difficult to match both two and three levels deep of ::. I actually think matching an arbitrary number deep would be better. Any ideas?
Something like (untested):
sub modname_to_htmlfile { my $mod = shift; $mod =~ tr/:/_/s; "$mod.html" }
$pod_line =~ s[<strong>(\w+(::\w+)+)</strong>]
[sprintf '<a href="%s">%s</a>',modname_to_htmlfile("$1"),"$1"]ge;
(assuming you are doing this after pod2html does its stuff).
More information about the spug-list
mailing list