AcePerl
view release on metacpan or search on metacpan
=head2 find() method
@objects = $db->find($query_string);
@objects = $db->find(-query => $query_string,
-offset=> $offset,
-count => $count
-fill => $fill);
This allows you to pass arbitrary Ace query strings to the server and
retrieve all objects that are returned as a result. For example, this
code fragment retrieves all papers written by Jean and Danielle
Thierry-Mieg.
@papers = $db->find('author IS "Thierry-Mieg *" ; >Paper');
You can find the full query syntax reference guide plus multiple
examples at http://probe.nalusda.gov:8000/acedocs/index.html#query.
In the named parameter calling form, B<-count>, B<-offset>, and
B<-fill> have the same meanings as in B<fetch()>.
Ace/Browser/AceSubs.pm view on Meta::CPAN
A typical call is:
$url = ResolveUrl('/cgi-bin/ace/generic/tree','name=fred;class=Author');
This function is not exported by default.
=cut
sub ResolveUrl {
my ($url,$param) = @_;
my ($main,$query,$frag) = $url =~ /^([^?\#]+)\??([^\#]*)\#?(.*)$/ if defined $url;
$main ||= '';
if (!defined $APACHE_CONF) {
$APACHE_CONF = eval { Apache->request->dir_config('AceBrowserConf') } ? 1 : 0;
}
$main = Configuration()->resolvePath($main) unless $main =~ m!^/!;
if (my $id = get_symbolic()) {
$main .= "/$id" unless $main =~ /$id/ or $APACHE_CONF;
}
$main .= "?$query" if $query; # put the query string back
$main .= "?$param" if $param and !$query;
$main .= ";$param" if $param and $query;
$main .= "#$frag" if $frag;
return $main;
}
# A consistent stylesheet across pages
sub Style {
my $stylesheet = Configuration()->Stylesheet;
return { -src => $stylesheet };
}
=item $boolean = Toggle($section,[$label,$object_count,$add_plural,$add_count])
Ace/Object.pm view on Meta::CPAN
$object = $db->fetch(Author,"Thierry-Mieg J");
$a = $object->at('Address[0]') --> "Address"
$a = $object->at('Address[1]') --> "Mail"
$a = $object->at('Address[2]') --> "CRBM duCNRS"
In an array context, the last index in the path does something very
interesting. It returns the entire column of data K steps to the
right of the path, where K is the index. This is used to implement
so-called "tag[2]" syntax, and is very useful in some circumstances.
For example, here is a fragment of code to return the Thierry-Mieg
object's full address without having to refer to each of the
intervening "Mail", "E_Mail" and "Phone" tags explicitly.
@address = $object->at('Address[2]');
--> ('CRBM duCNRS','BP 5051','34033 Montpellier','FRANCE',
'mieg@kaa.cnrs-mop.fr,'33-67-613324','33-67-521559')
Similarly, "tag[3]" will return the column of data three hops to the
right of the tag. "tag[1]" is identical to "tag" (with no index), and
will return the column of data to the immediate right. There is no
Ace/Object.pm view on Meta::CPAN
=head2 get() method
$subtree = $object->get($tag);
@values = $object->get($tag);
@values = $object->get($tag, $position);
@values = $object->get($tag => $subtag, $position);
The get() method will perform a breadth-first search through the
object (columns first, followed by rows) for the tag indicated by the
argument, returning the column of the portion of the subtree it points
to. For example, this code fragment will return the value of the
"Fax" tag.
($fax_no) = $object->get('Fax');
--> "33-67-521559"
The list versus scalar context semantics are the same as in at(), so
if you want to retrieve the scalar value pointed to by the indicated
tag, either use a list context as shown in the example, above, or a
dereference, as in:
Ace/Object.pm view on Meta::CPAN
@row=$object->row($position);
B<row()> will return the row of data to the right of the object. The
first member of the list will be the object itself. In the case of
the "Thierry-Mieg J" object, the example below will return the list
('Address','Mail','CRBM duCNRS').
@row = $object->Address->row();
You can provide an optional position to move rightward one or more
places before retrieving the row. This code fragment will return
('Mail','CRBM duCNRS'):
@row = $object->Address->row(1);
In a scalar context, B<row()> returns the number of items in the row.
=head2 asString() method
$object->asString;
Ace/Sequence/FeatureList.pm view on Meta::CPAN
Context Arguments Behavior
------- --------- --------
scalar -none- total count of features in list
array -none- list feature types (e.g. "exon")
scalar type count features of this type
array type list subtypes of this type
-any- type,subtype count features of this type & subtype
For example, this code fragment will count the number of exons present
on the list:
$exon_count = $list->type('exon');
This code fragment will count the number of exons found by "genefinder":
$predicted_exon_count = $list->type('exon','genefinder');
This code fragment will print out all subtypes of "exon" and their
counts:
for my $subtype ($list->type('exon')) {
print $subtype,"\t",$list->type('exon',$subtype),"\n";
}
=item asString()
print $list->asString;
( run in 2.220 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )