in reply to Favourite modules April 2003

At the moment:
  • Parse::RecDescent - I am an old lex/yacc language designer. The other day I actually had cause to write a little language. I am overwhelmed by how flexible and powerful this module is. All the joy of yacc without all the pain of yacc Thanks Damian!
  • Quantum::Superpositions - Takes a whole class of simple operations that were too complex in Perl and makes them simple again (comparing lists, set operations, etc).
  • DBD::Chart DBIx::Chart - there is nothing like charts to make PHBs happy. And there is nothing like a package with which you can implement them in minutes to make you look good.
  • Data::Locations - makes it simple to build text when you don't necessarily want to build it sequentially, like when building a web page. You can define handles that print into a specific part of your final output. So you could define a skeleton of a web page, have a script handle, a style handle, a body handle, etc. Write the appropriate stuff to the appropriate handle then dump it at the end.
  • Data::Dumper - Couldn't function without it.
  • Date::Calc - All the date manipulation I ever need, in one place.
  • Spreadsheet::ParseExcel Spreadsheet::WriteExcel Allows you to use excel as a data entry mechanism. A great alternative to web forms for really complex data, or for management-type users who a very proficient in excel, but not-so-good elsewhere, Also a great report generation method.
  • CPAN - best mechanism ever for automated installation. It's the life blood of what make Perl sucessful. (Although I hear the CPANPLUS is even better. It's on my short list of things to try).

    "Dude, those llamas are pissed!"
  • Replies are listed 'Best First'.
    Quantum::Superpositions for comparing lists, set operations, etc
    by zby (Vicar) on Apr 15, 2003 at 14:20 UTC
      Quantum::Superpositions - Takes a whole class of simple operations that were too complex in Perl and makes them simple again (comparing lists, set operations, etc) - that was a suprise for me. The name does not idicate that it's such a general purpose module.

        I've known about Q::S for a long time, but I always thought it's a joke (and inefficiently implemented) that TheDamian forgot to put inside the Acme namespace :) (Don't know where I got that impression). However, I happily admit that I was wrong -- there is quite a number of articles and nodes about Q::S now that show its usefulness. It was only today that Randal posted a link showing how to win football bets all the time using Q::S :).

        Also, recent versions seem to be rather efficient. I haven't looked at the source yet, but I assume that it's more efficient and better debugged than anything I'd quickly hack together if I were in the need for it.

          Well, one should realize people were releasing (joke) modules before someone came up with the Acme:: namespace.


          I thought that it is aimed at computing scientists to test new algorithms for factoring large numbers.
        A surprise to me as well, and I'll be reviewing it again.

        As dense as I must be, from having read about it earlier, I guess I didn't understand the viewpoint or jargon or whatever from various write-ups, including it's own docs.

        I never thought I was stupid... but maybe I should rethink that...

        Think perl 6's junctions.

    Re: Re: Favourite modules April 2003
    by BrowserUk (Pope) on Apr 16, 2003 at 06:34 UTC

      Just a word of caution to anyone seduced by the power of Quantum::Superpositioning (as I was around 10 months ago:) : Quick, it ain't; Memory hungry it is.

      It's a fun, and very powerful demonstraton of some powerful concepts, but using it in workaday code is costly.

      To demonstrate that, I reimplemented the brute force algorithms shown in the Q::S pod for is_prime(), factors() and GCD() using fairly standard perl, and the result show that this is not permature micro-optimisation I am talking about:

      The benchmark

      The results

      D:\Perl\test>qs-test s/iter Q::S perl Q::S 282 -- -98% perl 4.87 5702% -- Primes found: Q::S:1229; Perl:1229 s/iter QS_factors PL_factors QS_factors 322 -- -100% PL_factors 0.120 267905% -- qs:90 80 2 48 180 360 18 72 30 144 16 6 240 120 3 36 40 9 12 15 20 8 4 + 60 24 45 10 5 pl:2 3 4 5 6 8 9 10 12 15 16 18 20 24 30 36 40 45 48 60 72 80 90 120 1 +44 180 240 360 s/iter QS_GCD PL_GCD QS_GCD 336 -- -100% PL_GCD 0.148 226174% -- QS:60 - PL:60

      To put that into perspective, the non-Q::S version of is_prime() will find the 9592 prime < 100,000 in approximately half the time the Q::S version finds the 1229 < 10,000.

      The non Q::S version of factors() will find the approx: 400,000 factors of 2!..9! in around a 5th of the time required by the Q::S version to find the approx 6000 factors of 2! .. 6!.

      And The non-Q::S version will perform the approx: 400,000 divisions and int's and the approx: 800,000 comparisons involved in finding the GCD() (using this algorithm) between each succesive pair of factorial 2! thru 9! in about 1/5th the time taken for the Q::S version to do the (approx) 12,000 divisions, 6,000 int's and 12,000 comparisons.

      Even when used for simple testing of arrays against constants Eg.if (all(@array) != 1) {...) the overheads are quite heavy and can quite quickly invoke swapping if your arrays are of any size.

      Hopefully, once the functionality is moved into the core as C or XS, this caveat will disappear.

      Examine what is said, not who speaks.
      1) When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
      2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible
      3) Any sufficiently advanced technology is indistinguishable from magic.
      Arthur C. Clarke.