NAME
YAML::PP::Highlight - Syntax highlighting utilities
SYNOPSIS
use YAML::PP::Highlight qw/ Dump /;
my $highlighted = Dump $data;
my ($error, $tokens) = YAML::PP::Highlight->parse_tokens(string => $yaml);
my ($error, $tokens) = YAML::PP::Highlight->parse_tokens(file => $file);
METHODS
- parse_tokens
-
my ($error, $tokens) = YAML::PP::Highlight->parse_tokens(string => $yaml);
It will return the error, if the YAML was invalid. The second return value is the list of tokens.
Note that the tokens are very likely to be changed in the future, so don't rely on them.
FUNCTIONS
- Dump
use YAML::PP::Highlight qw/ Dump /;
my $highlighted = Dump $data;
my $highlighted = Dump @docs;
It will dump the given data, and then parse it again to create tokens, which are then highlighted with ansi colors.
The return value is ansi colored YAML.