Alien-ActiveMQ

 view release on metacpan or  search on metacpan

inc/Module/AutoInstall.pm  view on Meta::CPAN

    return 1 if -w $path;

    print << ".";
*** You are not allowed to write to the directory '$path';
    the installation may fail due to insufficient permissions.
.

    if (
        eval '$>' and lc(`sudo -V`) =~ /version/ and _prompt(
            qq(
==> Should we try to re-execute the autoinstall process with 'sudo'?),
            ((-t STDIN) ? 'y' : 'n')
        ) =~ /^[Yy]/
      )
    {

        # try to bootstrap ourselves from sudo
        print << ".";
*** Trying to re-execute the autoinstall process with 'sudo'...
.
        my $missing = join( ',', @Missing );
        my $config = join( ',',
            UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config} )
          if $Config;

        return
          unless system( 'sudo', $^X, $0, "--config=$config",
            "--installdeps=$missing" );

inc/Module/Install.pm  view on Meta::CPAN

sub _write {
	local *FH;
	open( FH, "> $_[0]"  ) or die "open($_[0]): $!";
	foreach ( 1 .. $#_ ) {
		print FH $_[$_] or die "print($_[0]): $!";
	}
	close FH or die "close($_[0]): $!";
}
END_OLD

# _version is for processing module versions (eg, 1.03_05) not
# Perl versions (eg, 5.8.1).
sub _version ($) {
	my $s = shift || 0;
	my $d =()= $s =~ /(\.)/g;
	if ( $d >= 2 ) {
		# Normalise multipart versions
		$s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg;
	}
	$s =~ s/^(\d+)\.?//;
	my $l = $1 || 0;

inc/Module/Install/Makefile.pm  view on Meta::CPAN

		grep $_,
		($self->configure_requires, $self->build_requires)
	);

	# Remove any reference to perl, BUILD_REQUIRES doesn't support it
	delete $args->{BUILD_REQUIRES}->{perl};

	# Delete bundled dists from prereq_pm, add it to Makefile DIR
	my $subdirs = ($args->{DIR} || []);
	if ($self->bundles) {
		my %processed;
		foreach my $bundle (@{ $self->bundles }) {
			my ($mod_name, $dist_dir) = @$bundle;
			delete $prereq->{$mod_name};
			$dist_dir = File::Basename::basename($dist_dir); # dir for building this module
			if (not exists $processed{$dist_dir}) {
				if (-d $dist_dir) {
					# List as sub-directory to be processed by make
					push @$subdirs, $dist_dir;
				}
				# Else do nothing: the module is already present on the system
				$processed{$dist_dir} = undef;
			}
		}
	}

	unless ( $self->makemaker('6.55_03') ) {
		%$prereq = (%$prereq,%$build_prereq);
		delete $args->{BUILD_REQUIRES};
	}

	if ( my $perl_version = $self->perl_version ) {

inc/Module/Install/Win32.pm  view on Meta::CPAN


  http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe
      or
  ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe

Please download the file manually, save it to a directory in %PATH% (e.g.
C:\WINDOWS\COMMAND\), then launch the MS-DOS command line shell, "cd" to
that directory, and run "Nmake15.exe" from there; that will create the
'nmake.exe' file needed by this module.

You may then resume the installation process described in README.

-------------------------------------------------------------------------------
END_MESSAGE

}

1;

inc/Module/Install/WriteAll.pm  view on Meta::CPAN

	# Until ExtUtils::MakeMaker support MYMETA.yml, make sure
	# we clean it up properly ourself.
	$self->realclean_files('MYMETA.yml');

	if ( $args{inline} ) {
		$self->Inline->write;
	} else {
		$self->Makefile->write;
	}

	# The Makefile write process adds a couple of dependencies,
	# so write the META.yml files after the Makefile.
	if ( $args{meta} ) {
		$self->Meta->write;
	}

	# Experimental support for MYMETA
	if ( $ENV{X_MYMETA} ) {
		if ( $ENV{X_MYMETA} eq 'JSON' ) {
			$self->Meta->write_mymeta_json;
		} else {

lib/Alien/ActiveMQ.pm  view on Meta::CPAN

    my $dir = $self->get_version_dir($version);
      my @cmd = ( file( $dir, 'bin', 'activemq' ) );

      # Check if we need to use the console verb to get the command to start.
      my $consoleflag = $self->_check_output( [ @cmd, '--help' ], qr/(stop)/ );

      if ($consoleflag) {
        push @cmd, 'console';
    }

    # Start activemq in a subprocess
    $self->_output("Running @cmd");
    my $h = start \@cmd, \undef;

    my $pid = $h->{KIDS}[0]{PID}; # FIXME!
    # Spin until we can get a connection
    my ( $stomp, $loop_count );
    while ( !$stomp ) {
        if ( $loop_count++ > $self->startup_timeout ) {
            $h->signal("KILL");
            die "Can't connect to ActiveMQ after trying "

t/start_stop.t  view on Meta::CPAN

is_deeply( [ Alien::ActiveMQ::Mock->get_installed_versions() ],
    [ qw/ 5.9.9 5.1.9/ ],
    'Ignored extra subdir'
);

# Start a "version" which requires 'console' to stay in the foreground
{
    my $stomp = Test::MockModule->new( 'Net::Stomp' );
    my $try = 0;
    # This simulates a couple of retries while the server starts.
    # It also lets the process actually run.
    $stomp->mock(new => sub {
        $try++;
        if($try < 2) {
            die "Not ready.";
        }
        return 1;
    });

    my $amq = Alien::ActiveMQ::Mock->new;
    is($amq->get_version_dir(), $_dist_dir->subdir('5.9.9'),

t/start_stop.t  view on Meta::CPAN

    is($amq->_output_data->[-1],
        'Killing ApacheMQ...',
        'Found amq shutdown');
}

# Start a "version" which needs no parameters to stay in the foreground
{
    my $stomp = Test::MockModule->new( 'Net::Stomp' );
    my $try = 0;
    # This simulates a couple of retries while the server starts.
    # It also lets the process actually run.
    $stomp->mock(new => sub {
        $try++;
        if($try < 2) {
            die "Not ready.";
        }
        return 1;
    });

    my $amq = Alien::ActiveMQ::Mock->new;
    is($amq->get_version_dir('5.1.9'), $_dist_dir->subdir('5.1.9'),

t/start_stop.t  view on Meta::CPAN

    is($amq->_output_data->[-1],
        'Killing ApacheMQ...',
        'Found amq shutdown');
}

# Verify we still start as a class method, too.
{
    my $stomp = Test::MockModule->new( 'Net::Stomp' );
    my $try = 0;
    # This simulates a couple of retries while the server starts.
    # It also lets the process actually run.
    $stomp->mock(new => sub {
        $try++;
        if($try < 2) {
            die "Not ready.";
        }
        return 1;
    });

    no warnings qw/ redefine /;
    local *Alien::ActiveMQ::_dist_dir = sub {



( run in 0.272 second using v1.01-cache-2.11-cpan-8d75d55dd25 )