Re: [Module::Build] broken META.yml file
Status: Beta
Brought to you by:
kwilliams
|
From: Randy W. S. <ml...@th...> - 2006-05-16 01:44:37
|
Stephen Adkins wrote:
> Hi,
>
> I wrote Module::Build::YAML.
> I offer these patches.
>
> Both of the previously mentioned broken YAML files were a
> result of embedded newlines. I opted to tackle newlines and
> all of the other special characters which I could find which
> YAML considers special.
>
> I think this version will be quite an improvement in terms of
> robustness in the presence of "odd" characters in the scalar
> values. I patched
I'm not sure this is correct; although, it is much improved. The second
instance with the module 'Gantry' should have an 'author' node that is
an array containing 2 elements. With your patch, I untared Gantry and ran
# ysh
ysh > <META.yml
YAML Error: Invalid element in map
Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT
Line: 6
Document: 1
at C:\devel\perl\5.8.7\site\lib/YAML.pm line 60
ysh > :q
Which is the original error. After running
# Build.PL
[ignore output]
# perl Build distmeta
Deleting Makefile.PL
Creating Makefile.PL
Deleting META.yml
Creating META.yml
# ysh
ysh > <META.yml
$VAR1 = {
'name' => 'Gantry',
'version' => '3.30',
'author' => [
'Tim Keefer <tk...@gm...>
Phil Crow <phi...@ya...>'
],
...
};
Notice that author is an array with *one* element that is a multiline
string.
In the other case, we probably have a problem up stream(???): I would
expect the abstract to be returned as a single string removing the
formatting from the pod. I.E. Single \n should be collapsed along with
surrounding whitespace, while \n\n should remain a paragraph break.
But do notice that YAML.pm when give a string with embedded \n
characters writes the result out as verbatim text:
use YAML;
require YAML::Node;
my $data = { text =>
"YAML::Node is a class for generating and manipulating these
containers. A YAML node (or ynode) is a tied hash, array or
scalar. In most ways it behaves just like the plain thing. But you
can assign and retrieve and YAML type tag URI to it. For the hash
flavor, you can also assign the order that the keys will be
retrieved in. By default a ynode will offer its keys in the same
order that they were assigned."
};
my $node = YAML::Node->new($data);
print Dump $node;
__END__
outputs:
---
text: |-
YAML::Node is a class for generating and manipulating these
containers. A YAML node (or ynode) is a tied hash, array or
scalar. In most ways it behaves just like the plain thing. But you
can assign and retrieve and YAML type tag URI to it. For the hash
flavor, you can also assign the order that the keys will be
retrieved in. By default a ynode will offer its keys in the same
order that they were assigned.
Whereas the same text without embedded \n gets printed as:
---
text: 'YAML::Node is a class for generating and manipulating these
containers. A YAML node (or ynode) is a tied hash, array or scalar. In
most ways it behaves just like the plain thing. But you can assign and
retrieve and YAML type tag URI to it. For the hash flavor, you can also
assign the order that the keys will be retrieved in. By default a ynode
will offer its keys in the same order that they were assigned.'
Regards,
Randy.
|