Test::Nightly::Base - Internal base methods


Test-Nightly documentation Contained in the Test-Nightly distribution.

Index


Code Index:

NAME

Top

Test::Nightly::Base - Internal base methods

DESCRIPTION

Top

Provides internal base methods for the Test::Nightly::* modules. You don't have to worry about what is here.

AUTHOR

Top

Kirstin Bettiol <kirstinbettiol@gmail.com>

COPYRIGHT

Top

SEE ALSO

Top

Test::Nightly, Test::Nightly::Test, Test::Nightly::Report, Test::Nightly::Email, perl.


Test-Nightly documentation Contained in the Test-Nightly distribution.
package Test::Nightly::Base;

use strict;
use warnings;

use Carp;

use Test::Nightly::Email;

use base 'Class::Accessor::Fast';

my @methods = qw(
	debug
	report_template
);

__PACKAGE__->mk_accessors(@methods);

our $VERSION = '0.03';

#
# _init()
#
# Initialises the methods that have been passed in.
#

sub _init {

    my ($self, $conf, $methods) = @_;

    $self->{_is_win32} = ( $^O =~ /^(MS)?Win32$/ );
    $self->{_is_macos} = ( $^O eq 'MacOS' );

	my @all_methods = @{$methods};
	push (@all_methods, @methods);

    my $is_obj = 1 if ref($conf) =~ /Test::Night/;
    foreach my $method (@all_methods) {

        if (defined $conf->{$method}) {
            if($is_obj) {
                $self->$method($conf->$method());
            } else {
                $self->$method($conf->{$method});
            }
        }
    }

}

#
# _debug()
#
# Carps a debug message.
#

sub _debug {

    my ($self, $msg) = @_;

    if (defined $self->debug()) {
        carp $msg;
    }

}

#
# _perl_command()
#
# Returns the command to run perl.
#

sub _perl_command {

    my $self = shift;

    return $ENV{HARNESS_PERL}           if defined $ENV{HARNESS_PERL};
    return Win32::GetShortPathName($^X) if $self->{_is_win32};
    return $^X;

}

1;