Hi,

I was about to try to use CGI::Application::Plugin::Config::Simple but I wonder
how to set defaults?

As I don't want to make the config file a requirement I put in a condition
to read it only

sub cgiapp_init {
   my ($self) = @_;
   my $file = $self->param('ROOT') . "/ostd.ini";
   if (-e $file) {
       $self->config_file($file);
   }
}

but then if I call
  $self->config_param('die_on_bad_params')
the code dies with the following message in the apache log:

Use of uninitialized value in pattern match (m//) at
/usr/share/perl5/CGI/Application/Plugin/Config/Simple.pm line 194.
Error executing run mode 'show': No config file specified! at
/usr/share/perl5/CGI/Application/Plugin/Config/Simple.pm line 144.

How can I make the config file optional?


BTW if I have the config file bu the particular key is missing I
better write the
options like this to provide some defaults. (I wish I already had //)


sub load_tmpl {
   my ($self, @args) = @_;

   my $t = $self->SUPER::load_tmpl(
       @args,
       die_on_bad_params => $self->config_param('die_on_bad_params') || 0,
   );
   return $t;
}


--
Gabor Szabo
http://www.szabgab.com/
Perl Training in Israel  http://www.pti.co.il/

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to