user-pic

3ee5cf54-f022-4a71-8666-3c2b5ee231dd [openid.stackexchange.com]

  • Commented on A Date with CPAN, Update #3: Golden Jubilee
    I would test multiplication like this: is foo(2, 3), 6, "multiplication works"; just hard-coding the answer. It sounds like in avoiding hard-coding the answer, you've gotten a fragile test suite that accidentally tests additional modules. Getting the code right once...
  • Commented on I'm not positive about this...
    Personally, I think 1 (obviously) makes sense; the rest are weird Perl unary-minus behaviors. Remember that Perl (unlike shell or C) does not let you concatenate strings by putting them next to each other; instead you have to use ....
  • Commented on What's happening with DBD::Oracle?
    I'm using DBD::Oracle for work, too. Though I hope we migrate to PostgreSQL or MariaDB someday......
  • Commented on Alternatives to rand()
    The only downside is the slow performance, which is typical of the AES-CTR algorithm. It shouldn't be on semi-recent hardware (which has AES support). On my not-so-recent box, openssl speed -evp chacha20 gets 1.6GB/sec with big blocks, but … -evp...
  • Commented on Golang's 'defer' in Perl
    In your make_upper_caser_iterator example, I'm pretty sure that $fh becoming unreferenced closes the file anyway. So the explicit close isn't needed (except, of course, that you could check the result and handle errors). Also, if your file handle is valid...
  • Commented on Cool Perl 6 features available in Perl 5
    You don't need Quote::Code: say "2 + 2 = @{[2 + 2]}"; # "2 + 2 = 4" That has worked in perl5 for quite a while—I think the newest feature used there is "say"....
Subscribe to feed Recent Actions from 3ee5cf54-f022-4a71-8666-3c2b5ee231dd [openid.stackexchange.com]

  • Grinnz commented on A Date with CPAN, Update #3: Golden Jubilee

    A variant similar to what you added is coming to a future version of Time::Local. PR#15 (links cause comments to be invisibly held for approval)

  • Tom Metro commented on A Date with CPAN, Update #3: Golden Jubilee

    >hardcoding test results has other problems

    We always coach developers to use hard coded test data to the extent practical. When writing tests you have to unlearn a lot of DRY principles. We tolerate a lot more repetition, and factor it out sparingly.

    There are two main reasons why you do this:
    1. Any bit of clever calculation in your test could could be wrong. Hard coded values are easy to hand verify.
    2. Your test should read like an example of how to use your API, and having lots of layers of indirection and data generators makes the code less readable.

  • Buddy Burden commented on A Date with CPAN, Update #3: Golden Jubilee

    > A variant similar to what you added is coming to a future version of Time::Local. PR#15

    It looks like it's there already! I'm looking forward to converting over to using these new functions: timegm_posix and timelocal_posix. Should make my job much easier. :-)

  • Buddy Burden commented on A Date with CPAN, Update #3: Golden Jubilee

    > We always coach developers to use hard coded test data to the extent practical. When writing tests you have to unlearn a lot of DRY principles. ...

    What you're suggesting can be good advice—I certainly agree that repeating yourself in unit tests is often preferable to being too clever in them, for instance—but I don't believe it is always good advice. Unfortunately, I think a proper response is beyond a comment here; perhaps I'll compose a larger blog post on this very topic in order to discuss the pros and cons.

    > Are you not able to explicitly set envir…

  • lowjoe commented on Alternatives to rand()

    Math::Random::MTwist is now only available from Backpan. It disappeared without any notice.

Subscribe to feed Responses to Comments from 3ee5cf54-f022-4a71-8666-3c2b5ee231dd [openid.stackexchange.com]

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.