Alien-OpenSSL-Static

 view release on metacpan or  search on metacpan

bin/openssl-env-perl  view on Meta::CPAN

#!/usr/bin/env perl

use strict;
use warnings;

use Alien::OpenSSL::Static;
use Text::ParseWords qw( shellwords );

my %stash = ();

$stash{PATH} = Alien::OpenSSL::Static->bin_dir;
$stash{CFLAGS} = Alien::OpenSSL::Static->cflags;
$stash{LDFLAGS} = Alien::OpenSSL::Static->libs;

$stash{CPATH} = join ':', map {s/^-I//; $_} shellwords( $stash{CFLAGS} );
$stash{LIBRARY_PATH} = join ':', map {s/^-L//; $_}
                                 grep {m/^-L/} shellwords( $stash{LDFLAGS} );

exit 1 unless scalar @ARGV and $ARGV[0];
my $key = $ARGV[0];

if ($key eq 'KEYS') {
  print join ' ', keys %stash;
  exit 0;
}
else {
  exit 1 if !exists $stash{$key};
  if ($key =~ m/PATH/) {
    print join ':', grep {defined} ($stash{$key}, $ENV{$key});
  }
  else {
    print join ' ', grep {defined} ($stash{$key}, $ENV{$key});
  }
  exit 0;
}



( run in 0.467 second using v1.01-cache-2.11-cpan-f6376fbd888 )