Snippets

David Ihnen app load test

Created by David Ihnen
#!perl

my $ba = new BigApp( context => 'test' );

$ba->RESTapp->run;

package BigApp;

use Moose;
use Config::Locale;

has context => ( is => 'ro', isa => 'Str' );
has config => ( is => 'ro', isa => 'HashRef', builder => '_get_config' );

sub _get_config {
    my $self = shift;
    return Config::Locale->loadAll( context => $self->context );
}

has reportEngine => (
    is      => 'ro',
    isa     => 'BigApp::ReportEngine',
    builder => '_build_re',
);

sub _build_re {
    my $self = shift;
    return BigApp::ReportEngine::new( $self->config );
}

has RESTapp => (
    is      => 'ro',
    isa     => 'BigApp::ReportEngine',
    builder => '_load_report_engine',
);

sub _load_REST_engine {
    my $self     = shift;
    my $subclass = $self->config->RESTType;
    my $class    = "Replay::RESTEngine" . $subclass;
    return $class->new(
        config       => $self->config,
        reportEngine => $self->reportEngine
    );
}

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.