Loading ...
Sorry, an error occurred while loading the content.

Re: Robust way to check for version number [FEATURE REQUEST / HOW-TO]

Expand Messages
  • Dominique Quatravaux
    ... Hash: SHA1 ... It s an OK method for a useless item of knowledge (namely the version of mod_perl2.pm currently loaded), but not for finding out the
    Message 1 of 3 , Jul 4, 2005
    • 0 Attachment
      -----BEGIN PGP SIGNED MESSAGE-----
      Hash: SHA1

      Frank Wiles wrote:


      >>
      >> $ perl -Mmod_perl2 -e 'print $mod_perl2::VERSION' 2.000001
      >
      >
      > Why isn't that a reliable method?

      It's an OK method for a useless item of knowledge (namely the version
      of mod_perl2.pm currently loaded), but not for finding out the
      mod_perl version we are running under (in the CLI example we are
      obviously not running under mod_perl at all).

      >>
      >> sub mod_perl_version { my @discriminating_symbols = (2 =>
      >> "Apache2::XSLoader::BOOTSTRAP", 1.99 =>
      >> "Apache::XSLoader::BOOTSTRAP", 1 => "Apache::exit");
      >>
      >> use B; while(my ($version, $discrimsymbol) =
      >> splice(@discriminating_symbols, 0, 2)) { no strict "refs"; next
      >> if (! exists &{$discrimsymbol}); my $bref =
      >> B::svref_2object(\&{$discrimsymbol}); next if ( (! defined $bref)
      >> || (! $bref->XSUB()) ); return $version; } return undef; }
      >
      >
      > Well I'm not entirely against doing this, but I wouldn't want to
      > support older 1.99 releases of the code. This would just help
      > encourage people to use old unsupported and/or non-standard MP2
      > APIs.

      Oh. Then just remove the relevant line in @discriminating_symbols :-)

      Actually the best thing to do would be to provide a
      mod_perl::running_version() XS sub that gives an authoritative answer.
      I posted my above ad-hoc crock as a temporary workaround to be used by
      other MP2-related package maintainers out there (esp. Apache::DB -
      Pretty please? :), not as a patch suggestion for mod_perl itself.

      > Sorry for the late reply on this, managed to get way behind on
      > E-mail over the last week.
      >
      IMHO you don't need to apologize for this to anybody (benevolent spare
      time etc.). Thanks for your work!


      - --
      Dominique QUATRAVAUX Ingénieur senior
      01 44 42 00 08 IDEALX

      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v1.2.5 (GNU/Linux)
      Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

      iD8DBQFCyPANMJAKAU3mjcsRAoNMAJ0axRZ25MQHtia4PoMD4/R2yszbSQCePTqS
      TNVCVKbUdx2eI8co4dgkHCE=
      =xcw0
      -----END PGP SIGNATURE-----
    Your message has been successfully submitted and would be delivered to recipients shortly.