[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cgiapp
Subject:    Re: [cgiapp] CGI::Application::Plugin::Config::Simple and default
From:       Michael Peters <mpeters () plusthree ! com>
Date:       2007-06-26 15:18:35
Message-ID: 46812E4B.9070201 () plusthree ! com
[Download RAW message or body]

Gabor Szabo wrote:
> 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:
>
> How can I make the config file optional?

You can't currently. You could have some fun with eval, but might look a little
ugly....

  my $die_badly = eval { $self->config_param('die_on_bad_params') } || 0;

But it definitely sounds like a useful feature.

Currently I'm not really using C::A::P::C::S, but I will accept patches. In
fact, if anyone wants to take over maintenence of it, I'd gladly pass it on.

-- 
Michael Peters
Developer
Plus Three, LP


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: cgiapp-unsubscribe@lists.erlbaum.net
For additional commands, e-mail: cgiapp-help@lists.erlbaum.net

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic