ambs's Journal http://use.perl.org/~ambs/journal/ ambs's use Perl Journal en-us use Perl; is Copyright 1998-2006, Chris Nandor. Stories, comments, journals, and other submissions posted on use Perl; are Copyright their respective owners. 2012-01-25T02:17:20+00:00 pudge pudge@perl.org Technology hourly 1 1970-01-01T00:00+00:00 ambs's Journal http://use.perl.org/images/topics/useperl.gif http://use.perl.org/~ambs/journal/ What is the status of $@? http://use.perl.org/~ambs/journal/40175?from=rss <p>Accordingly with the perlvar manpage, $@ is used for error messages produced by eval.</p><p>I would like to use it as a more general variable for error messages. When a function returns a string, there isn't much that can be done to return a error string. Probably returning a list, setting an object, nothing clean and simple as real perl code<nobr> <wbr></nobr>:)</p><p>What I want is to use $@. The function will return undef and set $@ to the error message. This is clean enough and should work.</p><p>But I have some doubts: is there any problem on using this approach? In the function I probably need to clean up $@ and assign undef to it?</p> ambs 2010-02-11T16:57:43+00:00 others What's up with use.perl main articles? http://use.perl.org/~ambs/journal/40173?from=rss <p>What is happening with use.perl main articles? Lack of time to moderate them?</p> ambs 2010-02-11T11:02:50+00:00 useperl Deep recursion on subroutine http://use.perl.org/~ambs/journal/40113?from=rss <p>Perl is complaining about a deep recursion on a subroutine. That is natural, as I have deep recursion<nobr> <wbr></nobr>:). But that recursion is being controled and therefore I know that will not be a problem.</p><p>Now the question is: can I silence Perl on these warnings?</p> ambs 2010-01-20T14:20:22+00:00 useperl Encode and CGI::Session... again? http://use.perl.org/~ambs/journal/40089?from=rss <p>In my last post I was complaining about 'use encoding'. As suggested, I changed. Now, I am using just 'Encode' module, 'encode' function. But that is not working correctly as well.</p><p>Basically, I continue to get errors with calls to renew and renewed method. Curiously, they are not deterministic. Sometimes nothing gives error. Some other times, it gives error when creating the CGI::Session object: Can't locate object method "renewed" via package "Encode::utf8" at<nobr> <wbr></nobr>/usr/lib/perl5/core_perl/POSIX.pm line 26</p><p>I really would like to know if this problem might be from Encode and CGI::Session working together (I just got the bug when adding sessions to the website) or if it is about mod_perl working with both of them.</p><p>No idea. But this is giving me pain...</p> ambs 2010-01-09T19:38:36+00:00 bugs Using encoding and CGI Sessions/Cookies http://use.perl.org/~ambs/journal/40071?from=rss <p>I am trying to use CGI::Session (and of course, CGI::Cookie) together with 'use encoding "utf-8"', but things seems not to work.</p><p>The error is 'Can't locate object method "renewed" via package "Encode::utf8" at<nobr> <wbr></nobr>/usr/share/perl5/site_perl/5.10.0/CGI.pm' that seems to be common to other modules. For example, a google search shown similar problems with Safe.</p><p>I am not sure yet about who is responsbible for the bug, Encode, CGI::Session or CGI::Cookie. But if this kind of problem was detected previously probably somebody knows where is the problem and can point me to the correct place, so I can try to correct this bug.</p> ambs 2010-01-03T17:10:50+00:00 bugs Modules versioning http://use.perl.org/~ambs/journal/40063?from=rss <p>For some time that Perl modules are numbered with a major version, a minor version, and sometimes, a alpha/beta numbering.</p><p>Lately some modules adopted the usage of a serialized date. One of the latest was Regexp::Common. Do not stress, Abigail, nothing against it.</p><p>Now, the question are: is it useful? Should it be used just for old and stable modules like Regexp::Common or should we use it from the beginning?</p><p>I think it might gets useful. Normally it is hard to know in what direction to number distributions. Especially when you get to<nobr> <wbr></nobr>.99 and do not want to change the major version in the next version.</p><p>But then, probably we should not use that numbering scheme for new modules. Just because you never know if you will need to change drastically the interface. And then, a major number version change might get useful.</p><p>Any thought?</p> ambs 2009-12-31T18:41:27+00:00 cpan TPF 2009Q3 Grant Proposals http://use.perl.org/~ambs/journal/39437?from=rss After three extenuating days at YAPC::EU::2009, and after some rest time, finally had the time to prepare the list of grant proposals for the third quarter of 2009.<br> <br>We have seven proposals, that can be read in TPF blog:<ul> <li> <a href="http://news.perlfoundation.org/2009/08/2009q3_grant_proposal_perl_cor.html">perl core memory improvements</a> by Jim Cromie</li></ul><ul> <li> <a href="http://news.perlfoundation.org/2009/08/wxperl_documentation.html">wxPerl Documentation</a> by Eric J. Roode</li></ul><ul> <li> <a href="http://news.perlfoundation.org/2009/08/2009q3_grant_proposal_improve.html">Improve the visual design of Perl websites</a> by Jon Allen</li></ul><ul> <li> <a href="http://news.perlfoundation.org/2009/08/2009q3_grant_proposal_corporat.html">Corporate, Embedded, and Multi-user Perl on Windows</a> by Curtis Jewell</li></ul><ul> <li> <a href="http://news.perlfoundation.org/2009/08/2009q3_grant_proposal_changing.html">Changing the Perl 5 optree build process into a Abstract Syntax Tree generation and a code generation step</a> by&nbsp; Gerard Goossen</li></ul><ul> <li> <a href="http://news.perlfoundation.org/2009/08/2009q3_grant_proposal_enhancin.html">Enhancing CPANHQ</a> by Shlomi Fish</li></ul><ul> <li> <a href="http://news.perlfoundation.org/2009/08/2009q3_grant_proposal_creating.html">Creating a ctypes-Like Interface for Perl to External Subroutines</a> by Shlomi Fish</li></ul><p>These proposals are open for public/community discussion. Please comment each post with your thoughts of the proposal. Please make sure you sign your comments, and also that your comment is something more than just one "I would like it" or "It sucks", or it will be moderated.<br> <br>Voting will take place in 23th August, and results should be posted shortly after.</p> ambs 2009-08-10T11:51:46+00:00 perlfoundation Understanding Perl and Encodings http://use.perl.org/~ambs/journal/39215?from=rss <p>I still did not get the grip on Encodings and Perl. I have an UTF8 file that I want to process. This process calls a module that I know uses a bidirectional pipe with an latin1 process. But that should be hidden...</p><p>So, I am reading with &lt;&gt; operator, and printing with print. If I do not say a thing, I get output correct (UTF8) but the module does not work. If I put 'use encoding utf8', I get input and output correct, but the module does not work. If I put 'use open utf8' I get the module working, but no correct output. If I add the binmode for the STDOUT, it works. And finally, if I remove 'use open' and add a binmode for STDIN, it does not work, as &lt;&gt; is not affected by that.</p><p>Finally, I was hopping that 'use open utf8' would work for it all. Unfortunately it doesn't. Perl 5.10.0, btw.</p><p>Ideas, suggestions, corrections, are welcome.</p> ambs 2009-07-02T21:31:55+00:00 journal You know you are doing too complex SQL queries... http://use.perl.org/~ambs/journal/39190?from=rss <p>You know you are doing too complex SQL queries... when DBI/DBD::SQLite refuses to parse the SQL statement.</p><p>The statement is simple: select a field, where it is one of a set of words:</p><p> <code> SELECT word FROM dict WHERE word='aaaaa' OR word='bbbbb' OR word='ccccc' OR... </code> </p><p> The first error was: parser depth of 1000 was reached.</p><p> No problem. Decided to construct a binary tree of ORs:</p><p> <code> SELECT<nobr> <wbr></nobr>... WHERE ((word = a or word = b) or (word = c or word = d)) </code> </p><p> Now, DBD::SQLite::db prepare failed: parser stack overflow.</p><p> I think the solution is to slipt this thing in more than one query. Damn!</p> ambs 2009-06-29T21:24:16+00:00 useperl Zefyr http://use.perl.org/~ambs/journal/39044?from=rss Anybody with experiments on Zefyr? (http://www.aevoe.com/shop/moshi.asp?showthis=82) I would like to buy one, but I can't find this in Europe. Any idea where to find one? ambs 2009-05-28T20:15:15+00:00 journal Testing Modules on Different Operating Systems http://use.perl.org/~ambs/journal/39009?from=rss <p>I think this is a missing tool for Perl developers. If I am wrong, and there is any solution out there, please let me know.</p><p>But I think there should be available a computer farm with different operating systems. For instance, I have a Linux server, a Mac laptop, and a Windows VMWare with Strawberry. But I do not have a Windows with ActiveState Perl, neither a Windows with Cygwin Perl, neither a BSD. Not to mention other strange operating systems.</p><p>I know that to give random users access to a machine is not secure. Thus, if this farm gets created, I suggest that some precedents should be requested to the CPAN author to get the account. For instance, to have at least one released module. Other options might arise when we start discussing this.</p><p>Also, for easier maintenance, it would be great if this farm would be of virtual machines. This way it would be easy to define a time (say, 0:00 GMT) to delete the running virtual machine and install a new snapshot. Of course that would annoy people logged in at that time, but it won't hurt much.</p><p>Thoughts?</p><p>Well, all this to say I need to test my Config::AutoConf module on BSD<nobr> <wbr></nobr>:P</p> ambs 2009-05-20T16:34:34+00:00 cpan TPF 2009Q1 Grant Proposals http://use.perl.org/~ambs/journal/38418?from=rss <p>Is that time again. The deadline for grant proposals submissions ended six days ago, and now they are available for comment during a week. Please use each proposal post to comment about that project. Please do not post with simple messages as I like it , or +1 . If you like it, state why you do. That is what will help us voting, not just another person name associated to the proposal.</p><p>Proposals for this quarter:</p><ul> <li> <a href="http://news.perlfoundation.org/2009/02/2009q1_grant_proposal_inline_c.html">#60002 - Inline C++/CLI </a> </li><li> <a href="http://news.perlfoundation.org/2009/02/2009q1_grant_proposal_perl_deb.html">#60138 - Perl debugger integration in Padre, the Perl IDE </a> </li><li> <a href="http://news.perlfoundation.org/2009/02/2009q1_grant_proposal_cpanforu.html">#60250 - CPAN::Forum development </a> </li><li> <a href="http://news.perlfoundation.org/2009/02/2009q1_grant_proposal_faster_p.html">#61650 - Faster Perl Crawlers </a> </li><li> <a href="http://news.perlfoundation.org/2009/02/2009q1_grant_proposal_comprehe.html">#62286 - Comprehensive Webservices Toolkit </a> </li><li> <a href="http://news.perlfoundation.org/2009/02/2009q1_grant_proposal_codewalk.html">#62520 - Codewalker </a> </li><li> <a href="http://news.perlfoundation.org/2009/02/2009q1_grant_proposal_perl_6_p.html">#62544 - Project Title: Perl 6 Pages </a> </li><li> <a href="http://news.perlfoundation.org/2009/02/2009q1_grant_proposal_webpm_-.html">#62760 - Web.pm &#8211; a lightweight web framework for Perl 6 </a> </li><li> <a href="http://news.perlfoundation.org/2009/02/2009q1_grant_proposal_opener_p.html">#62762 - OPener Package </a> </li><li> <a href="http://news.perlfoundation.org/2009/02/2009q1_grant_proposal_opener_c.html">#62764 - OPener Chat </a> </li><li> <a href="http://news.perlfoundation.org/2009/02/2009q1_grant_proposal_interact.html">#62888 - Interactive Perl Interpreter </a> </li><li> <a href="http://news.perlfoundation.org/2009/02/2009q1_grant_proposal_pod_mang.html">#62914 - Pod Mangling Utility Improvements </a> </li><li> <a href="http://news.perlfoundation.org/2009/02/2009q1_grant_proposal_awarenes.html">#62938 - Awareness and Utilization of Perl in Nigeria: A Survey </a> </li><li> <a href="http://news.perlfoundation.org/2009/02/2009q1_grant_proposal_improvin.html">#62964 - Improving learn.perl.org </a> </li></ul> ambs 2009-02-06T19:07:52+00:00 perlfoundation 2009Q1 Call for Grant Proposals http://use.perl.org/~ambs/journal/38232?from=rss <p>The Perl Foundation is looking at giving some grants ranging from $500 to $3000 in February 2009.</p><p>In the past, we've supported Adam Kennedy's PPI, Strawberry Perl and Perl on a Stick, Nicholas Clark's work on Perl internals, Jouke Visser's pVoice, Chris Dolan on Perl::Critic and many others (just check http://www.perlfoundation.org/grants for more references).</p><p>You don't have to have a large, complex, or lengthy project. You don't even have to be a Perl master or guru. If you have a good idea and the means and ability to accomplish it, we want to hear from you!</p><p>Do you have something that could benefit the Perl community but just need that little extra help? Submit a grant proposal by January 31.</p><p>As a general rule, a properly formatted grant proposal is more likely to be approved if it meets the following criteria</p><p>* It has widespread benefit to the Perl community or a large segment of it.<br>* We have reasons to believe that you can accomplish your goals.<br>* We can afford it (please, respect the limits or your proposal should be rejected immediately).</p><p>To submit a proposal see the guidelines at http://www.perlfoundation.org/how_to_write_a_proposal and TPF rules of operation at http://www.perlfoundation.org/rules_of_operation. Then send your proposal to tpf-proposals@perl-foundation.org. Note that starting with this round, proposals should be properly formatted accordingly with our POD template.</p><p>On February 1st, proposals will be made available publicly (on this blog) for public discussion, as it happened in the previous round. So, please make it clear in your proposal if it should not be public.</p> ambs 2009-01-07T21:33:15+00:00 perlfoundation TPF needing Grant Manager http://use.perl.org/~ambs/journal/38097?from=rss <p>The Perl Foundation is needing one more grant manager. At the moment there are two grants that did not start because current grant managers have a reasonable number of grants to manage.</p><p>Grant Managers are the mean of communication between TPF and each Grantee. They are responsible to organize grantee payments (to work with TPF treasurer on the payment bureaucracy), and are responsible to keep the community (through the Grant Committee Chair) updated about grants evolution.</p><p>If you think you are responsive, and you would like to help TPF with this task, drop me a line (or a comment). Received names will be discussed on the Grant Committee so we can choose somebody by Friday.</p> ambs 2008-12-16T11:30:37+00:00 perlfoundation 2008Q4 Call for Grant Proposals http://use.perl.org/~ambs/journal/37584?from=rss <p>The Perl Foundation is looking at giving some grants ranging from $500 to $3000 in November 2008.</p><p>In the past, we've supported Adam Kennedy's PPI and Strawberry Perl, Nicholas Clark's work on Perl internals, Jouke Visser's pVoice, Chris Dolan on Perl::Critic and many others (just check http://www.perlfoundation.org/grants for more references).</p><p>You don't have to have a large, complex, or lengthy project. You don't even have to be a Perl master or guru. If you have a good idea and the means and ability to accomplish it, we want to hear from you!</p><p>Do you have something that could benefit the Perl community but just need that little extra help? Submit a grant proposal by October 31.</p><p>As a general rule, a properly formatted grant proposal is more likely to be approved if it meets the following criteria</p><ul> <li> It has widespread benefit to the Perl community or a large segment of it.</li><li> We have reasons to believe that you can accomplish your goals.</li><li> We can afford it (please respect the limits or your proposal should be rejected immediately).</li></ul><p>To submit a proposal see the guidelines at http://www.perlfoundation.org/how_to_write_a_proposal and TPF rules of operation at http://www.perlfoundation.org/rules_of_operation. Then send your proposal to tpf-proposals @ perl-foundation.org.</p><p>On November 1st, proposals will be made available publicly (on this blog) for public discussion, as it happened in the previous round. So, please make it clear in your proposal if it should not be public.</p><p> <b>Note that accepted but not funded proposals in the previous round do not need to be re-submitted.</b> </p> ambs 2008-10-01T16:13:08+00:00 perlfoundation How would you write factorial? http://use.perl.org/~ambs/journal/37511?from=rss <p>There are a lot of ways to write a factorial function in Perl, from the more recursive functional approach, to the standard iterative solution.</p><p>I prepared a bunch (well, four for now). If you have any other creative way of coding this function, please let me know (by email or commenting here). Note that I am more interested in the algorithm than in the golfing or obsfuscation.</p><p>Solution 1: Recursive is beautiful</p><blockquote><div><p> <tt>sub factorial {<br>&nbsp; &nbsp; my $v = shift;<br>&nbsp; &nbsp; if ($v &gt; 1) {<br>&nbsp; &nbsp; &nbsp; &nbsp; return $v * factorial($v-1);<br>&nbsp; &nbsp; } else {<br>&nbsp; &nbsp; &nbsp; &nbsp; return $v;<br>&nbsp; &nbsp; }<br>}</tt></p></div> </blockquote><p>Solution 2: Iterative is fast</p><blockquote><div><p> <tt>sub factorial {<br>&nbsp; &nbsp; my $v = shift;<br>&nbsp; &nbsp; my $res = 1;<br>&nbsp; &nbsp; while ($v &gt; 1) {<br>&nbsp; &nbsp; &nbsp; &nbsp; $res *= $v;<br>&nbsp; &nbsp; &nbsp; &nbsp; $v--;<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; return $res;<br>}</tt></p></div> </blockquote><p>Solution 3: Perl is a dynamic language</p><blockquote><div><p> <tt>sub factorial {<br>&nbsp; &nbsp; my $v = shift;<br>&nbsp; &nbsp; return eval (join "*", (1..$v));<br>}</tt></p></div> </blockquote><p>Solution 4: There are other ways of iteration</p><blockquote><div><p> <tt>sub factorial {<br>&nbsp; &nbsp; my $v = shift;<br>&nbsp; &nbsp; my $res = 1;<br>&nbsp; &nbsp; grep {$res*=$_} (1..$v);<br>&nbsp; &nbsp; return $res;<br>}</tt></p></div> </blockquote> ambs 2008-09-22T20:16:17+00:00 journal Acme::EpicFail http://use.perl.org/~ambs/journal/37251?from=rss <p>In the last times there is this 'Epic Fail' or 'Epic Mega Fail' usage for everything. The Portuguese guys on YAPC::EU::2009 used it a lot, as well. So much, that I come back and wrote this ACME module. It doesn't do much. Specially because I am in vacations without much Internet access, and thus, not being able to discuss it properly. Thus, this post is a call for ideas: what can I do to make this ACME module more ACME interesting?</p> ambs 2008-08-22T12:56:09+00:00 modules Best Perl Release Ever! http://use.perl.org/~ambs/journal/37200?from=rss <p>YAPC::EU::2008 in Copenhagen ended today. During the conference a lot of people said something like: <i>Perl 5.10 is the best Perl release ever!</i>. I think that who repeated this most was Damian Conway. Given his talks content I can understand why. But it wasn't the only one.</p><p>Now, what I can't understand is why <a href="http://ftp.cpan.org/src/README.html">http://ftp.cpan.org/src/README.html</a> still says that perl 5.10.0 is a testing release, 8 months old.</p><p>I discussed this previously in perl 5 porters mailing list, but some months elapsed and no news. It is <b>really</b> important to re-tag that distribution with a <b>stable</b> tag, if it is really the best Perl release ever. Another option is to make 5.10.1 available. I know Rafael has some milestones for 5.10.1. But it might be more important for the Perl community to have 5.10.1 wide spread than to wait for really new cool features.</p><p>Why? For instance, because some Linux distributions will not include perl 5.10.x while it is tagged with <b>testing</b>. Also, because we all know that changes from 5.6 to 5.8 were basically from internals (Unicode, especially). But the changes from 5.8 to 5.10 are significally a breath of fresh air. We should make 5.10 the best Perl release ever for all users, and not just those geeks that want to use the new features.</p> ambs 2008-08-15T18:24:28+00:00 newsnews 15 Proposals for Third Quarter of TPF Grants http://use.perl.org/~ambs/journal/37076?from=rss <p>The Perl Foundation grants committee received 15 proposals during the third call for grant proposals for 2008. These proposals are published for public discussion. You are invited to comment each proposal about its relevance and objectives.</p><p>During the month of July we received the following grant proposals:</p><ul> <li> <a href="http://news.perlfoundation.org/2008/08/2008q3_grant_proposal_squattin.html">Squatting On Everything</a> </li><li> <a href="http://news.perlfoundation.org/2008/08/2008q3_grant_proposal_rufus.html">Rufus</a> </li><li> <a href="http://news.perlfoundation.org/2008/08/2008q3_grant_proposal_the_perl.html">The Perl Survey</a> </li><li> <a href="http://news.perlfoundation.org/2008/08/2008q3_grant_proposal_barcode.html">Barcode support in Act</a> </li><li> <a href="http://news.perlfoundation.org/2008/08/2008q3_grant_proposal_tcltk_ac.html">Tcl/Tk access for Rakudo</a> </li><li> <a href="http://news.perlfoundation.org/2008/08/2008q3_grant_proposal_perl_cro.html">Perl cross-compilation for linux and wince</a> </li><li> <a href="http://news.perlfoundation.org/2008/08/2008q3_grant_proposal_extendin.html">Extending BSDPAN</a> </li><li> <a href="http://news.perlfoundation.org/2008/08/2008q3_grant_proposal_improve.html">Improve POE::Component::IRC</a> </li><li> <a href="http://news.perlfoundation.org/2008/08/2008q3_grant_proposal_module_i.html">Module Installation Configuration Wizard</a> </li><li> <a href="http://news.perlfoundation.org/2008/08/2008q3_grant_proposal_cpan_sta.html">CPAN Stability Project</a> </li><li> <a href="http://news.perlfoundation.org/2008/08/2008q3_grant_proposal_singlefi.html">Single-file GUI-enabled executable</a> </li><li> <a href="http://news.perlfoundation.org/2008/08/2008q3_grant_proposal_hotel_pe.html">Hotel Perl</a> </li><li> <a href="http://news.perlfoundation.org/2008/08/2008q3_grant_proposal_bavl.html">Bavl</a> </li><li> <a href="http://news.perlfoundation.org/2008/08/2008q3_grant_proposal_libperl.html">Libperl++</a> </li></ul><p>Please take some time on reading the proposals carefully and give some feedback on the relevance of the proposals. This discussion period will end about August 10. Starting that date, the GC will begin the voting process. Please comment on each specific grant post or, if you want to give a broad opinion and comparison on the proposed grants, please comment this post. Thanks!</p><p> <b>NOTE</b> The committee received one last proposal, but was asked not to make it public. </p> ambs 2008-08-01T12:22:22+00:00 perlfoundation 2008Q3 Call for Grant Proposals http://use.perl.org/~ambs/journal/36835?from=rss <p>The Perl Foundation is looking at giving some grants ranging from $500 to $3000 in August 2008.</p><p>In the past, we've supported Adam Kennedy's PPI and Strawberry Perl, Nicholas Clark's work on Perl internals, Jouke Visser's pVoice, Chris Dolan on Perl::Critic and many others (just check http://www.perlfoundation.org/grants for more references).</p><p>You don't have to have a large, complex, or lengthy project. You don't even have to be a Perl master or guru. If you have a good idea and the means and ability to accomplish it, we want to hear from you!</p><p>Do you have something that could benefit the Perl community but just need that little extra help? Submit a grant proposal by July 31.</p><p>As a general rule, a properly formatted grant proposal is more likely to be approved if it meets the following criteria</p><ul> <li> It has widespread benefit to the Perl community or a large segment of it.</li><li> We have reasons to believe that you can accomplish your goals.</li><li> We can afford it.</li></ul><p>To submit a proposal see the guidelines at http://www.perlfoundation.org/how_to_write_a_proposal and TPF rules of operation at http://www.perlfoundation.org/rules_of_operation. Then send your proposal to tpf-proposals @ perl-foundation.org.</p><p>On August 1st, proposals will be made available publicly (on this blog) for public discussion, as it happened in the previous round. So, please make it clear in your proposal if it should not be public.</p><p> <b>Note that accepted but not funded proposals in the previous round do not need to be re-submitted.</b> </p> ambs 2008-07-01T19:09:47+00:00 perlfoundation CPAN Pearls http://use.perl.org/~ambs/journal/36726?from=rss <p>I am preparing a Lightning Talk for YAPC::EU::2008 in Copenhagen about CPAN Pearls. I am not sure if it will be accepted or not, but I am having fun preparing it, and thus, I'll continue.</p><p>What I want to find is not useful or brilliant modules. What I want to find are code snippets. Snippets of really stupid code (it might work, it might be useful, but it is stupid) and snippets of brilliant code (code that is intelligent, or elegant).</p><p>So, if you think you know some of this code, please point me to a module, version, file and block of lines. I would really appreciate.</p><p>Thanks!</p> ambs 2008-06-19T19:36:53+00:00 cpan Storing word-grams http://use.perl.org/~ambs/journal/36674?from=rss <p>I am in the way of storing word-grams for big texts (read big = more than 3GB text files). I want 2-word, 3-word and 4-word tuples, and respective occurrence count.</p><p>When processing these texts (on a cluster) I do not have access to any RDBM system. Well, I have SQLite, Berkeley DB, GDBM and probably other similars that I am forgeting about.</p><p>As you might guess, the main problem with this is populating the database. For each word on the corpus I need to check if it (together with the neighbourhood) exists or not in the database. If it does, I increment the counter. If not, I add a new entry.</p><p>Given that I am working on a Cluster I can easily split the job in different chunks, so that each node process a different part of the text. At the end I just need to glue the final databases.</p><p>In my experiences SQLite seems to be faster tool for this task. But I may be wrong. </p><p>So, what would you use for that?</p><p>(I know that for questions PerlMonks might be better, but I just think that site is completly unusable<nobr> <wbr></nobr>:( )</p> ambs 2008-06-12T16:57:03+00:00 journal Portuguese Perl Workshop, The First http://use.perl.org/~ambs/journal/36654?from=rss <p>Last week we hosted the first <a href="http://workshop.perl.pt/2008">Portuguese Perl Workshop</a>. It was a four day event. The first two were for training by brian d foy, and the last two days were the real workshop.</p><p>The workshop had the presence of well known Perl mongers (like me -- kidding), like brian d foy, Marty Pauley, Yuval Kogman, Daniel Ruoso, Jos&#233; Castro (aka cog), and some not so well-known Perl mongers like Nuno Carvalho (aka Smash) or Pedro Melo.</p><p>While not all things run as expected (we expected more audience) the organization is quite happy with this event results, and is already preparing the next one (next event, not next PPW... yet).</p> ambs 2008-06-11T18:37:05+00:00 journal Generating methods http://use.perl.org/~ambs/journal/36634?from=rss I wrote a new module. I am not sure yet of its utility, but it is already on CPAN. It is named LaTeX::Writer::Simple. Also, not sure yet if its interface will be the one available at the moment. But I would like to write about other thing: generating methods. It is cool to define methods during runtime:<blockquote><div><p> <tt>BEGIN {<br>&nbsp; &nbsp; @EXPORT = (qw/document p/);<br> <br>&nbsp; &nbsp; sub _def {<br>&nbsp; &nbsp; &nbsp; &nbsp; my ($name, $sub) = @_;<br> <br>&nbsp; &nbsp; &nbsp; &nbsp; no strict 'refs';<br>&nbsp; &nbsp; &nbsp; &nbsp; my $x = "LaTeX::Writer::Simple::$name";<br>&nbsp; &nbsp; &nbsp; &nbsp; *$x = $sub;<br>&nbsp; &nbsp; &nbsp; &nbsp; push @EXPORT, $name;<br>&nbsp; &nbsp; }<br> <br>&nbsp; &nbsp; my @nl_commands = (qw/part chapter section<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; subsection subsubsection caption/);<br>&nbsp; &nbsp; for my $c (@nl_commands) {<br>&nbsp; &nbsp; &nbsp; &nbsp; _def($c, sub { _newcommand($c, @_)."\n" });<br>&nbsp; &nbsp; }<br> <br>&nbsp; &nbsp;<nobr> <wbr></nobr>...</tt></p></div> </blockquote><p>It is just wonderful. And what I really liked was that <i>Test::Pod::Coverage</i> detects those methods, and complains about their lack of coverage. Wonderful!</p> ambs 2008-06-09T20:52:10+00:00 modules Why am I passionate about Perl? http://use.perl.org/~ambs/journal/36357?from=rss <p>brian d foy wrote a post about his keynote at the Portuguese Perl Workshop. As one of the main organizers, I think I should give the example. So, here I go.</p><p> <b>The person who introduced me to Perl showed me that...</b> it was concise and similar to C.</p><p> <b>I first starting using Perl to...</b> build a simple digital library on the web.</p><p> <b>I kept using Perl because...</b> it was used on some computer science classes for Natural Language Processing.</p><p> <b>I can't stop thinking about Perl...</b> because I like all that underlining magic.</p><p> <b>I'm still using Perl because...</b> there isn't any other language with such a wonderful and lazy community (and CPAN). Also, because Perl let you make your things done!</p><p> <b>I get other people to use Perl by...</b> teaching the Perl during Natural Language Processing classes, and by showing them how things can be wrote easily in Perl.</p><p>I also program in C, and I can't say I like more Perl or C. Different languages for different things. Sorry, brian!</p> ambs 2008-05-08T17:30:41+00:00 others 2008Q2 Grant Proposals http://use.perl.org/~ambs/journal/36307?from=rss On TPF webblog (check links bellow) are a set of posts with proposals received by the Perl Foundation grants committee during the second call for grant proposals for 2008. Although not usual, the rules of the TPF GC are changing and we hope to make this a rule. Proposals are accepted during one month and after that period, they are posted for public discussion on the Internet. This is important to make GC more aware of the community interest on the project, and to help opening the grants attribution process.<br> <br>During the month of April we received the following grant proposals:<ul> <li> <a href="http://news.perlfoundation.org/2008/05/2008q2_grant_proposal_perl_6_t.html">Perl 6 Tables</a> </li><li> <a href="http://news.perlfoundation.org/2008/05/2008q2_grant_proposal_solidify.html">Solidifying and Extending the Blog Normalize project</a> </li><li> <a href="http://news.perlfoundation.org/2008/05/httpsearchcpanorgdamogblognorm.html">Add Perl support to NetBeans</a> </li><li> <a href="http://news.perlfoundation.org/2008/05/2008q2_grant_proposal_perl_on.html">Perl on a Stick</a> </li><li> <a href="http://news.perlfoundation.org/2008/05/2008q2_grant_proposal_smop_sim.html">SMOP - Simple Meta Object Programming</a> </li><li> <a href="http://news.perlfoundation.org/2008/05/2008q2_grant_proposal_fixing_b.html">Fixing Bugs in the Archive::Zip Perl Module</a> </li><li> <a href="http://news.perlfoundation.org/2008/05/2008q2_grant_proposal_catalyst.html">CatalystX::Installer Application</a> </li><li> <a href="http://news.perlfoundation.org/2008/05/2008q2_grant_proposal_the_perl.html">Perl Survey</a></li><li> <a href="http://news.perlfoundation.org/2008/05/2008q2_grant_proposal_revision.html">Revision Control for all CPAN</a> </li><li> <a href="http://news.perlfoundation.org/2008/05/2008q2_grant_proposal_improve.html">Improve POE::Component::IRC</a> </li><li> <a href="http://news.perlfoundation.org/2008/05/2008q2_grant_proposal_dbeditor.html">DBEditor</a> </li><li> <a href="http://news.perlfoundation.org/2008/05/2008q2_grant_proposal_extendin.html">Extending BSDPAN</a> </li></ul><p>Please take some time on reading the proposals carefully and give some feedback on the relevance of the proposals.</p> ambs 2008-05-01T20:57:40+00:00 perlfoundation Fixing Archive::Any http://use.perl.org/~ambs/journal/36218?from=rss <p>Archive::Any is a small and nice module by Clint Moore to manage ZIP and TGZ files. It also includes some kind of plugin system to be able to open other archive types as well.</p><p>Meanwhile, Clint does not release any new version since November 2006, and there is a critical bug reported since January 2007. A simple bug on a test that makes CPAN to fail installing Archive::Any if Test::POD::Coverage is not installed.</p><p>Given this, I am willing to fix this module and release it. But for that, I would like first to ask if anybody knows Clint, so I can contact him first.</p> ambs 2008-04-22T17:51:39+00:00 modules Benchmarking Say http://use.perl.org/~ambs/journal/36125?from=rss <p>This is strange... use.perl doesn't have Perl as a Journal Topic. Anyway, I think I wrote about this previously, but now I performed some more tests, and thus, here goes some new results. The idea is to compare the new say function to the print function with a new line at the end of the string. To test this, I used the Benchmark module, and two groups of functions: functions that print a string, and functions that print a string with interpolated variables (a scalar and an array).</p><p>The four benchmarked functions were:</p><blockquote><div><p> <tt>our $var1 = "!";<br>our @var2 = qw!Hello World!;<br> <br>sub print_hello { print "Hello World!\n"; }<br> <br>sub say_hello { say "Hello World!"; }<br> <br>sub print_hello_vars { print "@var2$var1\n"; }<br> <br>sub say_hello_vars { say "@var2$var1"; }</tt></p></div> </blockquote><p>The number of iterations was 10,000,000. Given that all these functions print to the standard output, I redirected the output to a temporary file. Also, and to raise the quality of the test, I ran this benchmark three times.</p><p>Now on the results. Do you have any idea of the ordering? Well, first the results were not always the same: say and print swap positions some time. In any case, interpolating on a say is faster, it seems. Check for yourself the three test results:</p><blockquote><div><p> <tt>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Rate&nbsp; &nbsp; printI&nbsp; &nbsp; &nbsp;sayI&nbsp; &nbsp; print&nbsp; &nbsp; &nbsp; say<br>printInterpolate 1587302/s&nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; &nbsp;-18%&nbsp; &nbsp; &nbsp;-67%&nbsp; &nbsp; &nbsp;-70%<br>sayInterpolate&nbsp; &nbsp;1945525/s&nbsp; &nbsp; &nbsp; &nbsp;23%&nbsp; &nbsp; &nbsp; &nbsp;--&nbsp; &nbsp; &nbsp;-60%&nbsp; &nbsp; &nbsp;-63%<br>print&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4807692/s&nbsp; &nbsp; &nbsp; 203%&nbsp; &nbsp; &nbsp;147%&nbsp; &nbsp; &nbsp; &nbsp;--&nbsp; &nbsp; &nbsp; -8%<br>say&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5208333/s&nbsp; &nbsp; &nbsp; 228%&nbsp; &nbsp; &nbsp;168%&nbsp; &nbsp; &nbsp; &nbsp;8%&nbsp; &nbsp; &nbsp; &nbsp;--<br> <br>printInterpolate 1647446/s&nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; &nbsp;-10%&nbsp; &nbsp; &nbsp;-66%&nbsp; &nbsp; &nbsp;-68%<br>sayInterpolate&nbsp; &nbsp;1828154/s&nbsp; &nbsp; &nbsp; &nbsp;11%&nbsp; &nbsp; &nbsp; &nbsp;--&nbsp; &nbsp; &nbsp;-62%&nbsp; &nbsp; &nbsp;-64%<br>say&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4830918/s&nbsp; &nbsp; &nbsp; 193%&nbsp; &nbsp; &nbsp;164%&nbsp; &nbsp; &nbsp; &nbsp;--&nbsp; &nbsp; &nbsp; -6%<br>print&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5128205/s&nbsp; &nbsp; &nbsp; 211%&nbsp; &nbsp; &nbsp;181%&nbsp; &nbsp; &nbsp; &nbsp;6%&nbsp; &nbsp; &nbsp; &nbsp;--<br> <br>printInterpolate 1652893/s&nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; &nbsp;-10%&nbsp; &nbsp; &nbsp;-67%&nbsp; &nbsp; &nbsp;-68%<br>sayInterpolate&nbsp; &nbsp;1831502/s&nbsp; &nbsp; &nbsp; &nbsp;11%&nbsp; &nbsp; &nbsp; &nbsp;--&nbsp; &nbsp; &nbsp;-64%&nbsp; &nbsp; &nbsp;-64%<br>say&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5076142/s&nbsp; &nbsp; &nbsp; 207%&nbsp; &nbsp; &nbsp;177%&nbsp; &nbsp; &nbsp; &nbsp;--&nbsp; &nbsp; &nbsp; -1%<br>print&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5102041/s&nbsp; &nbsp; &nbsp; 209%&nbsp; &nbsp; &nbsp;179%&nbsp; &nbsp; &nbsp; &nbsp;1%&nbsp; &nbsp; &nbsp; &nbsp;--</tt></p></div> </blockquote> ambs 2008-04-10T21:45:54+00:00 newsnews 2008Q2 Call for Grants Proposals http://use.perl.org/~ambs/journal/36047?from=rss <p>The Perl Foundation is looking at giving some grants ranging from $500 to $3000 in May 2008.</p><p>In the past, we've supported Adam Kennedy's PPI and Strawberry Perl, Nicholas Clark's work on Perl internals, Jouke Visser's pVoice, Chris Dolan on Perl::Critic and many others (just check <a href="http://www.perlfoundation.org/grants">http://www.perlfoundation.org/grants</a> for more references).</p><p>You don't have to have a large, complex, or lengthy project. You don't even have to be a Perl master or guru. If you have a good idea and the means and ability to accomplish it, we want to hear from you!</p><p>Do you have something that could benefit the Perl community but just need that little extra help? Submit a grant proposal by April 30.</p><p>As a general rule, a properly formatted grant proposal is more likely to be approved if it meets the following criteria:</p><ul> <li>It has widespread benefit to the Perl community or a large segment of it.</li><li>We have reasons to believe that you can accomplish your goals.</li><li> We can afford it.</li></ul><p>To submit a proposal see the guidelines at <a href="http://www.perlfoundation.org/how_to_write_a_proposal">http://www.perlfoundation.org/how_to_write_a_proposal</a> and TPF rules of operation at <a href="http://www.perlfoundation.org/rules_of_operation">http://www.perlfoundation.org/rules_of_operation</a>. Then send your proposal to <a href="mailto:tpf-proposals@perl-foundation.org">tpf-proposals@perl-foundation.org</a>.</p><p>On May 1st submitters will be contacted individually regarding whether they will let their proposal details be available for public discussion, as public views of grants proposals is likely to become part of the standard in the future.</p> ambs 2008-04-03T18:19:03+00:00 perlfoundation Arch Linux finally with 5.10.0 :( http://use.perl.org/~ambs/journal/35976?from=rss Today my Arch Linux updated its Perl package to 5.10.0 (finally). But, unfortunately, configured in a strange way. Why to put binaries under<nobr> <wbr></nobr>/usr/bin/perlbin/vendor and<nobr> <wbr></nobr>/usr/bin/perlbin/site? <br> <br> I mean, I know that there is that option in the configure script. But the default options (the one that the experts think are the more adequate) put them all together under<nobr> <wbr></nobr>/usr/bin. <br> <br> Now I am compiling Perl by hand (not anything I never did before). I hate to do this, as it breaks the way package updates work. ambs 2008-03-25T20:52:45+00:00 linux