1CPAN::Meta::YAML(3) User Contributed Perl Documentation CPAN::Meta::YAML(3)
2
3
4
6 CPAN::Meta::YAML - Read and write a subset of YAML for CPAN Meta files
7
9 version 0.018
10
12 use CPAN::Meta::YAML;
13
14 # reading a META file
15 open $fh, "<:utf8", "META.yml";
16 $yaml_text = do { local $/; <$fh> };
17 $yaml = CPAN::Meta::YAML->read_string($yaml_text)
18 or die CPAN::Meta::YAML->errstr;
19
20 # finding the metadata
21 $meta = $yaml->[0];
22
23 # writing a META file
24 $yaml_text = $yaml->write_string
25 or die CPAN::Meta::YAML->errstr;
26 open $fh, ">:utf8", "META.yml";
27 print $fh $yaml_text;
28
30 This module implements a subset of the YAML specification for use in
31 reading and writing CPAN metadata files like META.yml and MYMETA.yml.
32 It should not be used for any other general YAML parsing or generation
33 task.
34
35 NOTE: META.yml (and MYMETA.yml) files should be UTF-8 encoded. Users
36 are responsible for proper encoding and decoding. In particular, the
37 "read" and "write" methods do not support UTF-8 and should not be used.
38
40 This module is currently derived from YAML::Tiny by Adam Kennedy. If
41 there are bugs in how it parses a particular META.yml file, please file
42 a bug report in the YAML::Tiny bugtracker:
43 <https://github.com/Perl-Toolchain-Gang/YAML-Tiny/issues>
44
46 YAML::Tiny, YAML, YAML::XS
47
49 • Adam Kennedy <adamk@cpan.org>
50
51 • David Golden <dagolden@cpan.org>
52
54 This software is copyright (c) 2010 by Adam Kennedy.
55
56 This is free software; you can redistribute it and/or modify it under
57 the same terms as the Perl 5 programming language system itself.
58
59
60
61perl v5.38.0 2023-07-20 CPAN::Meta::YAML(3)