AFS

 view release on metacpan or  search on metacpan

src/BOS/BOS.pm  view on Meta::CPAN

package AFS::BOS;
#------------------------------------------------------------------------------
# RCS-Id: "@(#)$RCS-Id: src/BOS/BOS.pm 7a64d4d Wed May 1 22:05:49 2013 +0200 Norbert E Gruener$"
#
# © 2005-2010 Norbert E. Gruener <nog@MPA-Garching.MPG.de>
# © 2003-2004 Alf Wachsmann <alfw@slac.stanford.edu> and
#             Norbert E. Gruener <nog@MPA-Garching.MPG.de>
#
# This library is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#------------------------------------------------------------------------------

use Carp;
use AFS ();

use vars qw(@ISA $VERSION);

@ISA     = qw(AFS);
$VERSION = 'v2.6.4';

sub DESTROY {
    my (undef, undef, undef, $subroutine) = caller(1);
    if (! defined $subroutine or $subroutine !~ /eval/) { undef $_[0]; }  # self->DESTROY
    else { AFS::BOS::_DESTROY($_[0]); }                                   # undef self
}

sub create {
    my $self     = shift;
    my $process  = shift;
    my $type     = shift;
    my $command  = shift;
    my $notifier = shift;

    if (! defined $process ||
        ! defined $type    ||
        ! defined $command) {
        carp "AFS::BOS->create: incomplete arguements specified ...\n";
        return 0;
    }

    if (ref($command) eq 'ARRAY') {
        if ($notifier) { $self->_create($process, $type, $command, $notifier); }
        else           { $self->_create($process, $type, $command); }
    }
    elsif (ref($command) eq '' ) {
        my @commands;
        $commands[0] = $command;
        if ($notifier) { $self->_create($process, $type, \@commands, $notifier); }
        else           { $self->_create($process, $type, \@commands); }
    }
    else {
        carp "AFS::BOS->create: not a valid COMMAND input ...\n";
        return 0;
    }
}

sub restart {
    my $self = shift;


    if ($#_ == 0 and ref($_[0]) eq 'ARRAY') {            # SERVER is array ref
        $self->_restart(0, 0, @_);
    }
    elsif ($#_ == 0 and ref($_[0]) eq '') {              # SERVER is scalar
        my @server;
        $server[0] = shift;
        $self->_restart(0, 0, \@server);
    }
    else {
        carp "AFS::BOS->restart: not a valid input ...\n";
        return undef;
    }
}

sub restart_all {
    my $self = shift;

    $self->_restart(0, 1);
}

sub restart_bos {
    my $self = shift;

    $self->_restart(1);
}

sub start {
    my $self = shift;

    if ($#_ == 0 and ref($_[0]) eq 'ARRAY') {            # SERVER is array ref
        $self->_start(@_);
    }
    elsif ($#_ == 0 and ref($_[0]) eq '') {              # SERVER is scalar
        my @server;
        $server[0] = shift;
        $self->_start(\@server);
    }
    else {
        carp "AFS::BOS->start: not a valid input ...\n";
        return undef;
    }
}

sub startup {
    my $self = shift;

    if ($#_ == -1) {                                     # no input given
        $self->_startup();
    }



( run in 2.694 seconds using v1.01-cache-2.11-cpan-d8267643d1d )