NAME
PAR::Repository::Query - Implements repository queries
SYNOPSIS
use PAR::Repository;
# or:
use PAR::Repository::Client;
DESCRIPTION
This module is for internal use by PAR::Repository or PAR::Repository::Client only. Both modules inherit from this. PAR::Repository::Query
implements a unified query interface for both the server- and client-side components of PAR repositories.
If you decide to inherit from this class (for whatever reason), you should provide at least two methods: modules_dbm
which returns a DBM::Deep object representing the modules DBM file. (See PAR::Repository::DBM for details.) And scripts_dbm
which is the equivalent for the scripts DBM file.
EXPORT
None. But the methods are callable on PAR::Repository
and PAR::Repository::Client
objects.
METHODS
Following is a list of class and instance methods. (Instance methods until otherwise mentioned.)
There is no PAR::Repository::Query
object.
query_module
Polls the repository for modules matching certain criteria. Takes named arguments. Either a regex
or a name
parameter must be present but not both.
Returns a reference to an array containing alternating distribution file names and module versions. This method returns the following structure
[ 'Foo-Bar-0.01-any_arch-5.8.7.par', '0.01', ... ]
that means the module was found in the distribution Foo-Bar-0.01-any_arch-5.8.7.par and the copy in that file has version 0.01.
Parameters:
- name
-
The name of the module to look for. This is used for an exact match. If you want to find
Foo
inFoo::Bar
, use theregex
parameter. Only one ofname
andregex
may be specified. - regex
-
Same as
name
, but interpreted as a regular expression. Only one ofname
andregex
may be specified. - arch
-
Can be used to reduce the number of matches to a specific architecture. Always interpreted as a regular expression.
query_script
Note: Usually, you probably want to use query_script_hash()
instead. The usage of both methods is very similar (and described right below), but the data structure returned differes somewhat.
Polls the repository for scripts matching certain criteria. Takes named arguments. Either a regex
or a name
parameter must be present but not both.
Returns a reference to an array containing alternating distribution file names and script versions. This method returns the following structure
[ 'Foo-Bar-0.01-any_arch-5.8.7.par', '0.01', ... ]
that means the script was found in the distribution Foo-Bar-0.01-any_arch-5.8.7.par and the copy in that file has version 0.01.
Parameters:
- name
-
The name of the script to look for. This is used for an exact match. If you want to find
foo
infoobar
, use theregex
parameter. Only one ofname
andregex
may be specified. - regex
-
Same as
name
, but interpreted as a regular expression. Only one ofname
andregex
may be specified. - arch
-
Can be used to reduce the number of matches to a specific architecture. Always interpreted as a regular expression.
query_script_hash
Works exactly the same as query_script
except it returns a different resulting structure which includes the matching script's name:
{ 'fooscript' => { 'Foo-Bar-0.01-any_arch-5.8.7.par' => '0.01', ... }, ... }
that means the script fooscript
was found in the distribution Foo-Bar-0.01-any_arch-5.8.7.par and the copy in that file has version 0.01.
Parameters are the same as for query_script
query_dist
Polls the repository for distributions matching certain criteria. Takes named arguments. Either a regex
or a name
parameter must be present but not both.
Returns a reference to an array containing alternating distribution file names and hash references. The hashes contain module names and associated versions in the distribution. This method returns the following structure
[
'Foo-Bar-0.01-any_arch-5.8.7.par',
{Foo::Bar => '0.01', Foo::Bar::Baz => '0.02'},
...
]
that means the distribution Foo-Bar-0.01-any_arch-5.8.7.par matched and that distribution contains the modules Foo::Bar
and Foo::Bar::Baz
with versions 0.01 and 0.02 respectively.
Parameters:
- name
-
The name of the distribution to look for. This is used for an exact match. If you want to find
Foo
inFoo-Bar-0.01-any_arch-5.8.8.par
, use theregex
parameter. Only one ofname
andregex
may be specified. - regex
-
Same as
name
, but interpreted as a regular expression. Only one ofname
andregex
may be specified. - arch
-
Can be used to reduce the number of matches to a specific architecture. Always interpreted as a regular expression.
AUTHOR
Steffen Müller, <smueller@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2006-2009 by Steffen Müller
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.6 or, at your option, any later version of Perl 5 you may have available.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 400:
Non-ASCII character seen before =encoding in 'Müller,'. Assuming UTF-8