Subject: | Callback interface or returning text position |
This is just a note.
Related to my problem in RT#95998 of replacing date strings in text, one more proper way would be for the module to provide a callback interface for each found string. Returning all found date strings works for now, but could theoretically give false positives. Imagine the future version of the module that can filter out false positive like:
tweet: i performed the song "yesterday" yesterday.
The module will only recognize the second "yesterday" as date, but if it returns the original string, the regex substitution that I will perform later cannot know which one is the real date.
Perhaps this warrants a new module, since the interface is different and the name is no longer apt. Perhaps Date::Find or Date::Find::Callback?
Another alternative, which I will attempt, is for the module to return verbatim string and position.