.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Lintian::Reporting::ResourceManager 3" .TH Lintian::Reporting::ResourceManager 3 2024-02-05 "Lintian v2.117.0" "Debian Package Checker" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Lintian::Reporting::ResourceManager \-\- A simple resource manager for html_reports .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Lintian::Reporting::ResourceManager; \& \& my $resMan = Lintian::Reporting::ResourceManager\->new( \& \*(Aqhtml_dir\*(Aq => \*(Aqpath/to/HTML\-root\*(Aq, \& ); \& # Copy the resource \& $resMan\->install_resource(\*(Aqpath/to/my\-image.png\*(Aq, { install_method => \*(Aqcopy\*(Aq} ); \& # Move the resource \& $resMan\->install_resource(\*(Aqpath/to/generated\-styles.css\*(Aq); \& print encode_utf8(\*(AqImage: \*(Aq . $resMan\->resource_url(\*(Aqmy\-image.png\*(Aq), "\en"); \& print encode_utf8(\*(AqCSS: \*(Aq . $resMan\->resource_url(\*(Aqgenerated\-styles.css\*(Aq), "\en"); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" A simple resource manager for Lintian's reporting tool, \&\fBhtml_reports\fR. .SH "CLASS METHODS" .IX Header "CLASS METHODS" .IP "new(TYPE, OPTS)" 4 .IX Item "new(TYPE, OPTS)" Instantiates a new resource manager. .Sp 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 .SH "INSTANCE METHODS" .IX Header "INSTANCE METHODS" .IP "install_resource(RESOURCE[, OPT])" 4 .IX Item "install_resource(RESOURCE[, OPT])" Installs RESOURCE into the html root. The resource may be renamed (based on content etc.). .Sp Note that the basename of RESOURCE must be unique between all resources installed. See "resource_url(RESOURCE_NAME)". .Sp If OPT is given, it must be a hashref with 0 or more of the following keys (and values). .RS 4 .IP install_method 4 .IX Item "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. .IP source_file 4 .IX Item "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. .Sp If this is passed, RESOURCE must be a basename (i.e. without any slashes). .RE .RS 4 .RE .IP resource_url(RESOURCE_NAME) 4 .IX Item "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. .IP resource_integrity_value(RESOURCE_NAME) 4 .IX Item "resource_integrity_value(RESOURCE_NAME)" Return a string that is valid in the "integrity" field of a \f(CW\*(C`\*(C'\fR HTML tag. (See https://www.w3.org/TR/SRI/) .SH AUTHOR .IX Header "AUTHOR" Originally written by Niels Thykier for Lintian.