Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 976 Categories, Downloaded 35.237.945 Times

CGI::AppBuilder::Config 0.12

Company: Hanming Tu
Date Added: September 09, 2013  |  Visits: 380


Report Broken Link
Printer Friendly Version

Product Homepage
Download (24 downloads)

This class provides methods for reading and parsing configuration files.<br />new (ifn => 'file.cfg', opt => 'hvS:')<br /><br />This is a inherited method from CGI::AppBuilder. See the same method in CGI::AppBuilder for more details.<br />get_inputs($ifn, $opt)<br /><br />Input variables:<br /><br /> $ifn - input/initial file name. <br /> $opt - options for Getopt::Std, for instance 'vhS:a:'<br /><br />Variables used or routines called:<br /><br /> None<br /><br />How to use:<br /><br /> my $ar = $self->get_inputs('/tmp/my_init.cfg','vhS:');<br /><br />Return: ($q, $ar) where $q is the CGI object and $ar is a hash array reference containing parameters from web form, or command line and/or configuration file if specified.<br /><br />This method performs the following tasks:<br /><br /> 1) create a CGI object<br /> 2) get input from CGI web form or command line <br /> 3) read initial file if provided<br /> 4) merge the two inputs into one hash array<br /><br />This method uses the following rules:<br /><br /> 1) All parameters in the initial file can not be changed through<br /> command line or web form;<br /> 2) The "-S" option in command line can be used to set non-single<br /> char parameters in the format of <br /> -S k1=value1:k2=value2<br /> 3) Single char parameters are included only if they are listed<br /> in $opt input variable.<br /><br />Some parameters are dfined automatically:<br /><br /> script_name - $ENV{SCRIPT_NAME} <br /> url_dn - $ENV{HTTP_HOST}<br /> home_url - http://$ENV{HTTP_HOST}<br /> HomeLoc - http://$ENV{HTTP_HOST}/<br /> version - $VERSION<br /> action - https://$ENV{HTTP_HOST}$ENV{SCRIPT_NAME}<br /> encoding - application/x-www-form-urlencoded<br /> method - POST<br /><br />read_init_file($fn, $dvr)<br /><br />Input variables:<br /><br /> $fn - full path to a file name<br /> $dvr - delay variable replacement<br /> 0 - No (default)<br /> 1 - yes<br /><br />Variables used or routines called:<br /><br /> eval_variables - replace variables with their values<br /><br /> CGI::AppBuilder::Message<br /> echo_msg - echo messages<br /><br />How to use:<br /><br /> my $ar = $self->read_init_file('crop.ini');<br /><br />Return: a hash array ref<br /><br />This method reads a configuraton file containing parameters in the format of key=values. Multiple lines is allowed for values as long as the lines after the "key=" line are indented as least with two blanks. For instance:<br /><br /> width = 80<br /> desc = This is a long<br /> description about the value<br /> # you can define perl hash araay as well<br /> msg = {<br /> 101 => "msg 101",<br /> 102 => "msg 102"<br /> }<br /> # you can use variable as well<br /> js_var = /my/js/var_file.js<br /> js_src = /my/first/js/prg.js,$js_var<br /><br />This will create a hash array of<br /><br /> $ar->{width} = 80<br /> $ar->{desc} = "This is a long description about the value"<br /> $ar->{msg} = {101=>"msg 101",102=>"msg 102"}<br /> $ar->{js_var}= "/my/js/var_file.js";<br /> $ar->{js_src}= "/my/first/js/prg.js,/my/js/var_file.js";<br /><br />eval_variables($cfg, $hr)<br /><br />Input variables:<br /><br /> $cfg - a hash array ref containing variable names<br /> $hr - a hash array ref contianing varliable values<br /><br />Variables used or routines called:<br /><br /> eval_named_var - get named variables' values<br /> eval_var - get variables' values<br /><br />How to use:<br /><br /> my $mr = $self->eval_variables($cfg, $hr);<br /><br />Return: a hash or hash ref.<br /><br />This method evaluates the configuration hash and replace variable names with their values up to 5 levels of nested variables. For instance, you have the following configuration hash:<br /><br /> my $cfg = { a=>10, b=>"$a+2", c=>"2*($b)", d=>"$c-1", <br /> result=>"3*($d)" }<br /> my $mk = $self->eval_variables($cfg); <br /><br />This will result $cfg to<br /><br /> a = 10<br /> b = 10+2<br /> c = 2*(10+2)<br /> d = 2*(10+2)-1<br /> result = 3*(2*(10+2)-1)<br /><br />eval_var($cfg, $hr)<br /><br />Input variables:<br /><br /> $cfg - a hash ref containing variable names<br /> $hr - a hash ref which will be used to search for values <br /><br />Variables used or routines called:<br /><br /> None<br /><br />How to use:<br /><br /> my $cfg = {first_name=>'John', last_name=>'Smith',<br /> full_name => "$first_name $last_name",<br /> addr1=>"111 Main Street",<br /> city=>"Philadelphia", zip_code=>"19102",<br /> address => "$addr1, $city, PA $zip_code",<br /> contact=>"$full_name <address>$address</address> $logo",<br /> };<br /> my $hr = { logo => '', };<br /> my $p1 = $self->eval_var($cfg, $hr);<br /> my $p2 = $self->eval_var($cfg, $hr);<br /> # The first pass will get full_name, address replaced with values<br /> # but leave contact with variable names in it.<br /> # The second pass will get first_name, last_name, and address in<br /> # contact replaced with their values. <br /><br />Return: a hash or hash ref<br /><br />This method evaluates the variable names contained in a configuration hash and replace the variable names with their values.<br />eval_named_var($hr, $vn, $sr)<br /><br />Input variables:<br /><br /> $hr - a hash array ref containing variable names<br /> $vn - variable name default to 'ENV' <br /> $sr - source hash ref. If omitted, {%$vn} will be used.<br /><br />Variables used or routines called:<br /><br /> None<br /><br />How to use:<br /><br /> my %ENV = (HTTP_HOST=>'',USER=>'htu');<br /> my $hr = {first_name=>'John', last_name=>'Smith'};<br /> my $cfg = { hh=>'$ENV{HTTP_HOST}',usr=>'$ENV{USER}',<br /> fn=>'$hr{first_name}', ln=>'$hr{last_name}',<br /> };<br /> my $p1 = $self->eval_named_var($cfg, 'ENV');<br /> # the first pass will get <br /> # $cfg->{hh} = ''<br /> # $cfg->{usr} = 'htu'<br /> my $p2 = $self->eval_named_var($cfg, 'hr', $hr);<br /> # the second pass will get <br /> # $cfg->{fn} = 'John'<br /> # $cfg->{ln} = 'Smith'<br /><br />Return: a hash or hash ref<br /><br />This method evaluates the variable names contained in a configuration hash and replace the variable names with their values.<br />read_cfg_file($fn,$ot, $fs)<br /><br />Input variables:<br /><br /> $fn - full path to a file name<br /> $ot - output array type: A(array) or H(hash)<br /> $fs - field separator, default to vertical bar (|)<br /><br />Variables used or routines called:<br /><br /> CGI::AppBuilder::Message<br /> echo_msg - display message<br /><br />How to use:<br /><br /> my $arf = $self->read_cfg_file('crop.cfg', 'H');<br /><br />Return: an array or hash array ref containing (${$arf}[$i]{$itm}, ${$arf}[$i][$j];<br /><br />This method reads a configuraton file containing delimited fields. It looks a line starting with '#CN:' for column names. If it finds the line, it uses to define the first row in the array or use the column names as keys in the hash array.<br /><br />The default output type is A(array). It will read the field names into the first row ([0][0]~[0][n]). If output array type is hash, then it uses the columns name as keys such as ${$arf}[$i]{key}. If it does not find '#CN:' line, it will use 'FD001' ~ 'FD###' as keys.<br /><br /> #Form: fm1<br /> #CN: Step|VarName|DispName|Action|Description <br /> 0.0|t1|Title||CROP Worksheet <br /><br />

