package LIMS::Titanium;
# just loads plugins, model classes & other dependencies
#use Moose;
#use MooseX::NonMoose; # CGI::App is not Moose class
#extends 'CGI::Application';
use base 'CGI::Application'; # ::Muto; # provides Catalyst-like functions
#no Moose;
# no need to fiddle with inline_constructor here
#__PACKAGE__->meta->make_immutable;
BEGIN {
use LIMS::Local::Config;
use vars qw($path_to_lib);
my $cfg = LIMS::Local::Config->instance; # warn Data::Dumper::Dumper($cfg);
$path_to_lib = $cfg->{path_to_app_root} . '/lib';
# warn 'path_to_lib:'.$path_to_lib;
}
BEGIN {
use Module::Find;
# load all LIMS::Model::* classes:
# "If you use this function (setmoduledirs), @INC will not be included
# automatically, so add it if you want it"
Module::Find::setmoduledirs($path_to_lib); # DEBUG(@INC);
Module::Find::useall LIMS::DB; # DEBUG([@a]);
# my @b = useall LIMS::Model; # DEBUG([@b]); # loaded on demand in model() now
# use Module::Pluggable
# require => 1,
# search_dirs => [ "$path_to_lib/LIMS/DB" ];
unless ($ENV{HARNESS_ACTIVE}) { # NONE OF THIS WORKS ANY MORE - WTF?? - 17/10/2008
# switch on DebugScreen:
# $ENV{CGI_APP_DEBUG} = 1;
# use CGI::Application::Plugin::DebugScreen; # DO NOT USE - causes flash messages to fail
# switch on DevPopup:
# use CGI::Application::Plugin::DevPopup;
# $ENV{CAP_DEVPOPUP_EXEC} = 1;
# switch on DBIProfile:
# use CGI::Application::Plugin::DBIProfile;
# use My::DBIProfile; # join profile output to bottom of page instead of footer
# $ENV{DBI_PROFILE} = '2/CGI::Application::Plugin::DBIProfile::Driver';
# $ENV{CAP_DBIPROFILE_EXEC} = 1;
# make it profile each process - CHECK MEMORY USAGE!!
# $ENV{CAP_DBIPROFILE_PERPROCESS} = 1;
# switch on DBIx::Profile:
# use DBIx::Profile;
# $ENV{DBIXPROFILETRACE} = 1;
}
}
use CGI::Application::Plugin::TT; # automatically adds parameter 'c' to template that returns to $self
use CGI::Application::Plugin::Stash;
use CGI::Application::Plugin::Forward;
use CGI::Application::Plugin::Session;
use CGI::Application::Plugin::ValidateRM;
use CGI::Application::Plugin::FillInForm qw(fill_form);
use CGI::Application::Plugin::AutoRunmode; # or use CAP::RunmodeDeclare instead
use CGI::Application::Plugin::Authentication;
use CGI::Application::Plugin::Authorization;
use CGI::Application::Plugin::MessageStack;
=begin # CAP::LogDispatch / Log::Dispatch and debug setup:
use either CAP::LogDispatch (enable settings in _configure_plugins), or
LIMS::LogDispatch (switch off CAP::LD and edit _configure_plugins).
Set method in debug() as appropriate.
=cut
# use Devel::Cycle; # helps trace circular refs - used in cgiapp_init: Devel::Cycle::find_cycle($self);
use FormValidator::Simple;
use LIMS::Local::CSRF; # form re-submission / cross-site request forgery
use CGI::Pager;
use CGI::Ajax;
# For development, need to activated with an ENV variable.
# use CGI::Application::Plugin::DevPopup::Timing; # required for method timings (not DBI profile)
# use CGI::Application::Standard::Config;
# use CGI::Application::Plugin::LogDispatch; # using LIMS::Local::LogDispatch instead
# use CGI::Application::Plugin::Redirect; # causes ErrorHandler to fail (see README)
# use CGI::Application::Plugin::ErrorPage 'error'; # using AUTOLOAD instead
# use CGI::Application::Plugin::Stream 'stream_file';
# use CGI::Application::Plugin::Flash; # started persisting, using MessageStack instead
# use CGI::Application::Plugin::ConfigAuto qw(cfg); # using LIMS::Local::Config->instance() instead
# use CGI::Application::Plugin::RunmodeDeclare; # using My::RunmodeDeclare to override $self invocant
# use My::RunmodeDeclare; # overrides CAP::RunmodeDeclare::parse_proto() to use $c instead of $self as $signature{invocant}
# use CGI::Application::Plugin::AnyTemplate; # doesn't use template param 'c'
# use CGI::Application::Plugin::AnyCGI; # generates errors about https & can't find patient in register search
# use CGI::Application::Plugin::ActionDispatch;
# use CGI::Simple; #use CGI::Minimal; # Can't locate object method "BINMODE" via package "IO::Capture::Tie_STDx
# use CGI::Application::Plugin::DebugMessage; # nice but output lost on redirect
# use CGI::Application::Plugin::LinkIntegrity;
# use CGI::Application::Plugin::FormState;
# use CGI::Application::Plugin::DBH qw(dbh_config dbh); # using own dbh() method now
# worth a look:
# CGI::Application::Plugin::Menu
# CGI::Application::Plugin::RateLimit
1;