.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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 "Template::Plugin::YAML 3pm" .TH Template::Plugin::YAML 3pm "2022-06-17" "perl v5.34.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" Template::Plugin::YAML \- Plugin interface to YAML .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& [% USE YAML %] \& \& [% YAML.dump(variable) %] \& [% YAML.dump_html(variable) %] \& [% value = YAML.undump(yaml_string) %] \& [% YAML.dumpfile(filename, variable) %] \& [% value = YAML.undumpfile(filename) %] .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is a simple Template Toolkit Plugin Interface to the \s-1YAML\s0 module. A \s-1YAML\s0 object will be instantiated via the following directive: .PP .Vb 1 \& [% USE YAML %] .Ve .PP As a standard plugin, you can also specify its name in lower case: .PP .Vb 1 \& [% USE yaml %] .Ve .SH "METHODS" .IX Header "METHODS" These are the methods supported by the \s-1YAML\s0 object. .ie n .SS "dump( @variables )" .el .SS "dump( \f(CW@variables\fP )" .IX Subsection "dump( @variables )" Generates a raw text dump of the data structure(s) passed .PP .Vb 3 \& [% USE Dumper %] \& [% yaml.dump(myvar) %] \& [% yaml.dump(myvar, yourvar) %] .Ve .ie n .SS "dump_html( @variables )" .el .SS "dump_html( \f(CW@variables\fP )" .IX Subsection "dump_html( @variables )" Generates a dump of the data structures, as per \f(CW\*(C`dump\*(C'\fR, but with the characters <, > and & converted to their equivalent \s-1HTML\s0 entities, spaces converted to   and newlines converted to
. .PP .Vb 2 \& [% USE yaml %] \& [% yaml.dump_html(myvar) %] .Ve .ie n .SS "undump( $string )" .el .SS "undump( \f(CW$string\fP )" .IX Subsection "undump( $string )" Converts a YAML-encoded string into the equivalent data structure. Here's a way to deep-copy a complex structure by completely serializing the data. .PP .Vb 4 \& [% USE yaml; \& yaml_string = yaml.dump(complex_data_structure); \& complex_copy = yaml.undump(yaml_string); \& %] .Ve .ie n .SS "dumpfile( $file, @variables )" .el .SS "dumpfile( \f(CW$file\fP, \f(CW@variables\fP )" .IX Subsection "dumpfile( $file, @variables )" Converts the data to \s-1YAML\s0 encoding, and dumps it to the specified filepath. .PP .Vb 1 \& [% USE yaml; yaml.dumpfile(".storage", my_data) %] .Ve .ie n .SS "undumpfile( $file )" .el .SS "undumpfile( \f(CW$file\fP )" .IX Subsection "undumpfile( $file )" Loads the YAML-encoded data from the specified filepath .PP .Vb 1 \& [% USE yaml; my_data = yaml.undumpfile(".storage") %] .Ve .SH "AUTHORS" .IX Header "AUTHORS" Richard Clamp , with undump, undumpfile, and dumpfile implementation by Randal L. Schwartz .PP based on Simon Matthews' Template::Plugin::Dumper .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2003, 2008 Richard Clamp All Rights Reserved. .PP This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .SH "SEE ALSO" .IX Header "SEE ALSO" Template::Plugin::Dumper