Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

I am not aware of a module to do anything like that specifically, and doubt that one would be more speedy/useful in a general case than just doing regex substitutions directly. Strings in Perl are not just byte arrays like they are in many other languages, so you will likely not gain much by trying to treat them like one. That being said, I can think of reasons when you might want to do something like that anyway.

Many years ago I wrote a special purpose text editor in perl/Tk to help produce texts for Project Gutenberg. The perl/Tk text widget provides some basic search and replace functionality but has many limitations so I wrote something similar to what you are asking as a work around. It was not OO, and was pretty heavily tied to perl/Tk::Text, so it probably isn't useful as drop in code, but you might be able to glean some useful bits if you end up writing something yourself.

Be aware that I started writing this in the heady days when perl 5.6 reigned supreme and I was a perl newby, so many of the design decisions were questionable by modern standards. Also, I have not been associated with it since 2005 or so, so the codebase may have moved on. If you are still curious after all those caveats, the code is still available on sourceforge.


In reply to Re: Is there a module for object-oriented substring handling/substitution? by thundergnat
in thread Is there a module for object-oriented substring handling/substitution? by smls

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (8)
    As of 2014-08-30 18:50 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The best computer themed movie is:











      Results (293 votes), past polls