[prog] Looking for a Perl module
Dan Richter
daniel.richter at wimba.com
Wed Sep 24 11:59:33 EST 2003
I'm looking for a Perl module that does a certain thing that I can't really
describe well enough in a single sentence. It's easier to explain by example.
I have a program that does tidying up (like correcting spelling) in HTML
documents, but the tags keep getting in the way. It would be nice if there
was a Perl module that allowed me to do something like this:
my $replacer = Hypothetical::Class->new;
# Replace HTML tags with something that
# doesn't look like text at all.
my $safe_html = $replacer->substitute("<.*?>", $html);
# Now that the HTML tags are removed, we can
# do this substitutions without changing
# A HREF="http://...".
$safe_html =~ s/http/HTTP/g;
# Put back the parts we replaced.
$html = $replacer->put_back($safe_html);
Obviously this is short on details, but I am convinced that it's feasible
to do. Does anyone know of a module like this? (Don't tell me where I might
find it because I've probably looked there already; tell me where you are
reasonably sure I will find it.)
If there is no such module, I think I could write one, but there's no sense
in writing it if it already exists. That's why I'm asking if anyone has
already heard of something like this.
--
You could effectively conclude [that] my service here
at this podium would come to an abrupt end.
- then White House spokesman Mike McCurry, asked by a
reporter what he would do if he won the
$100 million Powerball lottery. (He didn't win.)
More information about the Programming
mailing list