|Perl Monk, Perl Meditation|
Using Term::ReadLine and pasting input with tabsby crux_capacitor (Initiate)
|on Mar 22, 2016 at 17:49 UTC||Need Help??|
crux_capacitor has asked for the wisdom of the Perl Monks concerning the following question:
I've written a tool for use with the SGUIL IDS interface. The tool allows you to copy and paste an alert directly into the prompt, which the script then parses for relevant info, retrieves output for you, and then takes you back to the prompt for the next input. When copy and pasting from SGUIL, the fields are tab separated, which makes for very easy parsing, however I've been trying to use Term::ReadLine to allow for pressing the up-arrow to access input history, editing a previous input, etc. When using Term::ReadLine for this, I've gotten the history part to work, but when pasting an alert, all the tabs are removed and so all the fields are smashed together without even a single space in between. This makes it impossible to parse, and defeats the entire purpose.
I tried changing the EditingMode to 'vi', and this fixes the pasting problem, and allows me to see the input history, but editing doesn't work anymore (backspace, delete, left/right arrows don't work).
Does anyone know how to get this to work so that I can both paste a SGUIL alert and preserve tabs, AND have access to the history and editing previous inputs?
Here is my code so far:
Here is sample input, paste into the prompt: 169 sensor-eth1 10.185133100 2016-03-22 16:49:31 22.214.171.124 80 192.168.10.10 49883 6 ET INFO PDF Using CCITTFax Filter