Tom Wyant

  • About: Fine Perl code for over 0.005 centuries.
  • Commented on Stupid Regexp Trick: Fail on match
    My stupid trick does not in fact accommodate underscores in numbers like Perl does, but I believe it could could easily be made to do so. I did not do this, frankly, because I did not think about it. There...
  • Posted Stupid Regexp Trick: Fail on match to Tom Wyant

    I found myself one day trying to come up with a regexp that matched

    m/ \G \s* (?:
            (?<oct> 0b[01]+ | 0[0-7]+ | 0x[[:xdigit:]]+ ) |
            (?<float> [+-]?(?=\.?\d)\d*\.?\d*(?:e[+-]?\d+)? )
        (?! \w )

  • Posted Stupid perldoc-search trick to Tom Wyant

    Perl's copious documentation is one of the things that keeps me using it. But a pretty good idea where to start looking, can be like finding the proverbial needle in a haystack.

    Fortunately, we have Joshua ben Jo…

  • Commented on MacPorts openssl versus Perl
    In follow-up post Son of MacPorts openssl versus Perl I cover how to find all the Perl modules that link to openssl, re-upgrade to the current openssl, and rebuild the necessary modules....
  • Posted Son of MacPorts openssl versus Perl to Tom Wyant

    This post is a follow-up to MacPorts openssl versus Perl. That post told of a problem with a recent MacPorts openssl upgrade, and gave a workaround.

    The right thing to do, however, is to use the c…

  • Posted MacPorts openssl versus Perl to Tom Wyant

    This is only of interest to Mac users who link their Perl against

    This morning I found that Perl code that used LWP::Protocol::https was failing, but only when run by the test harness.

    After some flailing around…

  • Posted Stupid state trick to Tom Wyant

    Occasionally I find myself writing a Perl subroutine that uses a module that no other part of the code needs. This subroutine may be called multiple times, or not at all. At some point I wondered if putting some logic around the require statement would be faster…

  • Commented on Converting glob patterns to regular expressions
    Minor tweak: if you are matching file names like File::Glob does, you need to exclude '/' from the characters matched by the wildcards. Unless you are allowing '**' to match truly anything, in which case you need to distinguish it...
  • Commented on Serializers for Perl: when to use what
    Small carp: Storable does not do Regexps, at least out of the box. $ perl -MStorable -E 'store qr{ fubar }smx, fubar.tmp' Can't store REGEXP items at /.../lib/site_perl/5.20.1/darwin-2level/ line 259, at -e line 1. $ perl -v; modver Storable This...
  • Posted The Case of the Preferred Parent to Tom Wyant

    In which Dupin expounds on inter-generational relationships.

  • Commented on
    MetaCPAN has a lot of advantages, but there is one thing about which I will miss: the fact that development releases were (so to speak) first-class objects. The author's page showed the latest release regardless of whether it was...
  • Posted Stupid <code>less (1)</code> trick to Tom Wyant

    Do you get tired of reading a man page, or even
    POSIX regex engine instead of something more powerful and Perl-like? I
    know I do. Every time I type

  • Commented on The Problem With Perl Testing
    Very thoughtful. And guilty as charged. The thing that puzzles me is how to reorganize. Tests are code. As code, they can have bugs. More than once I have done a small enhancement and had writing and debugging the test...
  • Posted Announcing Perl::Critic::Policy::ControlStructures::ProhibitForeachHandle to Tom Wyant

    A couple days ago I uploaded a Perl-Critic policy to find and complain about things like foreach ( <FOO> ) {...}. The problem (or at least potential problem) with this is that it sucks the entire file into memory before performing the first iteration. Which…

  • Commented on Comment Submission Error
    I hope the Preview button won't be disabled on the original submission page. It's a lifesaver if your submission has markup in it. Disabling either 'Preview' or 'Submit' or both on the preview page may make a great deal of...
  • Commented on A convention for Changes files
    Vim users may find the following useful: :inoremap <F1> <C-R>=strftime("%Y-%m-%d")<CR> If you're in insert or replace mode, this inserts the current date in the proper format at the cursor when the user hits the <F1> key. In normal mode, :nnoremap...
  • Commented on My Love/Hate Relationship with CPAN Testers
    I love CPAN testers unreservedly, and am puzzled by the OP's apparent belief that he, or at least his failing modules, are stigmatized by test failures. I certainly have never felt this way. It almost makes me wonder of the...
  • Commented on Announcing Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter
    Mithaldu: Thanks for the correction. I could have sworn I went looking for warnings::unused and could not find it, but you can't argue with a working URL. "My mind is going, Dave. I can feel it. I can feel it....
  • Posted Announcing Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter to Tom Wyant

    The subject Perl-Critic policy is an alternate implementation of the core policy Variables::ProhibitUnusedVariables. My implementation attempts to do a more thorough job of finding unused variables.


  • Commented on Don't release experiments to CPAN
    Thank you for the clarification. I have no particular confidence that I could apply your distinction between an experimental module and an experimental implementation to an arbitrary module -- which is not to find fault with you. The fault (if...
  • Commented on Don't release experiments to CPAN
    Why not simply ask people to submit experimental modules under development version numbers? This seems to me (after a grand total of maybe five minutes' thought) to have two advantages over the original proposal: The modules get tested by CPANTESTERS...
  • Commented on Astro::SpaceTrack upgrade
    The Heavens Above web site has a plot of the altitude of the International Space Station over time that you could duplicate. One of my first correspondents was plotting some orbital parameter (ascending node?) of a cluster of Russian navigation...
  • Commented on Astro::SpaceTrack upgrade
    Correction In preparing the threatened release, I discovered that I had pending changes. So: 0.071 will come out today with these changes. 0.072 will come out tomorrow (February 17). It is 0.072 whose only change will be the default value...
  • Posted Astro::SpaceTrack upgrade to Tom Wyant

    For some time now, the Space Track web site, which is the official source for satellite orbital elements, has been working on an upgrade to a REST interface. This interface is scheduled to go live on February 20.

    My module Astro::SpaceTrack retrieves orbital data from the Space Track web s…

  • Commented on A Question of Location
    Wonderful! A piece of deduction worthy of the character in whose mouth you have placed it. I await the next with bated breath....
  • Commented on The Case of the Unexpected Pax
    Have at it. I look forward to your entry. These "cases" were originally going to use a certain late-Victorian London detective, but I was wondering about ownership of the name. But maybe I didn't need to worry. It seems he's...
  • Posted The Case of the Unexpected Pax to Tom Wyant

    It was late afternoon of a chill November in Paris. I was walking along the quai, lost in a brown study. Looking up, I saw my friend C. Auguste Dupin approaching me.

    "Ah, bon soir, mon ami," said Dupin, "and what brings you beside the Seine on this crisp evening?"


  • Commented on Writing version of dependencies
    I've been back and forth on this. Currently I specify whatever I use. That is to say if I use Foo; I specify dependency Foo => 0. If I use Foo 1.2; I specify Foo => 1.2. The use of...
  • Commented on RFC Module::Build::CleanInstall
    Module::Build::Cookbook documents command option --uninst 1. It also appears that Module::Build->new( uninst => 1, ... ) has the effect of defaulting the command option to 1, though I can’t find where this is documented. However, I can’t make it actually...
  • Commented on Proc::ProcessTable needs a C lover
    The Linux patch I apply is -- there are others, but I seem to get along without them. Under OpenBSD, I apply Perhaps more interestingly, a respondent to that ticket expressed the intent to refactor the module. And...
Subscribe to feed Recent Actions from Tom Wyant

  • smls commented on Converting glob patterns to regular expressions

    I wrote this once, for one of my own scripts:

    # Given a glob pattern, return a regex that has the following behavior when
    # matched against Cwd::realpath canolicalized path strings:
    #  - matches successfully if and only if the path would have been matched by
    #    the original glob
    #  - $1, $2, ... will contain what would have been matched by groups of
    #    consecutive wildcards (*, ?, [...]) in the original glob
    #  - $::REGMARK will contain the numeric index of the "brace expansion"
    #    alternative in the original glob that would have first matched the path
    # If  tree => 1 …
  • mauke commented on Converting glob patterns to regular expressions

    The original inspiration for this came from matching general text, not file names. That's why / isn't treated specially.

    (In one place I use this for matching some HTTP header values, in which case . is actually [!#$%&'*+\-.^`|~\w].)

  • mauke commented on Converting glob patterns to regular expressions

    I'm not doing full-blown shell filename expansion, so I simply don't support [...] here.

  • mauke commented on Converting glob patterns to regular expressions

    Eh, it's generated code. I don't care much about how readable it is. :-)

    I don't think your version handles the last case with backslash escapes.

  • mauke commented on Converting glob patterns to regular expressions

    Text::Glob doesn't treat repeated * specially, no. But it supports many other features (wildcards don't match a leading dot, curlies, etc) plus it uses a rather C-like approach to converting the pattern (iterating over single characters, state machine) so it would take more than 10 seconds of looking at it to make any major changes to the algorithm.

Subscribe to feed Responses to Comments from Tom Wyant

About is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is hosted by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.