On Fri, Sep 10, 2010 at 07:11:18AM +0100, David Cantrell wrote:
> Sometimes you need to check whether a binary is a GNU or a normal
> version.  For example, GNU tar has the -z option, and GNU cp has the -l
> option, and GNU make is Just Plan Weird.  Any suggestions for how to
> name a module that would check this?
> 
> It would be a very simple wrapper around:
> 
>   `$binary --version` =~ /(gnu|free software foundation)/i
> 
> I'm thinking something like ExtUtils::CheckForGNUbinary.

Scrap that. It should be more along the lines of checking for
capabilities rather than merely for GNU-ness, with GNU-ness being just
one of many capabilities.  For example, GNU tar may *or may not* support
the -j flag, depending on whether bzip2 support is available.

Even so, I still need a good suggestion for a name :-)

The interface will be fairly similar to that for
Devel::{Check|Assert}OS, so Devel::CheckBinary might be a good choice.

Then, to check that /bin/tar supports the -j flag and that /bin/cp is
GNU cp, you might do something like ...

use Insert::Name::Here, '/bin/tar' => 'TarMinusJ';
use Insert::Name::Here, '/bin/cp'  => 'GNU';

-- 
David Cantrell | Official London Perl Mongers Bad Influence

Us Germans take our humour very seriously
  -- German cultural attache talking to the Today Programme,
     about the German supposed lack of a sense of humour, 29 Aug 2001

Reply via email to