Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Nice writeup. However, you have a tiny log error in your for loops. They're not equivalent.

    $ perl -le '$m = 3;for ($i=0; $i<$m;$i++) {print $i}'
    0
    1
    2
    $ perl -le '$m = 3;for (0..$m) {print}'
    0
    1
    2
    3

    Change that first $i < $max to $i <= $max and you'll be fine.

  • An empty if-clause with a comment can serve to document your thought processes.

    if (is_mungo_sorted @items) {
        # The list is already in the order we need.
    }
    else {
        # Need to sort them in bogological order.
        @items = rearrange @items;
    }

    There's often a more elegant way to express things but an explicit do-nothing is sometimes the way I think about the problem, and it's good to have a way to comment that.

    BTW, why doesn't the comment b

    --
    -- Ed Avis ed@membled.com
    • That's true. Shlomi Fish also expressed this point.

      I personally try not to write things like that because I get irritated seeing an empty if(). It feels like there should be something there and I (or whoever wrote it) has forgotten or hasn't implemented it. So, to me it adds to the confusion but I can see how other people find it useful and expressive. Perhaps there should be a comment that says # already ordered. do nothing.

      And yeah, I tried using h2, h3 and other stuff. These boxes don't get much...

  • In Perl::Dist(::WiX), the goal is to create and package a new installation of perl, with added modules as required. (upgrading core modules, providing SQLite for CPAN use, etc.)

    The last part right now is implemented by writing out scripts from the old perl that are executed in the NEW perl to install modules there, and to query which modules require upgraded.

    What would be your solution to that? Note that we are using the current version of perl (I use 5.10.0) to create 5.8.8, 5.8.9, and 5.10.0 installations

    --
    The new Strawberry Perl for Windows has been released! Check http://strawberryperl.com for it.
    • The problem with writing intermediate programs by wrapping them in a q(), qq() or endless concatenations is that it's unclear and hard to maintain. There are a few options that help make it easier and more understandable and thus more maintainable but you can't always use them:

      Using a template such as Text::Template or Template Toolkit is the best option IMHO. That is, if you're able to read files from your environment. Considering you're writing to it, you can probably read.

      Manually creating a template and