in reply to Re: Meta-Obfuscation, explanation of
in thread Meta-Obfuscation, explanation of

And you're right about the "require 5.6.0" I added that as I was posting (and of course, forgot to test it) because one of the 5.6-isms occurs in an eval and I didn't want people to wonder what the hell was wrong with it.

I normally assume people run a decent version of perl anyways. :)

  • Comment on Re: Re: Meta-Obfuscation, explanation of

Replies are listed 'Best First'.
fun with require version
by chipmunk (Parson) on Feb 05, 2001 at 20:08 UTC
    This is a fun little gotcha with version strings. The best way to require perl5.6.0 is with require 5.006;. Observe:
    % perl5005 -e 'require 5.6' Perl 5.6 required--this is only version 5.00503, stopped at -e line 1. % perl56 -e 'require 5.6' Perl v5.600.0 required--this is only v5.6.0, stopped (did you mean v5. +6.0?) at -e line 1. % perl56 -e 'require 5.6.0' % perl5005 -e 'require 5.6.0' Can't locate 5.60 in @INC (@INC contains: /usr/lib/perl5/5.00503/i386- +linux /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-linu +x /usr/lib/perl5/site_perl/5.005 .) at -e line 1. % perl5005 -e 'require 5.006' Perl 5.006 required--this is only version 5.00503, stopped at -e line +1. % perl56 -e 'require 5.006' %
    5.6 doesn't work because perl5.6 interprets it as 5.600 instead of 5.006. 5.6.0 doesn't work because perl5.005 and earlier interpret it as a "5.60" and try to load 5.60.pm. 5.006 is the only form that works in old and new versions of Perl.
      I knew this, I've written a few pages on the subject. I just never use it and the head was thinking "oh, some fool's gonna try to run this under 5.005...so let's require 5.6..." and typed it that way. And then wandered off to a movie...