Debbugs::Bugs(3) Bug selection routines for debbugs


use Debbugs::Bugs qw(get_bugs);


This module is a replacement for all of the various methods of selecting different types of bugs.

It implements a single function, get_bugs, which defines the master interface for selecting bugs.

It attempts to use subsidiary functions to actually do the selection, in the order specified in the configuration files. [Unless you're insane, they should be in order from fastest (and often most incomplete) to slowest (and most complete).]






The following parameters can either be a single scalar or a reference to an array. The parameters are ANDed together, and the elements of arrayrefs are a parameter are ORed. Future versions of this may allow for limited regular expressions, and/or more complex expressions.

package --- name of the binary package
src --- name of the source package
maint --- address of the maintainer
submitter --- address of the submitter
severity --- severity of the bug
status --- status of the bug
tag --- bug tags
owner --- owner of the bug
correspondent --- address of someone who sent mail to the log
affects --- bugs which affect this package
dist --- distribution (I don't know about this one yet)
bugs --- list of bugs to search within
function --- see description below

Special options

The following options are special options used to modulate how the searches are performed.

archive --- whether to search archived bugs or normal bugs; defaults to false. As a special case, if archive is 'both', but archived and unarchived bugs are returned.
usertags --- set of usertags and the bugs they are applied to

Subsidiary routines

All subsidiary routines get passed exactly the same set of options as get_bugs. If for some reason they are unable to handle the options passed (for example, they don't have the right type of index for the type of selection) they should die as early as possible. [Using Params::Validate and/or die when files don't exist makes this fairly trivial.]

This function will then immediately move on to the next subroutine, giving it the same arguments.


This option allows you to provide an arbitrary function which will be given the information in the index.db file. This will be super, super slow, so only do this if there's no other way to write the search.

You'll be given a list (which you can turn into a hash) like the following:

 (pkg => ['a','b'], # may be a scalar (most common)
  bug => 1234,
  status => 'pending',
  submitter => '[email protected]',
  severity => 'serious',
  tags => ['a','b','c'], # may be an empty arrayref

The function should return 1 if the bug should be included; 0 if the bug should not.


     count_bugs(function => sub {...})

Uses a subroutine to classify bugs into categories and return the number of bugs which fall into those categories


     my $bug = newest_bug();

Returns the bug number of the newest bug, which is nextnumber-1.



Allows filtering bugs on commonly used criteria


This routine uses the by-$index.idx indicies to try to speed up searches.


This is the fallback search routine. It should be able to complete all searches. [Or at least, that's the idea.]



     my @packages = __handle_pkg_src_and_maint(map {exists $param{$_}?($_,$param{$_}):()}
                                               qw(package src maint)

Turn package/src/maint into a list of packages