Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Is there a module for object-oriented substring handling/substitution?

by thundergnat (Deacon)
on Jan 25, 2013 at 17:14 UTC ( #1015378=note: print w/replies, xml ) Need Help??

in reply to Is there a module for object-oriented substring handling/substitution?

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.

  • Comment on Re: Is there a module for object-oriented substring handling/substitution?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1015378]
[shmem]: same with redo. See also goto hell (shameless plug)

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2018-05-20 18:50 GMT
Find Nodes?
    Voting Booth?