Scroll to navigation

Lintian::Lab(3) Debian Package Checker Lintian::Lab(3)

NAME

Lintian::Lab -- Interface to the Lintian Lab

SYNOPSIS

 use Lintian::Lab;
 
 my $lab = Lintian::Lab->new;

 if (!$lab->exists) {
     $lab->create;
 }
 $lab->open;
 $lab->close;

DESCRIPTION

This module provides an abstraction from "How and where" packages are placed. It handles creation and deletion of the Lintian Lab itself as well as providing access to the entries.

CLASS METHODS

new
Creates a new Lab instance. The lab will be temporary and will point to a temporary directory.

INSTANCE METHODS

is_open
Returns a truth value if this lab is open.

Note: If the lab is open, it also exists. However, if the lab is closed then the lab may or may not exist (see "exists").

exists
Returns a truth value if the instance points to an existing lab.

Note: This never implies that the lab is open. Though it may imply the lab is closed (see "is_open").

get_package (PROC)
Fetches an existing package from the lab.

The first argument must be a processable.

create ([OPTS])
Creates a basic empty lab. Will also set up the temporary dir for the lab.

The lab will not be opened by this method. This should be done afterwards by invoking the "open" method.

OPTS (if present) is a hashref containing options. The following options are accepted:

keep-lab
If "keep-lab" points to a truth value the temporary directory will not be removed by closing the lab (nor exiting the application). However, explicitly calling "remove" will remove the lab.
mode
If present, this will be used as mode for creating directories. Will default to 0777 if not specified. It is passed to mkdir and is thus subject to umask settings.

Note: This does nothing if the lab appears to already exists.

open
Opens the lab and reads the contents into caches. If the lab does not exist, this method will call create to initialize it.

This will croak if the lab is already open. It may also croak for the same reasons as "create".

Note: It is not possible to pass options to the creation of the lab. If special options are required, please use "create" directly.

close
Close the lab - the lab can no longer be used. All references to entries in the lab should be considered invalid.

Note: The lab will be deleted unless it was created with "keep-lab" (see "create").

remove
Removes the lab and everything in it. Any reference to an entry returned from this lab will immediately become invalid.

The lab root dir will be removed as well on success.

On success, this will return a truth value. The directory path will be set to the empty string.

On error, this method will croak.

If the lab has already been removed (or does not exist), this will return a truth value.

AUTHOR

Niels Thykier <niels@thykier.net>

Based on the work of various others.

2019-05-26 Lintian v2.15.0