Requirements: No special requirements
Platforms: *nix, Linux
Keyword: Array Called Command Configuration Default Evaluates Method Names Nonehow Parameters Refthis Replace Routines Values Variable Variables
Users rating: 0/10

License: Freeware Size: 10.24 KB
More Reviews or Write Review

Miscellaneous  -  Right method names suggestion 1.2
This script uses __getattr__ to modify the error messages given when a wrong class method is called. It shows the first five ranked most similar method names, followed by the first line of their docstrings (this is useful to see their parameters,...
Programming  -  Net::Vypress::Chat 0.72.1
Net::Vypress::Chat is object oriented module and can only be used this way. What's about recognise() function i tried to stay as consistent as i can, but some values are mixed up. Module has these methods: new() Initialises new...
10.24 KB  
Programming  -  SpecLoud 0.3.1
SpecLoud is a Python module to use nosetests and plugins to take BDD specifications easier. Installation The easiest way to install specloud is using pip and requirements file: pip install --no-deps specloud -r...
10.24 KB  
Libraries  -  Class::NiceApi 0.01.02
Class::NiceApi is a Perl module that translates your methodNames to my method_names. SYNOPSIS use Class::NiceApi; my $acl = Class::NiceApi->new( victim => Decision::ACL->new(), style => custom, table => { run_acl => RunACL } ); Perl method...
3.07 KB  
Development Tools  -  Generalized Objective Function 1.0
In order to optimize any MATLAB function, there are two options: 1) rewrite the function to take only 1 array of inputs, reading all others from a file, perhaps, or from a global variable (undesirable), or 2) write an interface layer that handles...
10 KB  
Programming  -  tkintertable 1.0.0
Python uses a GUI library called Tkinter as default. This set of classes allows interactive spreadsheet-style tables to be added into an application. Tkinter is the standard GUI toolkit for python. It is old and at times unwieldy to use...
81.92 KB  
Programming  -  Fetcher 1.4
An HTTP Client that supports every HTTP Request method with custom parameters, custom body and custom headers. Features: -If cookies are present Fetcher will use them -Highlights and formats response JSON and XML -Add custom head
614.4 KB  
Libraries  -  XAO::DO::FS::Config 1.06
XAO::DO::FS::Config is an embeddable configuration object for XAO::FS. SYNOPSIS use XAO::Projects; use XAO::Objects; my $config=XAO::Objects->new(objname => Config, sitename => test); XAO::Projects::create_project(name => test, object...
98.3 KB  
Libraries  -  Method::Declarative 0.03
Method::Declarative is a Perl module to create methods with declarative syntax. SYNOPSIS use Method::Declarative ( --defaults => { precheck => [ [ qw(precheck1 arg1 arg2) ], # ... ], postcheck => [ [ qw(postcheck1 arg3 arg4) ], #...
8.19 KB  
Modules  -  Vertical Tabs Default Tab 6.x-1.0-rc3
Vertical Tabs module allows you to output form (in our case, node form) fieldsets as vertical tabs. Vertical Tabs Default Tab advances this behaviour, allowing you to move remaining top level node form elements (including, but not limited to title...
10 KB  
Linux Software  -  Driver Booster
Driver Booster 7 can update all outdated/faulty/missing drivers in 1-click with a database of 3, 500, 000+ drivers, which ensures all outdated drivers and game components can be updated for Windows users. And all the supported drivers have passed...
24.64 MB  
Linux Software  -  EasyEDA PCB Designer for Linux 2.0.0
EasyEDA, a great web based EDA(Electronics Design Automation) tool, online PCB tool, online PCB software for electronics engineers, educators, students, makers and enthusiasts. Theres no need to install any software. Just open EasyEDA in any...
34.4 MB  
Linux Software  -  wpCache® WordPress HTTP Cache 1.9
wpCache® is a high-performance, distributed object, caching system application, generic in nature, but intended for use in speeding up dynamic web applications, by decreasing database load time. wpCache® decreases dramatically the page...
3.51 MB  
Linux Software  -  Polling Autodialer Software 3.4
ICTBroadcast Auto Dialer software has a survey campaign for telephone surveys and polls. This auto dialer software automatically dials a list of numbers and asks them a set of questions that they can respond to, by using their telephone keypad....
488 B  
Linux Software  -  Total Video Converter Mac Free 3.5.5
Total Video Converter Mac Free developed by EffectMatrix Ltd is the official legal version of Total Video Converter which was a globally recognized brand since 2006. Total Video Converter Mac Free is a free but powerful all-in-one video...
17.7 MB  
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  Math::GMPf 0.29
Math::GMPf - perl interface to the GMP library's floating point (mpf) functions.
30.72 KB  
Programming  -  Net::Wire10 1.08
Net::Wire10 is a Pure Perl connector that talks to Sphinx, MySQL and Drizzle servers. Net::Wire10 implements the low-level network protocol, alias the MySQL wire protocol version 10, necessary for talking to one of the aforementioned...
30.72 KB  
Programming  -  logilab-common 0.56.2
a bunch of modules providing low level functionnalities shared among some python projects devel Please note that some of the modules have some extra dependencies. For instance, logilab.common.db will require a db-api 2.0 compliant...
174.08 KB  
Programming  -  OpenSSL for linux 1.0.0a
The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a...
3.83 MB