![]() |
|
Problems? Is your data what you think it is? | |
PerlMonks |
Re^3: Is there a module for object-oriented substring handling/substitution?by LanX (Bishop) |
on Jan 26, 2013 at 20:31 UTC ( #1015535=note: print w/replies, xml ) | Need Help?? |
OK now with the knowledge of your use case, I'd rather recommend to work with a document tree representing your wiki page as a hash of hashes. Much like a DOM-tree, you could traverse it for whatever markup-element ("table") you want. Parse the wiki-page into a tree, manipulate the tree and rebuild the page again. Otherwise: If you insist to stick persistent meta-informations to ranges of characters, then you should better work with arrays of characters. You could tie or bless the scalar elements with whatever info you want. If your user inserts or deletes anything from the array your metainfos will move accordingly. And if you wanna go the full "emacs way" you need to realize linked lists. The easiest way is having 2 element arrays [$value,$successor_ref] EDIT: After some meditation, IMHO if you need full interactivity, better stay with the AoH with the document tree, and a "cursor" pointing to the current element. Whenever the user does insert characters update the tree at the point the cursor points to. You'll also need to store informations like "parent", "child", "nextSibling" ... Have a look at DOM or XML modules at CPAN for inspiration.
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|