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 29.873.011 Times

CGI::AppBuilder::Config 0.12

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

CGI::AppBuilder::Config

Report Broken Link
Printer Friendly Version


Product Homepage
Download (16 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 => 'http://mydomain.com/images/logo.gif', };<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=>'testdomain.com:8000',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} = 'testdomain.com:8000'<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
USER REVIEWS
More Reviews or Write Review


CGI::APPBUILDER::CONFIG RELATED
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  
Network & Internet  -  Genders 1.6-1
Genders is a static cluster configuration database used for cluster configuration management. Genders is used by a variety of tools and scripts for management of large clusters. The genders database is accessed by every node in a cluster, either...
163.84 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  
NEW DOWNLOADS IN LINUX SOFTWARE, PROGRAMMING
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  
Linux Software  -  Skeith mod_log_sql Analyzer 2.10beta2
Skeith is a php based front end for analyzing logs for Apache using mod_log_sql.
47.5 KB  
Linux Software  -  SLAX 6.0+
Slax is a modern, portable, small and fast Linux operating system with a modular approach and outstanding design. Despite its small size, Slax provides a wide collection of pre-installed software for daily use, including a well organized graphical...
190 KB  
Linux Software  -  GTK+ 2.5
GTK+, which stands for the GIMP Toolkit, is a library for creating graphical user interfaces for the X Window System. It is designed to be small, efficient, and flexible. GTK+ is written in C with a very object-oriented approach. Language bindings...
60 MB  
Programming  -  FLEX-db Digital Asset Manager 3.0.9
FLEX-db - an enterprise Digital Asset Manager (DAM). It ingests and links metadata with files, creates thumbnails, and processes files using business rules. FLEX-db has a JSP client, Java app server for file input and output and an EJB metadata...
21.57 MB  
Programming  -  Libicom 0.9.0
The libicom library is a character based dynamicly linked library for Linux. It is used to remotely control the Icom IC-R8500 wide band receiver via an RS232 link. All call and return parameters to the control functions are character string based....
20.48 KB  
Programming  -  dotdesktop 0.3
Dotdesktop library provides ability to parse desktop entry file and access the information in a convenient way. Desktop entry file format is defined by freedesktop.org, it is used to describe information about an application such as the name and...
327.68 KB  
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  -  libyasl 0.2
Libyasl is a C++ class library to easily realize TCP/UDP/Multicast clientsand servers in IPv4 and IPv6 environments under GNU/Linux systems.
143.36 KB