Start of cluster module

This commit is contained in:
Duncan Ferguson 2011-11-18 22:44:08 +00:00
parent be0ff95430
commit 26e3ab7ef7
2 changed files with 102 additions and 0 deletions

View file

@ -0,0 +1,74 @@
package App::ClusterSSH::Cluster;
use strict;
use warnings;
use version;
our $VERSION = version->new('0.01');
use Carp;
use Try::Tiny;
use base qw/ App::ClusterSSH::Base /;
our $master_object_ref;
sub new {
my ( $class, %args ) = @_;
if ( !$master_object_ref ) {
$master_object_ref = $class->SUPER::new(%args);
}
return $master_object_ref;
}
#use overload (
# q{""} => sub {
# my ($self) = @_;
# return $self->{hostname};
# },
# fallback => 1,
#);
1;
=pod
=head1 NAME
App::ClusterSSH::Cluster
=head1 SYNOPSIS
=head1 DESCRIPTION
Object representing application configuration
=head1 METHODS
=over 4
=item $host=ClusterSSH::Cluster->new();
Create a new object.
=back
=head1 AUTHOR
Duncan Ferguson, C<< <duncan_j_ferguson at yahoo.co.uk> >>
=head1 LICENSE AND COPYRIGHT
Copyright 1999-2010 Duncan Ferguson.
This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
=cut
1;

28
t/30cluster.t Normal file
View file

@ -0,0 +1,28 @@
use strict;
use warnings;
use FindBin qw($Bin $Script);
use lib "$Bin/../lib";
use Test::More;
use Test::Trap;
use File::Which qw(which);
use File::Temp qw(tempdir);
use Readonly;
BEGIN {
use_ok("App::ClusterSSH::Cluster") || BAIL_OUT('failed to use module');
}
my $cluster1 = App::ClusterSSH::Cluster->new();
isa_ok( $cluster1, 'App::ClusterSSH::Cluster' );
my $cluster2 = App::ClusterSSH::Cluster->new();
isa_ok( $cluster2, 'App::ClusterSSH::Cluster' );
$cluster1->{cluster} = 'fred';
ok( defined( $cluster2->{cluster} ), 'Shared cluster object' );
done_testing();