ARSObject
view release on metacpan or search on metacpan
lib/ARSObject.pod view on Meta::CPAN
-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>.
=item dbi() -> DBI object
(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)
(C<Metadata>, C<SQL Data Store Methods>)
Sync SQL Data Store schema with metadata generated by C<arsmetasql>().
Uses C<dbi>(), C<-meta-sql>, C<-sqlschema>.
Calls C<dbido>('CREATE TABLE...') and C<dbido>('ALTER TABLE...').
=item dbidsrpl (-param => value)
(C<SQL Data Store Methods>)
Replicate ARS data to the SQL Data Store.
Uses C<dbi>(), C<-meta-sql>, C<-sqlschema>.
Parameters:
-echo => undef || 0 || 1
-form => ARS form name
-fields => undef || '*' || fields to replicate, alike C<query>(-fields)
-query => undef || ARS query string
-filter => undef || filter sub{}(self, {args}, {-meta-sql}->{tableName}, {ARS record}, {Data Store record}) -> allow
-lim_rf => undef || max number of records read from ARS, C<query>(-limit).
The number of the records fetched really may be incremented by counting timestamps duplicated.
Without timestamps, additional queries will be invoked when '-lim_rf' records fetched.
-lim_or => undef || max number of 'OR keyField=keyValue' pairs
-pk => undef || primary key ARS field name, default is obtained from C<-meta-sql>
-timestamp => undef || 0 || 'Modified Date' timestamp ARS field name, default is obtained from C<-meta-sql>
-ckpush => undef || 1 || 0 - insert, update, delete ARS records according to '_arsobject_insert', '_arsobject_update', '_arsobject_delete' column values.
-ckdel => undef || 0 || 1 - check records deleted from ARS and replicate deletions to the Data Store,
this is expensive and slow, so default if off.
-ckupd => undef || 1 || 0 - check and replicate updates from ARS to the Data Store,
based on timestamps of records if availeble
-unused => undef || SQL where clause part to delete unused records from Data Store table. "ARS field name"s and "ARS form name"s may be used.
-sleep => undef || seconds to L<perlfunc::sleep|perlfunc> between calls to ARS.
=item dbidsquery (-param => value) -> ({fieldName => fieldValue,...},...)
(C<SQL Data Store Methods>)
Query data from SQL Data Store.
Uses C<dbi>(), C<-meta-sql>, C<-sqlschema>.
Any C<dbi>() method may be used for SQL Data Store,
but C<dbidsquery> understands "ARS form name"s and "ARS field name"s
in addition to "sql table name"s and "sql column name"s.
Records are returned as hash refs with ARS field names available,
otherwise SQL column names.
Parameters:
-echo => undef || 0 || 1
-form => ARS form name
-fields => undef || '*' || 'SQL SELECT clause' || [fieldName ||fieldId ||colName,...].
Empty value requests all fields, '*' - all fields or columns.
-query => undef || SQL WHERE clause
-filter => undef || filter sub{}(self, {fieldName => fieldValue,...}) -> allow
-order => [fieldName||fieldId => 1||2,... colName||colNumber => 'asc'||'desc',...] || 'SQL ORDER BY clause'
-undefs => undef || 1 || 0 - include undefined values to records returned
"ARS form name", "ARS field name", "ARS form name"."ARS field name" may be used
in '-fields' and '-query'.
=item dbierrstr () -> dbi->errstr
(C<Error Processing and Echo>)
Last L<DBI|DBI> error, <dbi>->errstr
=item dbiquery (dbi query args, ?-echo=>1) -> dbi cursor object
(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.
=item dsquot (data structure) -> stringified
=item dsquot1 (data structure) -> stringified, defined elements only
(C<Utility Methods>)
Quote (stringify) any data structure to human readable form.
=item dsunique (item,...) -> (unique items)
(C<Utility Methods>)
Find unique items in the list given.
=item entry (-form=>name, -id=>entryId,...) -> {entry}
(C<ARS methods>)
Get record from ARS using ARS::ars_GetEntry().
Parameters:
-form | -from | -schema => schema or form name
-id => entryId
-fields => [internalId | fieldName,...]
-for => {} # steady hash to store each entry fetched
-echo=>1 # output command to STDOUT
=item entryBLOB (-form=>form, -id=>entryId, -field=>fieldId|fieldName) -> data
=item entryBLOB (..., -set=>data) -> id
=item entryBLOB (..., -file=>path, ?-set=>1) -> id
(C<ARS methods>)
Retrieve BLOB field using ARS::ars_GetEntryBLOB()
or update BLOB field using C<entryUpd>().
Parameters:
-form | -schema | -from | -into => schema or form name
-id=>entryId
-echo=>1 # output command to STDOUT
-field=>fieldId | fieldName
-file=>path, -set=>boolean # when using file for BLOB field data
-set=>data # when updating BLOB field from scalar data
=item entryDel (-form=>form, -id=>entryId, ?-echo=>1) -> id
(C<ARS methods>)
Delete record into ARS using ARS::ars_DeleteEntry().
Parameters:
-form | -into | -schema => schema or form name
-id=>entryId
-echo=>1 # output command to STDOUT
=item entryDif ({old field => value,...}, {new field => value,...}, ?exclude empty) -> {values to update} | undef
(C<ARS methods>)
Distinguish the difference between two hashes of field => value.
Returns undef when no difference.
=item entryIns (-form=>form, ?-echo=>1, field => value,...) -> id | self
(C<ARS methods>)
Insert new record into ARS using ARS::ars_CreateEntry().
Field names are translated to ids using C<-metadn>/C<-meta>.
Field values are translated with C<strIn> when C<-strFields>.
Specially for 'HPD:Help Desk': 'Incident Number' value will be generated if it is 1.
Parameters:
-form | -into | -schema => schema or form name
-echo=>1 # output command to STDOUT
field === internalId | fieldName
=item entryNew (-form=>form, field=>value,...) -> {field=>value,...}
(C<ARS methods>)
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
lib/ARSObject.pod view on Meta::CPAN
-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
(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>.
( run in 0.993 second using v1.01-cache-2.11-cpan-2e0ccfb7a10 )