jmx4perl

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

if ($answer) {
    add_reqs(
              "Getopt::Long" => 0,  # req, GetOptionsFromArray must be exported
              "Term::ShellUI" => 0,      # req
              "Term::Clui" => 0,         # req 
              "Term::Size" => "0.207",   # opt 
              "Config::General" => "2.34",# opt
              "File::SearchPath" => 0,   # opt 
              "Crypt::Blowfish_PP" => 0  # opt
             );
    add_script("scripts/j4psh" => 1);
    # check for Term::ReadLine::Gnu
    my $has_gnu_readline = eval "require Term::ReadLine; require Term::ReadLine::Gnu; 1";
    my $has_perl_readline = eval "require Term::ReadLine::Perl; 1";
    if (!$has_gnu_readline) {
        $msg = <<EOT;

Term::ReadLine::Gnu is the recommended readline module, but it is not
necessarily required. It needs a development variant of libreadline
installed along with header files.

Use Term::ReadLine::Gnu ? (y/n)
EOT
        chomp $msg;
        $answer = y_n($msg,"n");
        if ($answer) {
            add_reqs("Term::ReadLine::Gnu" => 0);
        } elsif (!$has_perl_readline) {
            add_reqs("Term::ReadLine::Perl" => 0,
                      "Term::ReadKey" => 0);
        }
    }
}

$msg = <<EOT;

jolokia
=======

jolokia is an utility which helps in downloading
and managing the Jolokia agents (www.jolokia.org), which 
are required on the server side for using jmx4perl.

Install 'jolokia' ? (y/n)
EOT
chomp $msg;
$answer = y_n($msg,"y");
if ($answer) {
    add_reqs(
              "Archive::Zip" => 0,        # req
              "XML::LibXML" => 0,         # req
              "File::Temp" => 0,          # req
              "Digest::MD5" => 0,         # opt
              "Digest::SHA1" => 0,        # opt
              "XML::Twig" => 0,           # opt
              "Term::ProgressBar" => 0    # opt
             );
    add_script("scripts/jolokia" => 1);
    my $has_openpgp = eval "require Crypt::OpenPGP; 1";
    if (!$has_openpgp) {
        my $check = `gpg --version`;
        if ($?) {
            $check = `gpg2 --version`;
            if ($?) {
                $msg = <<EOT;
                
jolokia uses PGP verification for the files downloaded, but neither
Crypt::OpenPGP nor GnuPG is installed. It is highly recommended to 
install at least one of them. Installing Crypt::OpenPGP however can 
be a pain due to its large set of dependencies.

Use Crypt::OpenPGP ? (y/n)
EOT
                chomp $msg;
                $answer = y_n($msg,"y");
                if ($answer) {
                    add_reqs("Crypt::OpenPGP" => 0);
                }
            }
        }
    }
}

# Add extra requirements
sub add_reqs {
    my %to_add = @_;
    for my $k (keys %to_add) {
        $REQS{$k} = $to_add{$k};
    }
}

sub add_script {
    my $script = shift;
    $SCRIPTS{$script} = 1;
}

sub y_n { 
    Module::Build->y_n(@_);
}

# ================================================================================ 

my $build = Module::Build->new
  (
   dist_name => "jmx4perl",
   dist_version_from => "lib/JMX/Jmx4Perl.pm",
   dist_author => 'Roland Huss (roland@cpan.org)',
   dist_abstract => 'Easy JMX access to Java EE applications',
   #sign => 1,
   installdirs => 'site',
   license => 'gpl',
   
   requires => \%REQS,
   script_files => \%SCRIPTS,

   build_requires => {
                      "Module::Build" => "0.34",
                      "Test::More" => "0",
                     },                       
   configure_requires => { 'Module::Build' => 0.34 },
   keywords => [  "JMX", "JEE", "Management", "Nagios", "Java", "Jolokia", "OSGi", "Mule" ],
  );



( run in 0.772 second using v1.01-cache-2.11-cpan-df04353d9ac )