ARSObject
view release on metacpan or search on metacpan
lib/ARSObject.pm view on Meta::CPAN
} @{$_[2]}) .']'
: ref($_[2]) eq 'HASH'
? '{' .join(', ', map {defined($_[2]->{$_}) ? $_ .$_[1] .dsquot1(@_[0..1],$_[2]->{$_}) : ()
} sort keys %{$_[2]}) .'}'
: strquot($_[0],$_[2])
}
sub dsdump { # Data structure dump to string
my ($s, $d) =@_; # (data structure) -> dump string
eval('use Data::Dumper');
my $o =Data::Dumper->new([$d]);
$o->Indent(1);
$o->Deepcopy(1);
$o->Dump();
}
sub dsparse { # Data structure dump string to perl structure
my ($s, $d) =@_; # (string) -> data structure
eval('use Safe; 1')
&& Safe->new()->reval($d)
lib/ARSObject.pod view on Meta::CPAN
);
print $s->dsdump($hac);
=head1 DESCRIPTION
This module is intended for capable scripts above L<ARS|ARS> module
(L<../../ARSPerl/index.html>).
It caches metadata alike L<Remedy::ARSTools|Remedy/ARSTools>,
but uses L<Data::Dumper|Data/Dumper> or L<Storable|Storable> module.
And metadata model is directly given from ARS::ars_GetFieldTable()/ARS::ars_GetField(),
unlike L<ARSOOForm|ARSOOForm> and L<Remedy::ARSTools|Remedy/ARSTools>.
And additional description level (C<-metadn>/C<-metaid>) added to unify field names
and extend conversion capabilities of field values.
Field names and values are translated (C<-strFields>/C<strIn>/C<strOut>)
as possible.
C<query>() method supports iterator sub{} and uses ARS::ars_GetListEntry(),
ARS::ars_GetListEntryWithFields(), ARS::ars_GetEntry() calls
lib/ARSObject.pod view on Meta::CPAN
=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
lib/ARSObject.pod view on Meta::CPAN
=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.
NAME
ARSObject - high level interface above ARS module
DESCRIPTION
This module is intended for capable scripts above ARS module.
It caches metadata alike Remedy::ARSTools, but uses Data::Dumper or Storable module. And metadata model is directly given from ARS::ars_GetFieldTable()/ARS::ars_GetField(), unlike ARSOOForm and Remedy::ARSTools. And additional description level (-met...
Field names and values are translated as possible.
query() method supports iterator sub{} and uses ARS::ars_GetListEntry(), ARS::ars_GetListEntryWithFields(), ARS::ars_GetEntry() calls as appropriate with parameters given.
entry(), entryIns(), entryUpd(), entryDel() methods are usual to manipulate records.
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().
if (1) {
print "\nRequired modules:\n";
foreach my $m ('ARS', 'POSIX') {
print "use $m\t";
ok(eval("use $m; 'ok'"), 'ok');
}
}
if (1) {
print "\nOptional modules:\n";
foreach my $m ('Data::Dumper', 'Storable', 'DBI', 'CGI', 'SMTP') {
print "use $m\t";
skip(!eval("use $m; 1"), 1);
}
}
if (1) {
print "\nPackaged modules:\n";
foreach my $m ('ARSObject') {
print "use ${m}\t";
( run in 0.253 second using v1.01-cache-2.11-cpan-4d50c553e7e )