---
name: "Lintian::Reporting::ResourceManager"
section: "3"
platform: "linux"
package: "lintian"
version: "2.122.0"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Lintian::Reporting::ResourceManager"
---

# Lintian::Reporting::ResourceManager(3)

## NAME

Lintian::Reporting::ResourceManager -- A simple resource manager for html\_reports

## SYNOPSIS

```
 use Lintian::Reporting::ResourceManager;

 my $resMan = Lintian::Reporting::ResourceManager->new(
    'html_dir' => 'path/to/HTML-root',
 );
 # Copy the resource
 $resMan->install_resource('path/to/my-image.png', { install_method => 'copy'} );
 # Move the resource
 $resMan->install_resource('path/to/generated-styles.css');
 print encode_utf8('Image: ' . $resMan->resource_url('my-image.png'), "\n");
 print encode_utf8('CSS: ' . $resMan->resource_url('generated-styles.css'), "\n");
```

## DESCRIPTION

A simple resource manager for Lintian's reporting tool, **html\_reports**.

## CLASS METHODS

- new(TYPE, OPTS)

  Instantiates a new resource manager.

  OPTS is a key-value list, which must contain the key "html\_dir" set to the root of the HTML path.  It is beneath this path that all resources will be installed

## INSTANCE METHODS

- install\_resource(RESOURCE\[, OPT\])

  Installs RESOURCE into the html root.  The resource may be renamed (based on content etc.).

  Note that the basename of RESOURCE must be unique between all resources installed.  See "resource\_url(RESOURCE\_NAME)".

  If OPT is given, it must be a hashref with 0 or more of the following keys (and values).

  - install\_method

    Can be "copy" or "move" (default).  If set to "move", the original file will be renamed into its new location.  Otherwise, a copy is done and the original file is left in place.

  - source\_file

    By default, the path denoted by RESOURCE is both the resource name and the source file.  This option can be used to install a given file as RESOURCE regardless of the basename of the source file.

    If this is passed, RESOURCE must be a basename (i.e. without any slashes).

- resource\_url(RESOURCE\_NAME)

  Returns the path (relative to the HTML root) to a resource installed via "install\_resource(RESOURCE)", where RESOURCE\_NAME is the basename of the path given to install\_resource.

- resource\_integrity\_value(RESOURCE\_NAME)

  Return a string that is valid in the "integrity" field of a `"<link>"` HTML tag.  (See https://www.w3.org/TR/SRI/)

## AUTHOR

Originally written by Niels Thykier \<niels@thykier.net\> for Lintian.
