3 CXGN::VHost - backwards-compatible context object to help smooth our
8 my $vhost = CXGN::VHost->new;
11 print "my_conf_variable is ".$vhost->config->{my_conf_variable};
14 print "my_conf_variable is ".$vhost->get_conf('my_conf_variable');
22 use namespace
::autoclean
;
24 extends
'SGN::Context';
27 CXGN::VHost is deprecated, please remove this use.
29 For most modules, all database connections, paths, etc that are now
30 being read from CXGN::VHost should be passed in via mandatory
31 arguments to new(), or similar.
34 after
'new' => sub { croak
<<EOM unless $ENV{MOD_PERL} };
35 CXGN::VHost is not available for use outside of code running under the SGN website.
38 # backwards-compatibility methods
39 around
'get_conf' => sub {
42 my $val = eval{ $self->$orig(@_) };
44 return $val->[0] if ref $val eq 'ARRAY';
48 sub get_conf_arrayref
{
49 shift->config->{+shift}
53 ### some of this might be useful someday for build tests, so keep
54 ### them here commented out where they are more greppable
59 # #check for presence of required settings
60 # foreach my $key (qw/ project_name
68 # unless ( defined $self->{vhost_config}->{$key} ) {
69 # $self->print_warning("No $key given; unable to create vhost object.");
74 # #make sure we can create a configuration object
77 # #now run any test we can think of which might catch a problem before it happens.
80 # my $basepath = $self->{basepath};
81 # unless ( -d ($basepath) ) {
82 # $self->print_warning("Basepath '$basepath' not found.");
86 # # check perllib path
87 # my $perllib_path = $self->{perllib_path};
88 # unless ( -d ($perllib_path) ) {
89 # $self->print_warning("Perllib path '$perllib_path' not found.");
93 # # check document root
94 # my $docroot = $conf->get_conf('document_root_subdir');
95 # unless ( -d ( $basepath . $docroot ) ) {
96 # $self->print_warning("Document root '$basepath$docroot' not found.");
100 # # check executables subdir
101 # my $executable_subdir = $conf->get_conf('executable_subdir');
102 # if ($executable_subdir) {
103 # unless ( -d ( $basepath . $executable_subdir ) ) {
104 # $self->print_warning(
105 # "Executable directory '$basepath$executable_subdir' not found."
111 # my $data_shared_website_path = $conf->get_conf('data_shared_website_path');
112 # if ($data_shared_website_path) {
113 # unless ( -d ($data_shared_website_path) ) {
114 # $self->print_warning(
115 # "Data shared website path '$data_shared_website_path' not found. Attempting configuration anyway."
120 # my $rewrite_log = $conf->get_conf('rewrite_log');
121 # if ($rewrite_log) {
122 # unless ( -f ( $basepath . $rewrite_log ) ) {
123 # $self->print_warning(
124 # "Rewrite log file '$basepath$rewrite_log' not found. Apache will attempt to create this file. If apache cannot create this file, it WILL FAIL TO START."
129 # return 1; #all tests passed