ARSObject

 view release on metacpan or  search on metacpan

lib/ARSObject.pod  view on Meta::CPAN

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

	=> not exists || 'cgi field name'

=item -namedb

	=> not exists || 'ARS field name'

=item -namelbl

	=> 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>)
Max number of rows to retrieve from ARS server with C<query> method.


=item -meta

	=> {...}

(C<Metadata>)
Forms metadata from ARS server:

{formName}->{-fields}->{fieldName}=>{}, 

{formName}->{-fldids}->{fieldId}=>{}.

Futher data model is directly given from ARS::ars_GetFieldTable()/ARS::ars_GetField()
excluding C<-metax>.

Additional parameters may be:
'fieldLbl' => label, 'fieldLblc' => label cmt


=item -metaid

	=> {fieldId => {fieldName=>'name',FieldId=>id, strIn|strOut=>sub{}},...}

=item -metadn

	=> {fieldName => {fieldName=>'name',FieldId=>id, strIn|strOut=>sub{}},...}

(C<Metadata>)
Commonly used fields with common names and value translation.
Data translation sub{}s may be specified as

'strOut'|'strIn' => sub(self,form,{field},$_=value){} -> translated value.

This sub{}s may use C<strOut>() and C<strIn> methods.


=item -metax 

	=> ['displayInstanceList','permissions']

(C<Metadata>)
Field parameters to exclude from C<-meta> to decrease memory usage.


=item -meta-min

(C<Metadata>)

Used by C<arsmetamin> internally.


lib/ARSObject.pod  view on Meta::CPAN


(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>.


=item -schfdo

	=> 0 || 1

(C<Metadata>)
Include display only fields (AR_FIELD_OPTION_DISPLAY) into schema.



=item C<-schgen> 

	=> 1 || 0 
	|| 2 || 3 || [schema,...]

(C<Metadata>)
Cache metadata from ARS server using C<vfname>(C<-meta>)?
Or each session get metadata from ARS server.

	0 - get metadata from server, do not use cache file.
	1 - generate cache file if not exists, else load this file.
	2 - renew schema definitions using timestamps.
	3 - renew schema always.
	[schema,...] - list of schemas to renew.


=item -smtp

	=> undef || Net::SMTP object

=item -smtphost

	=> undef || SMTP host name


(C<Utility Objects>)
L<Net::SMTP|Net/SMTP> utility object and connect specification to create it.
See also C<smtp> and C<smtpconnect> methods.


=item -sqlname

	=> undef || sub{}(self, ARS name) -> SQL name

(C<SQL Data Store Methods>)
sub{} to escape ARS name to the SQL name, 
may be used instead of C<-sqlntbl> and C<-sqlncol>.
See also C<-sqlninc>.
See 'sub sqlnesc' in the source code as an example.


=item -sqlncol

	=> undef || sub{}(self, ARS field name) -> SQL col name

(C<SQL Data Store Methods>)
sub{} to escape ARS field name to the SQL column name, see also C<-sqlntbl>, C<-sqlninc>.
See 'sub sqlnesc' in the source code as an example.


=item -sqlninc

	=> undef || sub{}(self, SQL name) -> SQL name incremented

(C<SQL Data Store Methods>)
sub{} to increment SQL name, used after C<-sqlname>/C<-sqlntbl>/C<-sqlncol>
when the same SQL name already exists.
See 'sub sqlninc' in the source code as an example.


=item -sqlntbl

	=> undef || sub{}(self, ARS form name) -> SQL table name


(C<SQL Data Store Methods>)
sub{} to escape ARS form name to the SQL table name, see also C<-sqlncol>, C<-sqlninc>.
See 'sub sqlnesc' in the source code as an example.


=item -sqlschema

	=> undef || SQL schema name

(C<SQL Data Store Methods>)
SQL schema name for C<dbidsmetasync>(), C<dbidsrpl>(), C<dbidsquery>().


=item -storable

=item -meta-storable

=item <-vfname>-storable

	=> 1 || 0

(C<Variable files>)
Use L<Storable|Storable> module for variable files, metadata file, or another particular file?
Or L<Data::Dumper|Data/Dumper> will be used.
See also C<vstore>().



=item -srv

	=> undef || 'ARS server name'

(C<Connection>)
ARS server name to connect


=item -strFields

	=> 1 || 0 || 2

(C<ARS methods>)
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})

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

=over

=item Methods



=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>()


=item arsquot (string) -> escaped and quoted for ARS

Quote and escape string for ARS.
See also C<strquot>/C<strquot2>



=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>.
It will be automatically created with C<cgiconnect>() if not exists.



=item cgiconnect (CGI args) -> CGI object

(C<Utility Objects>)
Connect to L<CGI|CGI>.



=item cgiddlb (-name=>name, ?-title=>comment, ?-values=>[values], ?-labels=>{value=>display,..}, ?-default=>value, ?-override=>bool,...) -> drop-down list box HTML

(C<Utility Objects>)
Generate drop-down list box HTML using L<CGI|CGI> widgets.
This is alike C<cgiselect>, but more complex.

 -strict=> - disable text editing, allow only to choose value from list



=item cgiesc (string) -> escaped string

(C<Utility Objects>)
Escape string to HTML using L<CGI|CGI>->escapeHTML(@_)



