| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Egg::Plugin::YAML; | 
| 2 |  |  |  |  |  |  | # | 
| 3 |  |  |  |  |  |  | # Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt> | 
| 4 |  |  |  |  |  |  | # | 
| 5 |  |  |  |  |  |  | # $Id: YAML.pm 337 2008-05-14 12:30:09Z lushe $ | 
| 6 |  |  |  |  |  |  | # | 
| 7 | 1 |  |  | 1 |  | 418 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 35 |  | 
| 8 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 25 |  | 
| 9 | 1 |  |  | 1 |  | 712 | use YAML; | 
|  | 1 |  |  |  |  | 13696 |  | 
|  | 1 |  |  |  |  | 156 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | our $VERSION= '3.00'; | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | sub yaml_load { | 
| 14 | 0 |  |  | 0 | 1 |  | my $e   = shift; | 
| 15 | 0 |  | 0 |  |  |  | my $yaml= shift || return 0; | 
| 16 | 0 | 0 |  |  |  |  | $yaml=~/[\r\n]/ ? YAML::Load($yaml): YAML::LoadFile($yaml); | 
| 17 |  |  |  |  |  |  | } | 
| 18 |  |  |  |  |  |  | sub yaml_dump { | 
| 19 | 0 |  |  | 0 | 1 |  | shift; | 
| 20 | 0 |  |  |  |  |  | YAML::Dump(@_); | 
| 21 |  |  |  |  |  |  | } | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | 1; | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | __END__ | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | =head1 NAME | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | Egg::Plugin::YAML - Plugin to treat data of YAML format. | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | use Egg qw/ YAML /; | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | my $data= $e->yaml_load($yaml_text); | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | print $e->yaml_dump($data); | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | =head1 METHODS | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | =head2 yaml_load([YAML_DATA] or [YAML_FILE_PATH]) | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | The data of the YAML form is made former data and it returns it. | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | When the character string that doesn't contain changing line is passed, it is | 
| 46 |  |  |  |  |  |  | treated as passing to the YAML file. | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | my $data= $e->yaml_load('/path/to/load_file.yaml'); | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | =head2 yaml_dump ([DATA]) | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | DATA is converted into the text of the YAML form and it returns it. | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | my $yaml= $e->yaml_dump($data); | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | L<Egg::Release>, | 
| 59 |  |  |  |  |  |  | L<Egg::YAML>, | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | =head1 AUTHOR | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt> | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | Copyright (C) 2008 by Bee Flag, Corp. E<lt>L<http://egg.bomcity.com/>E<gt>. | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | This library is free software; you can redistribute it and/or modify | 
| 70 |  |  |  |  |  |  | it under the same terms as Perl itself, either Perl version 5.8.6 or, | 
| 71 |  |  |  |  |  |  | at your option, any later version of Perl 5 you may have available. | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | =cut |