in reply to Text field event handling

Your reference to javascript leads me to assume that you're talking about interactions between a web browser client and a perl script running on a web server. As I understand it, the only way for this to happen is to have javascript functions running on the browser client that will send http requests back to the server for each relevant event, and then handle whatever the server sends out in return (if anything).

There's no other way for a server to know what a client is doing with a page that was last sent, and the server cannot cause perl code to execute on the client (unless/until someone builds and distributes a browser that runs perl instead of javascript -- if that's ever been done, I suspect it's not something that gets wide usage or support).

If you're talking about a "console GUI" application, using Perl/Tk or Perl/Gtk or Perl/Qt or ..., that's a different matter, and of course actions like leaving a text field can be detected and acted on by binding events to callback functions.