ARSperl
view release on metacpan or search on metacpan
example/GetFilter.pl view on Meta::CPAN
if(!defined($filtername)) {
print "Usage: $0 [server] [username] [password] [filtername]\n";
exit 0;
}
$AR_OPERATION_GET = 1;
$AR_OPERATION_SET = 2;
$AR_OPERATION_CREATE = 4;
$AR_OPERATION_DELETE = 8;
$AR_OPERATION_MERGE = 16;
%ars_opSet = (
$AR_OPERATION_GET, "Display",
$AR_OPERATION_SET, "Modify",
$AR_OPERATION_CREATE, "Create",
$AR_OPERATION_DELETE, "Delete",
$AR_OPERATION_MERGE, "Merge"
);
$ctrl = ars_Login($server, $username, $password);
($finfo = ars_GetFilter($ctrl, $filtername)) ||
die "error in GetFilter: $ars_errstr";
print "\n\nerrstr contains \"$ars_errstr\"\n\n" if ($ars_errstr ne "");
print "** Filter Info:\n";
print "Name : \"".$finfo->{"name"}."\"\n";
print "Order : ".$finfo->{"order"}."\n";
if(defined($finfo->{'schema'})) {
print "Schema : \"".$finfo->{"schema"}."\"\n";
}
elsif(defined($finfo->{'schemaList'})) {
print "schemaList : ";
foreach my $s (@{$finfo->{'schemaList'}}) {
print "\"$s\" ";
}
print "\n";
}
print "opSet : ".Decode_opSetMask($finfo->{"opSet"})."\n";
print "Enable : ".$finfo->{"enable"}."\n";
if(defined($finfo->{'query'})) {
$dq = ars_perl_qualifier($ctrl, $finfo->{"query"});
$dq = undef if(isempty($dq));
} else {
$dq = undef;
}
if(defined($finfo->{'schema'})) {
if(defined($dq)) {
$qualtext = ars_Decode_QualHash($ctrl, $finfo->{"schema"}, $dq);
print "Query : ".$qualtext."\n";
} else {
print "Query : [none defined]\n";
}
}
elsif(defined($finfo->{'schemaList'})) {
if(defined($dq)) {
foreach my $s (@{$finfo->{'schemaList'}}) {
$qualtext = ars_Decode_QualHash($ctrl, $s, $dq);
print "Query decoded against form \"$s\" : ".$qualtext."\n";
}
} else {
print "Query : [none defined]\n";
}
}
print "actionList : \n";
ProcessActions(@{$finfo->{actionList}});
print "helpText : \"".$finfo->{"helpText"}."\"\n";
print "timestamp : ".localtime($finfo->{"timestamp"})."\n";
print "owner : ".$finfo->{"owner"}."\n";
print "lastChanged : ".$finfo->{"lastChanged"}."\n";
print "changeDiary : ".$finfo->{"changeDiary"}."\n";
foreach (@{$finfo->{"changeDiary"}}) {
print "\tTIME: ".localtime($_->{"timestamp"})."\n";
print "\tUSER: $_->{'user'}\n";
print "\tWHAT: $_->{'value'}\n";
}
ars_Logoff($ctrl);
exit 0;
# Most of these subroutines were taken directly from Show_ALink.pl
# SUBROUTINE
# PrintArith
#
# DESCRIPTION
# Attempt to "pretty print" the arith expression (just for
# the hell of it)
#
# NOTES
# Notic that parenthesis are printed, although they are not
# explicitly part of the node information. They are derived
# from the ordering of the tree, instead. If you want to actually
# *evaluate* the expression, you will have to derive the
# parenthetical encoding from the tree ordering.
#
# Here is an example equation and how it is encoded:
#
# ((10 + 2) / 3)
#
# "/"
# / \
# "+" 3
# / \
# 10 2
#
# ARS apparently sorts the operations for you (based on their
# mathematical precedence) so you should evaluate the tree from
# the bottom up.
#
# ars_web.cgi has an evaluation routine for computing the value
# of a arith structure. we will probably break it out into a
# perl module.
#
( run in 1.912 second using v1.01-cache-2.11-cpan-8450f2e95f3 )