I was thinking about some of the design issues in my dice.rb script:
and one of the major issues is queueing. I’d like to ensure that
selecting multiple URLs doesn’t overwrite the current contents from the
previous X selection, so I was thinking what I needed to do was
implement a FIFO stack.
My main issues are that I don’t want to miss any X selections, but at
the same time I don’t want ruby running in such a tight loop that it
sucks up excessive CPU time.
Right now, I’m doing:
grab X selection
# time-consuming WWW::Mechanize stuff with selection
which isn’t really event driven. So, if I select several URLs in quick
succession, only the URL in the X selection the next time ruby looks at
it gets handled.