ARSObject
view release on metacpan or search on metacpan
lib/ARSObject.pod view on Meta::CPAN
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>.
=item cptran (fromCP, toCP, string,...) -> translated string,...
(C<Utility Methods>)
Translate strings between codepages using L<Encode|Encode>.
lib/ARSObject.pod view on Meta::CPAN
Form field => value hash for a new ARS record using values given and default values in C<-meta>.
This may be not needed, C<entryIns> may be sufficient.
Field names are translated to ids using C<-metadn>/C<-meta>.
Field values are translated with C<strOut> when C<-strFields>.
Specially for 'HPD:Help Desk': 'Incident Number' value will be generated if it is 1.
=item entryUpd (-form=>form, -id=>entryId, ?-echo=>1, field=>value,...) -> id
(C<ARS methods>)
Update record into ARS using ARS::ars_SetEntry().
Field names are translated to ids using C<-metadn>/C<-meta>.
Field values are translated with C<strIn> when C<-strFields>.
Parameters:
-form | -into | -schema => schema or form name
-id=>entryId
-echo=>1 # output command to STDOUT
field === internalId | fieldName
=item fdirls (?-opt, path, ? filter sub{}(self, path, $_ =entry)) -> (entry,...)
=item fdirls (..., []) -> [entry,...]
(C<Utility Methods>)
List directory contents.
=item fload (?-opt, filename) -> content
(C<Utility Methods>)
Load data from file.
Options: '-b' - L<binmode|perlfunc>.
See also C<fstore>.
=item fopen (?-opt, filename) -> IO::File object
(C<Utility Methods>)
Open file with L<IO::File|IO/File> object.
Options: '-b' - L<binmode|perlfunc>.
See also C<fload>, C<fstore>.
=item fstore (?-opt, filename, string,...) -> success
(C<Utility Methods>)
Store strings to file.
Options: '-b' - L<binmode|perlfunc>.
Filename may be started with '>>' to add data to file.
See also C<fload>.
=item lsflds (additional field properties) -> list of field descriptions
(C<Metadata>)
List field descriptions from C<-meta>.
May be useful when scripting.
Or set C<-storable> => 0 and view C<vfname>(C<-meta>) file.
=item new (param => value,...) -> ARSObject
(C<Creation and Configuration>)
Create ARSObject.
=item query (-form => schema name, -where => condition,...) -> list of records
=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
-first ||-start => firstRetrieve # ARS::ars_GetListEntry() parameter
-limit ||-max => maxRetrieve # ARS::ars_GetListEntry() parameter
-for ||-foreach => sub(self, form, id|string, ?{record}){die "last\n", die "next\n"} -> self
# iterator sub{} for each row
-echo => 1
# output query and details to STDOUT
=item schema () -> {schemaName => {metadata},...}
=item schema (schema name) -> {schema metadata} || undef
=item schfld (schema) -> {fieldName=>{field metadata},...}
=item schfld (schema, field name | meta) -> {field metadata} || undef
=item schid (schema, field '-metaid' | id) -> {fieldName=>'name', FieldId=>id}
=item schdn (schema, field '-metadn' | name) -> {fieldName=>'name', FieldId=>id}
=item schvals (schema, field name | id | meta) -> [itemNumber,...] || undef
=item schlbls (schema, field name | id | meta) -> {itemNumber => itemName,...} || undef
=item schlblsl (schema, field name | id | meta) -> {itemNumber => localised itemName,...} || undef
(C<Metadata>)
Access to ARS metadata loaded by C<connect>, C<arsmeta>, C<arsmetamin>.
=item set (param => value,...) -> self
=item set (param) -> value
(C<Creation and Configuration>)
Configure ARSObject.
=item smtp() -> Net::SMTP object
(C<Utility Objects>)
Access to L<Net::SMTP|Net/SMTP> object.
C<smtpconnect> will be used if empty C<-smtp>.
=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
( run in 1.253 second using v1.01-cache-2.11-cpan-39bf76dae61 )