in reply to YAML module issue


My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

Replies are listed 'Best First'.
Re^2: YAML module issue
by blazar (Canon) on May 12, 2006 at 11:52 UTC

    You made me curious, especially since here at work I'm investigating the possibility of using YAML to serialize some data. So I installed YAML::Syck and tried it on the same data as the OP:

    $ perl -MYAML::Syck -le 'print Dump { zip => "07102" }' --- zip: 07102

    So the behaviour is just the same. But I also get

    $ perl -MData::Dumper -MYAML::Syck -le 'print Dumper Load Dump { zip = +> "07102" }' $VAR1 = { 'zip' => '07102' };

    which is not what he fears. That only happens if $YAML::Syck::ImplicitTyping is set to a true value (by default, it's false):

    $ perl -MData::Dumper -MYAML::Syck -le '$YAML::Syck::ImplicitTyping=1; print Dumper Load Dump { zip => "07102" }' $VAR1 = { 'zip' => 3650 };
Re^2: YAML module issue
by xdg (Monsignor) on May 12, 2006 at 12:05 UTC

    Hmm... how to write a dependency-installation failure test that goes inside the distribution... if I can figure that out, the recursive nature sounds very Ingy-ish.

    # t/yaml_install.t use Test::Install 'YAML';

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

      Thanks for your comments.

      The spec seems pretty clear that something like:

      zip: 07102
      would be implicitly typed as an octal integer. I also tried YAML::Syck, but can't get it to produce a "valid" YAML file that can be read with other parsers which force implicit casting of data types.

      - Devnul