Dear Monks,

i come in shame as i have to admit that i use perl combined with mysql in a way that cant be right. At least it feels so wrong.
I've got an Application which is written in Perl embedded into Apache. I've got some fancy scripts which i call agents. Now : When there are certain things happening in Apache like i get an request from the outside world and i have the urge to tell it my mighty agent what i do is insert a string of JSON into a table which i call "do".

My Agent does something like this :
while(1){ foreach my $p (@{$dbh->selectall_arrayref(qq|SELECT id, do, ts FROM + do|, {Slice=>{} })}){ # Do what the JSON is telling me } sleep 1; }
By now u know what i mean with it feels wrong in any possible way. So i started digging : Signals, Mysql Triggers, POE, Anyevent, IO:: and so forth. What would you do or maybe have done to implement something like that. Dont worry all i need is some direction which would be best and i will read from there but im overwhelmed by posibilitys without havein any Idea what would really work in production later which actually works ... not like Threads when i looked at them 7 Years ago ^^

Any guidence would be appreciated

In reply to Constant SQL Querys to send "signals" by stewe

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.