.\" Automatically generated by Pod::Man 4.14 (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 .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . 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 "Mojolicious::Plugin::AssetPack::Asset 3pm" .TH Mojolicious::Plugin::AssetPack::Asset 3pm "2023-02-04" "perl v5.36.0" "User Contributed Perl Documentation" .\" 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" Mojolicious::Plugin::AssetPack::Asset \- An asset .SH "DESCRIPTION" .IX Header "DESCRIPTION" Mojolicious::Plugin::AssetPack::Asset represents an asset. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Mojolicious::Plugin::AssetPack::Asset; \& my $asset = Mojolicious::Plugin::AssetPack::Asset\->new(url => "..."); .Ve .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" .SS "checksum" .IX Subsection "checksum" .Vb 2 \& $str = $self\->checksum; \& $self = $self\->checksum($str); .Ve .PP The checksum of \*(L"content\*(R". .SS "format" .IX Subsection "format" .Vb 2 \& $str = $self\->format; \& $self = $self\->format($str); .Ve .PP The format of \*(L"content\*(R". Defaults to the extension of \*(L"url\*(R" or empty string. .SS "minified" .IX Subsection "minified" .Vb 2 \& $bool = $self\->minified; \& $self = $self\->minified($bool); .Ve .PP Will be set to true if either \*(L"url\*(R" contains \*(L"min\*(R" or if a pipe has minified \*(L"content\*(R". .SS "name" .IX Subsection "name" .Vb 1 \& $str = $self\->name; .Ve .PP Returns the basename of \*(L"url\*(R", without extension. .SS "renderer" .IX Subsection "renderer" .Vb 2 \& $code = $self\->renderer; \& $self = $self\->renderer(sub { my ($self, $c) = @_; $c\->render(data => "...""); }) .Ve .PP Can be used to register a custom render method for this asset. This is called by \*(L"serve_asset\*(R" in Mojolicious::Plugin::AssetPack::Store. .SS "tag_for" .IX Subsection "tag_for" .Vb 2 \& $code = $self\->tag_for; \& $self = $self\->tag_for(sub { my ($c, \e%args, @attrs) = @_; return qq() }); .Ve .PP Used to register a custom tag renderer for this asset. The arguments passed in are: .IP "\(bu" 2 \&\f(CW$c\fR .Sp The Mojolicious::Controller object used for this request. .IP "\(bu" 2 \&\f(CW%args\fR .Sp A hash-ref with \*(L"base_url\*(R" and topic. .IP "\(bu" 2 \&\f(CW@attrs\fR .Sp The \s-1HTML\s0 attributes passed in from the template. .IP "\(bu" 2 .SS "url" .IX Subsection "url" .Vb 1 \& $str = $self\->url; .Ve .PP Returns the location of the asset. .SH "METHODS" .IX Header "METHODS" .SS "asset" .IX Subsection "asset" .Vb 1 \& $asset = $self\->asset; .Ve .PP Returns a new Mojo::Asset::File or Mojo::Asset::Memory object, with the content or path from this object. .PP This method is \s-1EXPERIMENTAL.\s0 .SS "content" .IX Subsection "content" .Vb 3 \& $bytes = $self\->content; \& $self = $self\->content($bytes); \& $self = $self\->content(Mojo::Asset::Memory\->new); .Ve .PP Used to get or set the content of this asset. The default will be built from passing \*(L"url\*(R" to \*(L"file\*(R" in Mojolicious::Plugin::AssetPack::Store. .SS "path" .IX Subsection "path" .Vb 1 \& $str = $self\->path; .Ve .PP Returns a Mojo::File object that holds the location to the asset on disk or \&\f(CW\*(C`undef\*(C'\fR if this asset is in memory. .SS "size" .IX Subsection "size" .Vb 1 \& $int = $self\->size; .Ve .PP Returns the size of the asset in bytes. .SS "url_for" .IX Subsection "url_for" .Vb 1 \& $url = $self\->url_for($c); .Ve .PP Returns a Mojo::URL object for this asset. \f(CW$c\fR need to be a Mojolicious::Controller. .SS "\s-1FROM_JSON\s0" .IX Subsection "FROM_JSON" .Vb 1 \& $self = $self\->FROM_JSON($hash_ref); .Ve .PP The opposite of \*(L"\s-1TO_JSON\*(R"\s0. Will set the read/write \*(L"\s-1ATTRIBUTES\*(R"\s0 from the values in \f(CW$hash_ref\fR. .SS "\s-1TO_JSON\s0" .IX Subsection "TO_JSON" .Vb 1 \& $hash_ref = $self\->FROM_JSON; .Ve .PP The opposite of \*(L"\s-1FROM_JSON\*(R"\s0. Will generate a hash ref from \*(L"\s-1ATTRIBUTES\*(R"\s0. .SH "SEE ALSO" .IX Header "SEE ALSO" Mojolicious::Plugin::AssetPack.