view release on metacpan or search on metacpan
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: ARSObject
version: 0.57
version_from: lib/ARSObject.pm
installdirs: site
requires:
distribution_type: module
generated_by: ExtUtils::MakeMaker version 6.30
lib/ARSObject.pm view on Meta::CPAN
# ,-diemsg => undef #
,-warn=>undef # , see set() and connect() below
# ,-warnmsg => undef #
,-cpcon=>undef # Translation to console codepage sub{}(self, args) -> translated
,-echo=>0 # Echo printout switch
,-dbi=>undef # DBI object, by dbiconnect()
,-dbiconnect =>undef #
,-cgi=>undef # CGI object, by cgi()
,-smtp=>undef
,-smtphost=>undef
#,-fpl=>[] # CGI Form Presenter fields list
#,-fphc=>{} # CGI fields cache
#,-fphd=>{} # DB fields cache
#,-fpbv=>[] # buffer values
#,-fpbn=>'' # buffer name == record common name
};
bless $s,$c;
set($s, @_);
$s->{-storable} =eval('use Storable; 1') if !exists($s->{-storable});
$s
}
lib/ARSObject.pm view on Meta::CPAN
}
sub dsparse { # Data structure dump string to perl structure
my ($s, $d) =@_; # (string) -> data structure
eval('use Safe; 1')
&& Safe->new()->reval($d)
}
sub dscmp { # Compare data structures
my($s, $ds1, $ds2) =@_;
return(1) if (defined($ds1) && !defined($ds2)) ||(defined($ds2) && !defined($ds1));
return(0) if !defined($ds1) && !defined($ds2);
return(1) if (ref($ds1) ||'') ne (ref($ds2) ||'');
return($ds1 cmp $ds2) if !ref($ds1);
return(dsquot($s,$ds1) cmp dsquot($s,$ds2)) if ref($ds1) eq 'ARRAY';
return(dsquot($s,$ds1) cmp dsquot($s,$ds2)) if ref($ds1) eq 'HASH';
$ds1 cmp $ds2
}
lib/ARSObject.pm view on Meta::CPAN
sub disconnect { # Disconnect data servers
my $s =shift;
$s->{-ctrl} && eval{ars_Logoff($s->{-ctrl})};
$s->{-ctrl}=undef;
$s->{-dbi} && eval{$s->{-dbi}->disconnect()};
$s->{-dbi} =undef;
}
sub arsmeta { # Load/refresh ARS metadata
my $s =shift; # -srv, -usr, -pswd, -lang
$s->set(@_);
local $s->{-cmd} =($s->{-cmd} ? $s->{-cmd} .': ' : '')
.($s->{-schgen} ? "dumper('" .$s->vfname('meta') ."')" : 'arsmeta()');
if (ref($s->{-schgen})
|| ($s->{-schgen} && ($s->{-schgen} >1))
|| (!-e $s->vfname('-meta'))
) {
#
# Data types:
lib/ARSObject.pm view on Meta::CPAN
if $s->{-metaid}->{$id}->{fieldName}
&& !$s->{-metadn}->{$s->{-metaid}->{$id}->{fieldName}};
}
}
# print $s->cpcon($s->dsdump($s->{-metaid})), "\n"; exit(0);
}
}
sub arsmetamin { # Minimal ARS metadata ('-meta-min' varfile)
my $s =shift; # refresh after 'arsmeta'/'connect'
$s->set(@_); # load instead of 'arsmeta'/'connect'
local $s->{-cmd} =($s->{-cmd} ? $s->{-cmd} .': ' : '')
.($s->{-schgen} ? "dumper('" .$s->vfname('meta-min') ."')" : 'arsmetamin()');
if (ref($s->{-schgen})
|| !$s->{-schgen}
|| ($s->{-schgen} && ($s->{-schgen} >1))
|| (!-e $s->vfname('-meta-min'))
) {
$s->arsmeta() if !$s->{-meta} ||!scalar(%{$s->{-meta}});
my $fvs =[stat $s->vfname('-meta-min')]->[9] ||0;
lib/ARSObject.pm view on Meta::CPAN
}
}
$s->arsmetaix()
}
delete $s->{'-meta-min'};
$s;
}
sub arsmetasql { # SQL ARS metadata ('-meta-sql' varfile)
my $s =shift; # refresh after 'arsmeta'/'connect'
$s->set(@_); # !!! 'enum' texts
local $s->{-cmd} =($s->{-cmd} ? $s->{-cmd} .': ' : '')
.($s->{-schgen} ? "dumper('" .$s->vfname('meta-sql') ."')" : 'arsmetasql()');
if (ref($s->{-schgen})
|| !$s->{-schgen}
|| ($s->{-schgen} && ($s->{-schgen} >1))
|| (!-e $s->vfname('-meta-sql'))
) {
$s->arsmeta() if !$s->{-meta} ||!scalar(%{$s->{-meta}});
my $fvs =[stat $s->vfname('-meta-sql')]->[9] ||0;
lib/ARSObject.pm view on Meta::CPAN
.($_[0] eq '3' ?'>=' :'==') .'0){')
.'l.selectedIndex =i; break;};}};'
.($_[0] && ($_[0] ne '4')
? 'return(false);'
: $_[0] && ($_[0] eq '2')
? 'return(false);'
: '')
.'}}'};
($s->{-cgi}->param("${n}__O_")
? "<div><script for=\"$n\" event=\"onkeypress\">" .&$fs(0) ."</script>\n"
: '')
.$s->{-cgi}->textfield((map {defined($_) && defined($a{$_})
? ($_ => $a{$_})
: $a{-textfield} && $a{-textfield}->{$_} && !$s->{-cgi}->param("${n}__O_")
? ($_ => $a{-textfield}->{$_})
: ()
} qw(-name -title -class -style -size -maxlength))
, -default=>$v
, -override=>1
, ($a{-strict} && !$s->{-cgi}->param("${n}__O_")
? (-readonly=>1) # ,-hidefocus=>0, -disabled=>0
: ())
)
.($s->{-cgi}->param("${n}__O_")
? ("<input type=\"submit\" name=\"${n}__X_\" value=\"X\" title=\"close\"$ac$as />"
."<input type=\"hidden\" name=\"${n}__P_\" value=\"" .(defined($v) ? $s->{-cgi}->escapeHTML($v) : '') ."\"$ac$as />\n"
."<br />\n"
."<select name=\"${n}__L_\" title=\"select value\" size=\"10\""
."$ac$as"
." ondblclick=\"{${n}__S_.focus(); ${n}__S_.click(); return(true)}\""
." onkeypress=\"" .($s->{-cgi}->user_agent('MSIE') ? &$fs(1) : &$fs(2))
."\">\n"
.join('',map {'<option'
.((defined($v) ? $v : '') eq (defined($_) ? $_ : '') ? ' selected' : '')
.' value="' .$s->{-cgi}->escapeHTML(defined($_) ? $_ : '') .'">'
.$s->{-cgi}->escapeHTML(
!defined($_)
? ''
: !$a{-labels}
? (length($_) > $aw ? substr($_,0,$aw) .'...' : $_)
: defined($a{-labels}->{$_})
lib/ARSObject.pm view on Meta::CPAN
print("$cmd # $l\n");
$s->fstore(">>$lf", $s->strtime() ."\t$$\t$cmd # $l\n")
if $lf;
system($cmd);
}
}
1
}
sub cfpinit { # Field Player: init data structures
my ($s) =@_; # (self) -> self
$s->{-fphc} ={};
$s->{-fphd} ={};
my $dh ={};
my $dp =undef;
my $ah ={};
my $ak;
my $bf =undef;
foreach my $f (@{$s->{-fpl}}) {
if (ref($f) && $f->{-key} && $f->{-namecgi}) {
lib/ARSObject.pm view on Meta::CPAN
&$emsg($s, $err ||"Unknown 'cfpaction' error");
$err =1;
last;
}
}
if ($f->{-key}) {
$act =undef;
}
next if !cfpused($s, $f);
my $fn =cfpn($s, $f);
if (!$f->{-reset}
? undef
: ref($f->{-reset}) eq 'CODE'
? &{$f->{-reset}}($s, $f)
: ref($f->{-reset}) eq 'ARRAY'
? grep {cfpvcc($s, $_)} @{$f->{-reset}}
# ??? read from URL interpreted as changed listbox
: $f->{-reset}
? cfpvcc($s, $f->{-reset})
: undef
) {
$s->{-cgi}->delete($fn);
}
my $fv =exists($f->{-computed})
? (ref($f->{-computed}) eq 'CODE'
? &{$f->{-computed}}($s, $f)
: ref($f->{-computed}) eq 'ARRAY'
? cfpvv($s, @{$f->{-computed}})
: $f->{-computed})
lib/ARSObject.pod view on Meta::CPAN
=head1 NAME
ARSObject - high level interface above ARS module
=head1 SYNOPSIS
use ARSObject;
my $s =ARSObject->new(-srv =>'ip address',-usr => 'username',-pswd =>'******'
,-storable => 0
,-schema =>['BMC.CORE:BMC_ComputerSystem','BMC.CORE:BMC_ApplicationSystem']
,-metaid =>{
'1' => 'RequestId'
,'6' => 'ModifiedDate'
,'179' => 'InstanceId'
,'1000000001' => {fieldName=>'Company'}
,'200000020' => 'Name'
});
$s->connect();
lib/ARSObject.pod view on Meta::CPAN
C<entryNew>() method may be used to form new record hash with default values for C<entryIns>().
C<entryDif>() method may be used to minimise data for C<entryUpd>().
C<AUTOLOAD>() method is to call 'ARS::ars_XXX' functions as methods.
Special processing added for 'HPD:Help Desk' ITSM Suite form.
C<Variable files> may be used to cache any data.
Misc C<Utility Methods> intended for strings, dates, data structures.
C<Utility Objects> added to simplify and unify access to
L<DBI|DBI>, L<CGI|CGI>, L<Net::SMTP|Net/SMTP> modules.
=back
=head1 CLASSIFICATION
lib/ARSObject.pod view on Meta::CPAN
=item SQL Data Store Methods
C<arsmetasql>, C<sqlname>, C<dbidsmetasync>, C<dbidsrpl>, C<dbidsquery>;
C<-meta-sql>; C<-sqlschema>;
C<-sqlname>, C<-sqlntbl>, C<-sqlncol>, C<-sqlninc>
=item CGI Form Presenter
C<-fpl> => [-formdb=>'...',-record=>'...', {action field},.. {view/edit field},.., {button field},..}]
C<-fphc> => {'cgi field name' => {field definition},..}
C<-fphd> => {'db field name' => {field definition},..}
C<cfprun>, C<cfpaction>, C<cfpv>, C<cfpvv>, C<cfpvl>, C<cfpvp>
* action field: C<-name>.., C<-preact> || C<-action>, C<-widget>=>undef, C<-used>=>condition sub{}
lib/ARSObject.pod view on Meta::CPAN
* text: C<-widget>=>'html'
* edit field: C<-name>..,
* computed: C<-name>.., C<-computed>=>sub{}
* readonly: C<-name>.., C<-readonly>=>1
* do not store: C<-name>.., C<-entryIns>=>0, C<-entryUpd>=>0, C<-vfstore>=>0
* list&refresh: C<-name>.., C<-onchange>=>1, C<-labels>, C<-values>
* optional button field: C<-name>.., C<-action>=>1, C<-used>=>condition
=item CGI Form Presenter - Field Definitions
(for each field inside C<CGI Form Presenter - Fields>)
C<-name>, C<-namecgi>, C<-namedb>, C<-metadb> => 'field name'
C<-namelbl>, C<-namecmt> => 'text for user'
C<-namehtml> => sub{} -> 'html for user'
C<-formdb> => 'name', C<-record> => 'name' || 'nameRowNumber'
C<-used>, C<-unused> => boolean || 'field name' || ['field',...] || condition sub{}
lib/ARSObject.pod view on Meta::CPAN
C<-key> => boolean
C<-master> => 'field name'
C<-computed>, C<-value> => value || ['field from'] || sub{} -> value
C<-undef> => value
C<-values> => [value,..] || sub{}, C<-labels> => {value => label,..} || sub{}; C<-lbtran>, C<-lbadd> => boolean
C<-reset> => 'field name' || ['field',...] || condition sub{}
C<-change> => {set field values}
C<-error>, C<-warn> => sub{} -> 'text'
C<-widget> => {definitions for cgi field in the C<Utility Objects>} || html || sub{}->html
Field definitions may be used also:
C<-action> => 1;
C<-labels>, C<-values>;
C<-disabled>, C<-readonly>, C<-hidden>, C<-onchange> => boolean.
lib/ARSObject.pod view on Meta::CPAN
=item -action
=> not exists
|| sub{}({self}, action, '-action'
, {key field}, $_= key value, key pv
, {field db name=>value,..}, prev return)
-> success || {field db name => value}
|| 'entryIns' || 'entryUpd' || 'entryDel' || 'entrySave'
|| 1
(C<CGI Form Presenter - Field Definitions>)
Action to execute after the form performance,
should be at the top of the form, before C<-key> fields.
May be several actions with the same C<-namecgi>.
1 - action button, it should to be at the bottom of the form.
For 'entrySave' action, 'entryUpd' is used when non-empty key value,
'entryDel' otherwise with non-empty previous key value.
See also C<-preact>.
lib/ARSObject.pod view on Meta::CPAN
See also C<cgi> method.
=item -change
=> not exists
|| {field name => value || sub{}({self}, {field}, $_ =value),..}
|| {value=>{field name => value,..},..}
(C<CGI Form Presenter - Field Definitions>)
Change field values when this field changed.
This may be defined also as C<-values> or C<-labels>.
=item -computed
=> not exists || value || [field name] || sub{}({self},{field}) -> value
(C<CGI Form Presenter - Field Definitions>)
Computed field value evaluator.
See also C<-value>.
=item -cpcon
=> undef || sub{}(self, arg,...) -> translated
(C<Error Processing and Echo>)
Translation sub{} for error messages and C<-echo> printout.
lib/ARSObject.pod view on Meta::CPAN
The logical number of the entry inserted by C<entryIns>().
=item -error
=> not exists
|| sub{}({self}, {field}, $_ =field value, previous value) -> 'error text'
|| 'error text for empty field'
(C<CGI Form Presenter - Field Definitions>)
Field value error evaluator
See also C<-warn>.
=item -fpl
=> [-formdb=>'...',-record=>'...'
, {action field},.. {view/edit field},.., {button field},..}]
=item -fphc
=> {'cgi field name' => {field definition},..}
=item -fphd
=> {'db field name' => {field definition},..}
(C<CGI Form Presenter>)
Definitions of fields:
list of field in order to be evaluated,
field definitions by cgi names,
field definitions by ARS names.
=item -formdb
=> 'db form name'
(C<CGI Form Presenter - Field Definitions>)
db form name, may be defined as a
special C<-fpl> entry before field definitions.
=item -key
=> => not exists || boolean
(C<CGI Form Presenter - Field Definitions>)
Key database field?
=item -labels
=> not exists || {value=>label,..} || {value=>{{-label=>label, field=>value,..},..}
|| sub{}({self},{field},$_=value) -> {value=>label,..}
(C<CGI Form Presenter - Field Definitions>)
Labels for the drop-down list box field.
If no C<-values>, this will be generated automatically.
Special {-name=>name, field=>value,..} form is to define C<-change>.
See also C<-values>.
=item -lbtran
=item -lbadd
=> not exists || true || false (default)
(C<CGI Form Presenter - Field Definitions>)
Translate list box value with C<-labels> if needed?
Add field value to C<-values> if not listed?
=item -lang
=> '' || 'ARS language' || 'en_US' || 'ru_RU'...
(C<Connection>)
ARS language to use for session, i.e. 'en_US'
=item -master
=> not exists || 'master field name'
(C<CGI Form Presenter - Field Definitions>)
Name of the field containg value for this field.
=item -metadb
=> not exists || 'ARS field name'
(C<CGI Form Presenter - Field Definitions>)
ARS field name to be used for field metadata:
C<-name>, C<-namelbl>, C<-labels>, C<-value>, etc.
=item -name
=> not exists || 'common field name'
=item -namecgi
lib/ARSObject.pod view on Meta::CPAN
=> not exists || 'field label'
=item -namecmt
=> not exists || 'comment text'
=item -namehtml
=> not exists || sub{}(self, {field}, 'widget html') -> 'label html'
(C<CGI Form Presenter - Field Definitions>)
Field names, label, comment text.
If C<-name> exists, it's value may be used as C<-namedb>,
and escaped value may be used as C<-namecgi>.
=item -maxRetrieve
=> 0 || number of rows
(C<ARS methods>)
lib/ARSObject.pod view on Meta::CPAN
(C<Metadata>)
Used by C<arsmetamin> internally.
=item -meta-sql
=> undef || {SQL Data Store metadata}
(C<Metadata>, C<SQL Data Store Methods>, C<Variable files>)
SQL Data Store metadata loaded or refreshed by C<arsmetasql>()/C<sqlname>():
{tableName}->{-cols}->{sqlName}=>{fieldName, sqlName,...}
{tableName}->{-fields}->{fieldName}=>sqlName
{tableName}->{-ids}->{fieldId}=>sqlName
{-forms}->{formName}->{tableName}
=item -preact
=> not exists
|| sub{}({self}, action, '-preact'
, {key field}, $_= key value, key pv
, {field db name=>value,..})
-> success || {field db name => value}
|| 'vfentry' || 'vfhash' || 'entry' || 'entryNew'
(C<CGI Form Presenter - Field Definitions>)
Action to execute before the form performance,
should be at the top of the form, before C<-key> fields.
May be several actions with the same C<-namecgi>.
Alternative key field name may be passed as L<CGI|CGI>->param(action-name).
See alco C<-action>.
=item -pswd
=> undef || ''
(C<Connection>)
ARS password string to login with
=item -record
=> 'record name' || 'nameRowNumber'
(C<CGI Form Presenter - Field Definitions>)
Record name, if several records in screen,
may be defined as a special C<-fpl> entry after C<-formdb> entry.
Record name may be followed by row number.
=item -reset
=> not exists || 'field name' || ['field name',..] || sub{}({self}, {field})
(C<CGI Form Presenter - Field Definitions>)
Condition to reset field value.
If C<-values> and field value unfound, it will be reset also.
=item -schema
=> undef || [form name, form name...]
(C<Metadata>)
ARS forms or schemas to use.
Metadata will be loaded to C<-meta> and may be cached with C<vfname>(C<-meta>)
if C<-schgen>.
lib/ARSObject.pod view on Meta::CPAN
Translate ARS field values using metadata and conversion sub{}s.
1 - using 'enumLimits' and C<strtime>/C<timestr>('yyyy-mm-dd hh:mm:ss'),
2 - using at first localisation metadata for enum fields ('fieldLbvl').
=item -undef
=> not exists || value
(C<CGI Form Presenter - Field Definitions>)
Field value to be treated as undef or null for database.
See also C<-value>.
=item -used
=> not exists == 1 || boolean || 'field name' || ['field name',..]
|| sub{}({self}, {field})
=item -unused
=> not exists == 0 || boolean || 'field name' || ['field name',..]
|| sub{}({self}, {field})
(C<CGI Form Presenter - Field Definitions>)
Condition to use or unuse field in the screen and actions.
=item -usr
=> undef || 'ARS user name'
(C<Connection>)
ARS user name to login under
=item -value
=> not exists || value || [field name] || sub{}({self},{field}) -> value
(C<CGI Form Presenter - Field Definitions>)
Default field value or field value evaluator.
See also C<-computed>.
=item -values
=> not exists || [value,..] || [{-name=>name, field=>value,..},..]
|| sub{}({self},{field},$_=value) -> [value,..]
(C<CGI Form Presenter - Field Definitions>)
Values for the drop-down list box field
Special {-name=>name, field=>value,..} form is to define C<-change>.
See also C<-labels>.
=item -vfbase
=> 'script file path name-' || 'base file path name' || 'directory path/'
lib/ARSObject.pod view on Meta::CPAN
=> not exists || boolean
=item -vfedit
=> not exists || boolean
=item -vftran
=> not exists || boolean
(C<CGI Form Presenter - Field Definitions>)
Short name of the C<Variable File>
to read record from with C<-action>=>'vfentry' or C<-action>=>'vfhash';
or to renew or update after C<-action>=>'entryIns' || 'entryUpd' || 'entryDel'
May be used with C<-action> or C<-key> field.
C<-vfrenew> - renew variable file after 'entryIns' || 'entryUpd' || 'entryDel'
C<-vfedit> - update variable file after 'entryIns' || 'entryUpd' || 'entryDel'
C<-vftran> - translate value with C<-labels> for variable file
lib/ARSObject.pod view on Meta::CPAN
or C<set>(C<-die> => 'CGI::Carp') to use L<CGI::Carp|CGI/Carp> module.
See also C<-cpcon>.
=item -warn
=> not exists
|| sub{}({self}, {field}, $_ =field value, previous value) -> 'warning text'
|| 'warning text for empty field'
(C<CGI Form Presenter - Field Definitions>)
Field value warning evaluator.
See also C<-error>.
=item -warnmsg
=> undef || sub{}(string)
Message for C<-warn>, alike C<-diemsg>.
=item -widget
=> not exists || undef == skip || 'html'
|| sub{}({self}, {field}, value, previous value) -> html
|| {option=>value,..}
(C<CGI Form Presenter - Field Definitions>)
Definition of html field to display (C<Utility Objects>):
not exists - use default widget,
undef - field not included in form,
'html' - html to display,
hidden field with previous value added if '-namecgi'
sub{} -> html to display,...
{option=>value,..} - parameters for 'cgi...' or 'CGI' field
Field definitions may be used also to generate default widget:
lib/ARSObject.pod view on Meta::CPAN
=item -widget0
=item -widget1
=> not exists || 'html'
|| sub{}({self}, {field}, value, previous value) -> html
(C<CGI Form Presenter - Field Definitions>)
html to display above and below C<-widget>
=back
=head1 METHODS
lib/ARSObject.pod view on Meta::CPAN
=item ars_errstr () -> $ARS::ars_errstr
(C<Error Processing and Echo>)
Last ARS error.
=item arsmeta (-param => value,...)
(C<Metadata>)
Load/refresh ARS metadata (C<vfload>/C<vfstore>(C<-meta>), C<-metadn>, C<-metaid>).
Called from C<connect>.
May be called without C<connect> if metadata file exists.
See also C<arsmetamin>.
=item arsmetamin (-param => value,...)
(C<Metadata>)
Refresh minimal ARS metadata set (C<vfstore>(C<-meta-min>)) after C<connect>/C<arsmeta> call.
Load minimal ARS metadata instead of or after C<connect>/C<arsmeta> call.
Loading of minimal metadata set is faster then loading all metadata with C<arsmeta>.
Minimal metadata set includes explicit 'enumLimits' and 'time' fields.
Synopsis: Refreshing C<-meta-min>:
$s->set(-schgen =>3);
$s->connect();
$s->arsmetamin();
=item arsmetasql (-param => value,...)
(C<Metadata>, C<SQL Data Store Methods>)
Load SQL Data Store metadata or refresh this from ARS metadata after C<connect>/C<arsmeta> call.
The SQL Data Store is intended for data replicated from ARS using C<dbidsrpl>() calls.
Database table and column names are escaped ARS form and field names.
Metadata is stored in C<-meta-sql> variable file.
Synopsis: Refreshing C<-meta-sql>:
$s->set(-schgen =>3);
$s->connect();
$s->dbi();
$s->arsmetasql();
$s->dbidsmetasync();
See also C<sqlname>(), C<dbidsmetasync>(), C<dbidsrpl>(), C<dbidsquery>()
lib/ARSObject.pod view on Meta::CPAN
=item AUTOLOAD ()
(C<ARS methods>)
Use object->arsXXX() syntax for ARS:ars_XXX(ctrl,...) calls.
=item cfpaction ({action} || 'action', '-preact'||'-action', {key field}) -> success
(C<CGI Form Presenter>)
Action evaluator, called from C<cfprun>(),
may be called from C<-action> or C<-preact> sub{}.
=item cfpl ('field name' || {field definition}) -> [possible field values]
(C<CGI Form Presenter>)
List of C<-values> of the field, may be used in sub{}s executed by C<cfprun>.
=item cfpp ('field name' || {field definition}) -> previous field value
(C<CGI Form Presenter>)
Previous value of the field, may be used in sub{}s executed by C<cfprun>.
=item cfprun (? msg sub{}(self, 'label', 'comment'), ? form row sub{}(self, {field}, 'html'), ? 'form start html', ? 'form end html') -> success
(C<CGI Form Presenter>)
Evaluate C<-fpl> and present html form with actions.
The order of the fields is important, it is preferred to refer from
the field definition to previous fields, not to subsequent.
=item cfpv ('field name' || {field definition}) -> current field value
(C<CGI Form Presenter>)
Current value of the field, may be used in sub{}s executed by C<cfprun>.
=item cfpvv ('field name' || {field definition}) -> current or default field value
(C<CGI Form Presenter>)
Current or default value of the field, may be used in sub{}s executed by C<cfprun>.
=item C<cgi> () -> CGI object
=item C<cgi> (CGI->new args) -> CGI object
(C<Utility Objects>)
Access to L<CGI|CGI> object in C<-cgi>.
lib/ARSObject.pod view on Meta::CPAN
(C<Utility Objects>)
Access to L<DBI|DBI> object. C<dbiconnect> will be used if empty C<-dbi>.
=item dbiconnect (?-dbiconnect=> connection string || [DBI->connect args]) -> DBI object
(C<Utility Objects>)
Connect to L<DBI|DBI> database using C<-dbiconnect>.
=item dbido (dbi do args, , ?-echo=>1) -> dbi do result
(C<Utility Objects>)
Execute L<DBI|DBI> 'do' using C<dbi>.
Use -echo=>1 to output command to STDOUT.
=item dbidsmetasync (-echo => 0 || 1)
lib/ARSObject.pod view on Meta::CPAN
(C<Utility Objects>)
Query L<DBI|DBI> database using C<dbi>, 'prepare', 'execute'.
Use -echo=>1 to output command to STDOUT.
=item dscmp (data1, data2) -> cmp
(C<Utility Methods>)
Compare two data structures alike L<cmp|perlop>.
=item dsdump (data structure) -> dump string
(C<Utility Methods>)
Stringify any data structure using L<Data::Dumper|Data/Dumper>.
This string may be loaded back with C<dsparse>().
=item dsmerge (array ref,...) -> [merged array]
=item dsmerge (hash ref,...) -> {merged hash}
(C<Utility Methods>)
Sequentally assign elements of data structures given to result data structure.
=item dsparse (perl string) -> data structure
(C<Utility Methods>)
Convert C<dsdump>ed string to data structure.
lib/ARSObject.pod view on Meta::CPAN
=item query (..., -for => sub(self, form, id|string, ?{record}){die "last\n", die "next\n"}) -> self
(C<ARS methods>)
Query records from ARS.
Field names are translated to ids using C<-metadn>/C<-meta>.
Result set values are translated with C<strOut> when C<-strFields>.
Values in the query condition should be converted to ARS representation explicitly:
strings should be quoted with C<arsquot>(), dates - converted with C<timestr>().
Field names or ids in the query condition should be enclosed in ' single quotes.
Parameters:
-form | -from | -schema => schema or form name
-fields =>undef
# if '-fields' parameter omited, list of record IDs will be returned as a result set.
-fields => [{fieldId=>1, columnWidth=>number, separator=>"\t"} | {fieldName=>name, width=>number} | {field=>name|id, width=>number},...]
# result set is strings up to 128 bytes, ARS::ars_GetListEntry() used.
-fields => [fieldId | fieldName,...]
# result set is hash refs for each record, ARS::ars_GetListEntryWithFields() used.
-fields => '*' | '*-$' | 1, -xfields=>sub{}(self, field) || [fieldName| fieldId,...]
# result set is hash refs for each record, ARS::ars_GetListEntryWithFields() used.
# use '*-$' to excude currency and attachment fields.
# use '*-f' to excude attachment fields.
-fetch => '*' | 1 | [fieldId|fieldName,...]
# result set is hash refs for each record, ars_GetEntry() used for each row, this is slow.
-where | -query => search condition string
# Syntax:
'fieldId' || 'fieldName' - fields;
"string value" - strings;
digits - numeric value, number of seconds as date value;
strIn(form, fieldName, value) - to encode value for '-where'
-order | -sort => [fieldId | fieldName => (1||2) | ('asc'|'desc'),...]
# sort order, 1 - asc, 2 - desc
lib/ARSObject.pod view on Meta::CPAN
Get SQL Data Store table or column name converted from ARS form and field name.
Used by C<arsmetasql>().
Uses C<-sqlname>, C<-sqlntbl>, C<-sqlncol>, C<-sqlninc> settings.
=item strIn (schema, fieldId | fieldName | field metadata, value) -> converted
(C<ARS methods>)
Convert value for ARS internal field value representation.
Called automatically when C<-strFields>.
Should be called explicitly from C<strIn> sub{} in C<-metadn>/C<-metaid>.
May need to be called explicitly forming C<query> condition.
See also C<strOut>, C<-strFields>.
=item strOut (schema, fieldId | fieldName | field metadata, fieldValue) -> converted
(C<ARS methods>)
Convert ARS field value for external representation.
Called automatically when C<-strFields>.
Should be called explicitly from C<strOut> sub{} in C<-metadn>/C<-metaid>
and when parsing strings result from C<query>.
See also C<strIn>, C<-strFields>.
=item strquot (string) -> escaped and quoted with ''
=item strquot2 (string) -> escaped and quoted with ""
(C<Utility Methods>)
Quote and escape string.
lib/ARSObject.pod view on Meta::CPAN
Updated C<lsflds>().
Added C<schlblsl>().
Added C<-strFields> => 2 - translate ARS enum field values using at first
localisation metadata ('fieldLbvl').
Extended C<arsmetamin>() data with 'time' fields.
Added C<-metadb> to C<CGI Form Presenter - Field Definitions>.
=head2 2012-03-23
New C<SQL Data Store Methods>
=head2 2011-10-26
lib/ARSObject.pod view on Meta::CPAN
=head2 2011-01-06
New C<arsmeta>, C<arsmetamin>.
Documented C<schema>.
=head2 2011-01-26
C<CGI Form Presenter> added.
=head2 2010-11-22
Publishing 0.54 version, with several enhancements and corrections.
New C<-diemsg>, C<-warnmsg>, C<fdirls>().
C<vfload> - increased performance of loading text file,
implemented text/binary format autodetection.
entryNew() method may be used to form new record hash with default values for entryIns().
entryDif() method may be used to minimise data for entryUpd().
AUTOLOAD() method is to call 'ARS::ars_XXX' functions as methods.
Special processing added for 'HPD:Help Desk' ITSM Suite form.
Variable files may be used to cache any data.
Misc Utility Methods intended for strings, dates, data structures.
Utility Objects added to simplify and unify access to DBI, CGI, Net::SMTP modules.
LICENSE
This is free software; you can use redistribute it and/or modify it
under the same terms as Perl itself.