Data::...Reader(3pm)

πŸ“¦
version 0.0.7 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

Data::YAML::Reader β€” bestie, this parses YAML that was made by Data::YAML::Writer πŸ’–

(also it's a Data::...Reader(3pm) situation, from User Contributed Perl Documentation, just so you know what you're looking at 🫢)

🌸 VERSION 🌸

This doc describes Data::YAML::Reader version 0.0.7 ✨

πŸŽ€ SYNOPSIS πŸŽ€

use Data::YAML::Reader;

my $yr = Data::YAML::Reader->new;

# Read from an array...
my $from_array = $yr->read( \@some_array );

# ...an open file handle...
my $from_handle = $yr->read( $some_file );

# ...a string containing YAML...
my $from_string = $yr->read( $some_string );

# ...or a closure
my $from_code = $yr->read( sub { return get_next_line() } );

okay so literally four different ways to feed it, pick your fighter πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

In the spirit of YAML::Tiny, this is a lightweight, dependency-free YAML reader. No extra CPAN boxes to install, she just works ✨

But here's the tea: while YAML::Tiny is designed principally for working with configuration files, Data::YAML concentrates on the transparent round-tripping of YAML serialized Perl data structures. Different goals, different girlies πŸ’–

The syntax accepted by Data::YAML::Reader is a subset of YAML. Specifically? It's the same subset of YAML that Data::YAML::Writer produces. Like, they're a matched set, besties fr fr. See Data::YAML for more information πŸ‘‘

🌈 INTERFACE 🌈

πŸ’œ new

Creates and returns an empty Data::YAML::Reader object. No options may be passed. That's it, that's the whole vibe β€” no arguments, no config, no drama πŸ™ˆ

πŸ’œ read( $source )

Read YAML and return the data structure it represents. The YAML data may be supplied by a:

  • scalar string containing YAML source
  • the handle of an open file
  • a reference to an array of lines
  • a code reference

In the case of a code reference, a subroutine (most likely a closure) that returns successive lines of YAML must be supplied. Lines should have no trailing newline. When the YAML is exhausted the subroutine must return undef. That last bit is not optional, bestie, it's how she knows you're done 🫢

Returns the data structure (specifically either a scalar, hash ref or array ref) that results from decoding the YAML. So yeah β€” scalar, hash ref, or array ref, those are your three options πŸ‘‘

πŸ’œ get_raw

Return the raw YAML source from the most recent read. Like a lil peek at the receipt from your last order 🧾✨

πŸ’€ BUGS AND LIMITATIONS πŸ’€

No bugs have been reported. (iconic behaviour, honestly)

Please report any bugs or feature requests to data-yaml@rt.cpan.org, or through the web interface at <http://rt.cpan.org>.

⭐ SEE ALSO ⭐

YAML::Tiny, YAML, YAML::Syck, Config::Tiny, CSS::Tiny

the whole friend group, go say hi πŸ’–

πŸ‘‘ AUTHOR πŸ‘‘

Andy Armstrong <andy@hexten.net>

Adam Kennedy wrote YAML::Tiny which provided the template and many of the YAML matching regular expressions for this module. Shoutout Adam, real one fr fr 🫢

Copyright (c) 2007, Andy Armstrong <andy@hexten.net>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

🚨 DISCLAIMER OF WARRANTY 🚨

okay bestie, this part is in ALL CAPS for a reason, don't skip it πŸ’€

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.


and that's the whole page, bestie!! πŸŽ€βœ¨ this was perl v5.36.0, dated 2022-10-15, and it lives at Data::...Reader(3pm) β€” go forth and parse your YAML, you're gonna slay πŸ’…πŸ’–

πŸ“¦ where this page comes from