> On Thursday 07 March 2013 11:00:37 Ken Peng wrote:
> > Hello,
> > 
> > How do you setup config file in modperl web development?
> > I currently use the style like a package:
> > ...
> > I don't know if this is a good way. Do you have suggestions?
> 
> I am not an expert here, but I think it's acceptable way. YAML is another 
> alternative. Here's my example for model call validation config:
> ---
> params:
>     ip:
>         regex: ^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$
>         default: defaults.ip

        It's important to note that IPv6 addresses are excluded by that 
RegEx formula.  I suggest either changing "ip" to "ip4" or adding 
support for IPv6 addresses as well (which is not going to be anywhere 
near as straight-forward as matching a basic IPv4 pattern).

[End of reply.]

>     cookie:
>         max-size: 40
>         min-size: 4
> result:
>     OK:
>         redirect: /appIndex
>         set-cookie:
>             auth:
>               value: TT response.auth
>               secure: 1
>               expires: +1d
>               domain: .fr.iii.la
> call_method: model
> allowed_source:
>     - submit # ajax, submit, template
>     - ajax
> 
> This config translates into Perl structure with hashes and arrays (Dumper 
> output):
> $VAR1 = {                                                                     
>                                                                               
>                                                                               
>                                      
>   'params' => {                                                               
>                                                                               
>                                                                               
>                                      
>     'ip' => {                                                                 
>                                                                               
>                                                                               
>                                      
>       'regex' => '^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$',               
>                                                                               
>                                                                               
>                                      
>       'default' => 'defaults.ip'                                              
>                                                                               
>                                                                               
>                                      
>     },                                                                        
>                                                                               
>                                                                               
>                                      
>     'cookie' => {                                                             
>                                                                               
>                                                                               
>                                      
>       'min-size' => 4,                                                        
>                                                                               
>                                                                               
>                                      
>       'max-size' => 40                                                        
>                                                                               
>                                                                               
>                                      
>     }                                                                         
>                                                                               
>                                                                               
>                                      
>   },                                                                          
>                                                                               
>                                                                               
>                                      
>   'call_method' => 'model',                                                   
>                                                                               
>                                                                               
>                                      
>   'allowed_source' => [                                                       
>                                                                               
>                                                                               
>                                      
>     'submit',                                                                 
>                                                                               
>                                                                               
>                                      
>     'ajax'                                                                    
>                                                                               
>                                                                               
>                                      
>   ],                                                                          
>                                                                               
>                                                                               
>                                      
>   'result' => {                                                               
>                                                                               
>                                                                               
>                                      
>     'OK' => {                                                                 
>                                                                               
>                                                                               
>                                      
>       'set-cookie' => {                                                       
>                                                                               
>                                                                               
>                                      
>         'auth' => {                                                           
>                                                                               
>                                                                               
>                                      
>           'domain' => '.fr.iii.la',                                           
>                                                                               
>                                                                               
>                                      
>           'value' => 'TT response.auth',                                      
>                                                                               
>                                                                               
>                                      
>           'secure' => 1,                                                      
>                                                                               
>                                                                               
>                                      
>           'expires' => '+1d'                                                  
>                                                                               
>                                                                               
>                                      
>         }                                                                     
>                                                                               
>                                                                               
>                                      
>       },                                                                      
>                                                                               
>                                                                               
>                                      
>       'redirect' => '/appIndex'                                               
>                                                                               
>                                                                               
>                                      
>     }                                                                         
>                                                                               
>                                                                               
>                                      
>   }                                                                           
>                                                                               
>                                                                               
>                                      
> };                                                                            
>                                                                               
>                                                                               
>                                      
> --
> Anton Petrusevich


Randolf Richardson - rand...@inter-corporate.com
Inter-Corporate Computer & Network Services, Inc.
Beautiful British Columbia, Canada
http://www.inter-corporate.com/


Reply via email to