=item cgitfrm (?-table=>{table attrs}, ?-tr=>{tr attrs}, ?-td=>{...}, ?-th=>{...}, [cell value,...],...) -> HTML

(C<Utility Objects>)
Generate simple HTML form in table layout using L<CGI|CGI>->start_form(),
L<CGI|CGI>->table(), L<CGI|CGI>->end_form().
'th' tag will be used for simple strings as usual labels, 'td' tag - for strings started with HTML tags.



=item cgipar() -> parameters

=item cgipar(name) -> value

=item cgipar(name, value)

(C<Utility Objects>)
Get or set L<CGI|CGI> parameter - L<CGI|CGI>->param(@_)



=item cgiselect (-name=>name, ?-title=>comment, ?-values=>[values], ?-labels=>{value=>display,..}, ?-default=>value, ?-override=>bool,...) -> selection HTML field

(C<Utility Objects>)
Generate selection field HTML using L<CGI|CGI>->popup_menu(@_)

 -onchange=>1 - reload form when value changed



=item cgistring (-name=>name, ?-title=>comment, ?-default=>value, ?-override=>bool, ?-size=>number, ?-maxlength=>number,...) -> text HTML field

(C<Utility Objects>)
Generate text field HTML using L<CGI|CGI>->textfield(@_)



=item cgitext(-name=>name, ?-title=>comment, ?-default=>value, ?-override=>bool, ?-rows=>number, ?-columns=>number,...) -> textarea HTML field

(C<Utility Objects>)
Generate HTML textarea field using L<CGI|CGI>->textarea(@_)



=item connect (-param => value,...) -> connected


(C<Connection>)
Connect to ARS server with ARS::ars_Login()
or verify existed connection with ARS::ars_VerifyUser().
Load metadata (C<vfload>/C<vfstore>(C<-meta>), C<-metadn>, C<-metaid>).



=item cpcon (string,...) -> translated string,...

(C<Error Processing and Echo>)
Translate strings to console codepage using C<-cptran>.

lib/ARSObject.pod  view on Meta::CPAN

=item smtpconnect (?-smtphost=> name) -> Net::SMTP object

(C<Utility Objects>)
Connect to L<Net::SMTP|Net/SMTP> host using C<-smtphost>.



=item smtpsend (-from || -sender => name, -to || -recipient => [name,...], -data => smtp data || (-subject => string, -text || -html => text)) -> Net::SMTP::dataend

(C<Utility Objects>)
Send L<Net::SMTP|Net/SMTP> e-mail using C<smtp>.



=item soon (minutes number || sub{}, logfile ||'', run command || [command line] || sub{}, soon command || [command line] || [])

=item soon (minutes number || sub{}, logfile ||'', run command || [command line] || sub{})

=item soon (minutes number || sub{}, logfile ||'', '', soon command || [command line])

Execute the script periodically, run command immediately, soon command after delay specified.
Log file name may be full file name, else C<vfname>(file name) will be used.
If run command is empty, soon command will be scheduled.
If soon command is empty, sleep(minutes*60) will be used, otherwise 'at' MSWin32 scheduling command.
If !defined(minutes), soon command will be deleted from schedule and run command will be executed once.



=item sqlname (formName, ?fieldName, ?forceMetaUpd) -> sql name

(C<Metadata>, C<SQL Data Store Methods>)

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.
See also C<arsquot>



=item strtime (?mask, L<time|perlfunc> ||L<localtime|perlfunc> ||L<gmtime|perlfunc>) -> stringified

(C<Utility Methods>)
Stringify time value by mask.
Default mask is 'yyyy-mm-dd hh:mm:ss' (ISO).
L<POSIX::strftime|POSIX> uses different mask agreement.
See also C<timestr>.


=item timeadd (seconds, add years, ?months, ?days, ?hours, ?minutes, ?seconds) -> seconds incremented

(C<Utility Methods>)
Add values given to time given. Calculation via L<POSIX::mktime|POSIX>.



=item timestr (?mask, stringified time) -> seconds

(C<Utility Methods>)
Convert stringified with C<strtime> time string to seconds form 
with L<POSIX::mktime|POSIX>



=item vfclear (-slotName) -> true

(C<Variable files>)
Clear data loaded from variables file by C<vfload>(-slotName).
Reset data buffers of C<vfdata>() and C<vfhash>().



=item vfdata (-slotName) -> data structure

=item vfdata (-slotName, index) -> numbered element of data array

=item vfdata (-slotName, filter sub{}(self, -slot, index, $_=elem)) -> [record,...]

(C<Variable files>)
Access to data of variables file.
Automatically C<fload>s it.
Data structure will be treated as an array ref when index or filter argument used.



=item vfdistinct (-slotName, keyName) -> [value,...]

=item vfdistinct (-slotName, keyName, filter sub{}(self, -slot, keyName, keyValue, $_=elem)) -> [value,...]

(C<Variable files>)
Distinct values from C<vfdata>,
alike [sort keys %{C<vfhash>(-slotName, keyName)}].
Each element of C<vfdata>(-slotName) should be a hash with 'keyName' element.





( run in 0.482 second using v1.01-cache-2.11-cpan-39bf76dae61 )