DTA::CAB::Format::YAML::XS - Datum parser|formatter: YAML::XS code via YAML::XS |
DTA::CAB::Format::YAML::XS - Datum parser|formatter: YAML::XS code via YAML::XS
use DTA::CAB::Format::YAML::XS; $fmt = DTA::CAB::Format::YAML::XS->new(%args); ##======================================================================== ## Methods: Input $fmt = $fmt->close(); $fmt = $fmt->parseYAMLString($str); $doc = $fmt->parseDocument(); ##======================================================================== ## Methods: Output $fmt = $fmt->flush(); $str = $fmt->toString(); $fmt = $fmt->putToken($tok); $fmt = $fmt->putSentence($sent); $fmt = $fmt->putDocument($doc);
DTA::CAB::Format::YAML::XS is a DTA::CAB::Format datum parser/formatter which reads & writes data as YAML::XS code using the YAML::XS module.
DTA::CAB::Format::YAML::XS inherits from DTA::CAB::Format.
DTA::CAB::Format::YAML::XS registers the filename regex:
/\.(?i:yaml|yml)$/
with DTA::CAB::Format.
$fmt = CLASS_OR_OBJ->new(%args);
Constructor.
%args, %$fmt:
##---- Input doc => $doc, ##-- buffered input document ## ##---- Output dumper => $dumper, ##-- underlying Data::Dumper object ## ##---- INHERITED from DTA::CAB::Format #encoding => $encoding, ##-- n/a level => $formatLevel, ##-- sets Data::Dumper->Indent() option outbuf => $stringBuffer, ##-- buffered output
@keys = $class_or_obj->noSaveKeys();
Override returns list of keys not to be saved.
This implementation returns qw(doc outbuf)
.
$fmt = $fmt->close();
Override: close currently selected input source.
$fmt = $fmt->fromString($string)
Override: select input from the string $string.
$fmt = $fmt->parseYAMLString($str);
Evaluates $str as perl code, which is expected to return a DTA::CAB::Document object (or something which can be massaged into one), and sets $fmt->{doc} to this new document object.
$doc = $fmt->parseDocument();
Returns the current contents of $fmt->{doc}, e.g. the most recently parsed document.
$fmt = $fmt->flush();
Override: flush accumulated output.
$str = $fmt->toString(); $str = $fmt->toString($formatLevel)
Override: flush buffered output document to byte-string. This implementation just returns $fmt->{outbuf}, which should already be a UTF-8 byte-string, and has no need of encoding.
$fmt = $fmt->putToken($tok);
Override: writes a token to the output buffer (non-destructive on $tok).
$fmt = $fmt->putSentence($sent);
Override: write a sentence to the outupt buffer (non-destructive on $sent).
$fmt = $fmt->putDocument($doc);
Override: write a document to the outupt buffer (non-destructive on $doc).
See EXAMPLE in the DTA::CAB::Format::YAML manpage.
Bryan Jurish <jurish@bbaw.de>
Copyright (C) 2010 by Bryan Jurish
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.
DTA::CAB::Format::YAML::XS - Datum parser|formatter: YAML::XS code via YAML::XS |