text
stringlengths
0
834k
$o->cache_set_current('query', $set-1);
$o->cache_set_index('query', -1);
}
# Query is the same a a previous query on the same target:
# Use cached results and set them as default
elsif (grep { $_->{query} eq $query } $o->cache_sets('query')) {
for (my $i=0; $i<$o->cache_sets('query'); $i++) {
if ($o->cache_set('query', $i, 'query') eq $query) {
$o->inform(""Using cached query result set "", $i+1, "".\n"");
$o->cache_set_current('query', $i);
my $set = $o->cache_set('query');
$o->print_formatted($set);
}
}
}
# Perform a new query.
else {
my $num = find_index($target, 1, @targets);
$o->inform(""Querying target $num ("");
if (length($target) > 30) {
$o->inform(substr($target, 0, 30), ""..."");
}
else {
$o->inform($target);
}
$o->inform("")\n"");
my $res = PPM::UI::query($target, $query, $case);
unless ($res->ok) {
$o->inform($res->msg);
return;
}
my @matches = $res->result_l;
if (@matches) {
$o->cache_set_add('query', $query, \@matches);
$o->cache_set_current('query', scalar($o->cache_sets('query')) - 1);
my @set = $o->cache_set('query');
$o->print_formatted(\@set);
}
else {
$o->warn(""No matches for '$query'; see 'help query'.\n"");
}
}
}
1;
}
#============================================================================
# Properties:
# prop # describes default installed package
# prop <\d+> # describes numbered installed package
# prop <pkg> # describes named installed package
# prop <url> # describes installed package at location <url>
#============================================================================
sub smry_properties { ""describes installed packages in detail"" }
sub help_properties { <<'END' }
properties -- Describe Installed Packages
Synopsis
prop Describes default installed package
prop <number> Describes installed package <number>
prop <range> Describes a <range> of installed packages
prop <package name> Describes named installed package
prop <url> Describes installed package located at <url>
prop <glob pattern> Performs a new query using <glob pattern>
Description
The properties command is an verbose form of the describe command. In
addition to summary information, properties will display the
installation date and a URL showing the location of the package within
the repository.
If you specify the package as a URL, PPM determines the package name
from the URL and searches for that.
When the properties command is used with wildcard arguments, the text
entered at the PPM prompt is passed to the query command.
For example, typing 'properties libnet' will give you:
====================
Name: libnet
Version: 1.07.03
Author: Graham Barr
Title: libnet
Abstract: Collection of Network protocol modules
InstDate: Fri Oct 2 16:15:15 1998
Location: http://ppm.ActiveState.com/PPM/...
====================
See Also
describe
END
sub comp_properties {
my $o = shift;
my ($word, $line, $start) = @_;
# If no query results
my $n_results = scalar $o->cache_sets('query');