I have a big legacy app with a bunch of CGI.pm tags like:
li(font({-face=>'verdana, arial, sans-serif', -color=>'red'}, $errorstring))
However, I have been tasked with redesigning the site, and need to be able to do most of the styling with CSS. I'm kind of stumped on a clean way to clean them up. My first stab was to try a simple regex:
find . |xargs grep -l 'font' | xargs
perl -ne 'if(s/font\s*\(([^()]+)\) )/<span class="$1"/g) {print;}'
However, that seems to be heading somewhere int he right direction, but not really what I want. A better approach may be to split up the tags and just dump portions in a class (perhaps something like
<li><span class="verdana red">$errorstring</span></li>
Is there a simple way to do that in regex? Or is there a better approach to cleaning up the cgi.pm code?