How do you select the best installed version?

I'm writing about the Standard Perl Library for the Camel book (it still feels really strange to say something like that, like "Yeah, I'm helping ol' Mike paint the ceiling in this church, boy does my back hurt"). I'm going through the various installation directories and the limitations of @INC.

As you know, Perl searches @INC for a matching file. When it finds it, it stops. It won't keep looking for a later version

The ambitious can get around this. You could write a code reference that you stick in the front and completely reimplement the whole process. You can pre-scan the entire @INC and create links in a directory that you put at the front of @INC.

Does anyone actually do that for anything that matters (and not just for giggles)?

I could say a lot more about this, but it's back to the salt mines, ceiling, whatever.



Or you can rearrange @INC:

  @INC = sort @INC;

Leave a comment

About brian d foy

user-pic I'm the author of Mastering Perl, and the co-author of Learning Perl (6th Edition), Intermediate Perl, Programming Perl (4th Edition) and Effective Perl Programming (2nd Edition).