{"id":284,"date":"2011-10-20T13:10:31","date_gmt":"2011-10-20T18:10:31","guid":{"rendered":"http:\/\/somethingdoug.com\/thoughts\/?p=284"},"modified":"2011-10-20T13:10:31","modified_gmt":"2011-10-20T18:10:31","slug":"should-perl-modules-default-to-non-blocking","status":"publish","type":"post","link":"https:\/\/somethingdoug.com\/thoughts\/2011\/10\/20\/should-perl-modules-default-to-non-blocking\/","title":{"rendered":"Should Perl Modules Default to Non-Blocking?"},"content":{"rendered":"<p>I have been thinking about possibly changing my modules and for the creation of new modules in the future to be non-blocking (like utilizing <a href=\"https:\/\/metacpan.org\/module\/AnyEvent\">AnyEvent<\/a> or something else generic). Typically these days my main work involves <a href=\"http:\/\/nodejs.org\/\">node.js<\/a>, which emphases non-blocking (i.m.o). Then a <a href=\"http:\/\/blogs.perl.org\/users\/philip_durbin\/2011\/10\/perl-dropped-and-go-adopted-due-to-concurrency-issues-in-baconbird.html\">post came up recently<\/a> that made me think about this again (yes, I know in this particular case non-blocking still would not have solved the issue here, which was, apparently, that the person did not want to use event-based programming, but it just reminded me on my thoughts on non-blocking).<\/p>\n<p>The main thing with non-blocking is that if you want to use something that is blocking, it is harder to use that in a non-blocking environment unless you can shove that blocking behavior into a background thread and put an event wrapper around it. Also, a non-blocking module can always be used in a blocking way, so I think this makes it a win-win.<\/p>\n<p>Note: By &#8220;default to non-blocking&#8221; I mean that they can behave in a non-blocking way, so the module can behave both blocking and non-blocking.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have been thinking about possibly changing my modules and for the creation of new modules in the future to be non-blocking (like utilizing AnyEvent or something else generic). Typically these days my main work involves node.js, which emphases non-blocking (i.m.o). Then a post came up recently that made me think about this again (yes, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[25,12,27,19],"class_list":["post-284","post","type-post","status-publish","format-standard","hentry","category-perl","tag-anyevent","tag-cpan","tag-perl","tag-perl5"],"_links":{"self":[{"href":"https:\/\/somethingdoug.com\/thoughts\/wp-json\/wp\/v2\/posts\/284","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/somethingdoug.com\/thoughts\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/somethingdoug.com\/thoughts\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/somethingdoug.com\/thoughts\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/somethingdoug.com\/thoughts\/wp-json\/wp\/v2\/comments?post=284"}],"version-history":[{"count":8,"href":"https:\/\/somethingdoug.com\/thoughts\/wp-json\/wp\/v2\/posts\/284\/revisions"}],"predecessor-version":[{"id":292,"href":"https:\/\/somethingdoug.com\/thoughts\/wp-json\/wp\/v2\/posts\/284\/revisions\/292"}],"wp:attachment":[{"href":"https:\/\/somethingdoug.com\/thoughts\/wp-json\/wp\/v2\/media?parent=284"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/somethingdoug.com\/thoughts\/wp-json\/wp\/v2\/categories?post=284"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/somethingdoug.com\/thoughts\/wp-json\/wp\/v2\/tags?post=284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}