Skip Menu |

This queue is for tickets about the YAML-Tiny CPAN distribution.

Report information
The Basics
Id: 111027
Status: open
Priority: 0/
Queue: YAML-Tiny

People
Owner: Nobody in particular
Requestors: losyme [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: integer becomes string ?
Date: Fri, 8 Jan 2016 22:57:29 +0100
To: bug-YAML-Tiny [...] rt.cpan.org
From: Loïc TROCHET <losyme [...] gmail.com>
Hello, Why integer becomes string ? YAML::Tiny v1.69 afac.yml ------------- section: one: -1.056 three: +33 Foo: Bar empty: ~ canonical: 685230 afac.pl ---------- use strict; use warnings; use YAML::Tiny qw(LoadFile); use Data::Dumper; my $c = LoadFile('/tmp/afac.yml'); print Dumper($c), "\n"; perl afac.pl ---------------- $VAR1 = { 'section' => { 'three' => '+33', 'empty' => undef, 'one' => '-1.056', 'Foo' => 'Bar' }, 'canonical' => '685230' };
On 2016-01-08 16:57:39, losyme@gmail.com wrote: Show quoted text
> Hello, > Why integer becomes string ?
I checked also YAML, YAML::Syck, and YAML::XS --- all modules behave the same. Seems to be a general problem (or laxness) in Perl --- normally one does not need to care about this when the resulting data is processed with Perl programs, but I guess you need to interoperate with other programming languages, maybe via JSON... Show quoted text
> YAML::Tiny v1.69 > > afac.yml > ------------- > > section: > one: -1.056 > three: +33 > Foo: Bar > empty: ~ > canonical: 685230 > > > afac.pl > ---------- > > use strict; > use warnings; > use YAML::Tiny qw(LoadFile); > use Data::Dumper; > > my $c = LoadFile('/tmp/afac.yml'); > > print Dumper($c), "\n"; > > > perl afac.pl > ---------------- > > $VAR1 = { > 'section' => { > 'three' => '+33', > 'empty' => undef, > 'one' => '-1.056', > 'Foo' => 'Bar' > }, > 'canonical' => '685230' > };
Subject: Re: [rt.cpan.org #111027] integer becomes string ?
Date: Sun, 10 Jan 2016 13:29:25 +0100
To: bug-YAML-Tiny [...] rt.cpan.org
From: Loïc TROCHET <losyme [...] gmail.com>
The result is not the same with YAML::XS for 'canonical': $VAR1 = { 'canonical' => 685230, 'section' => { 'one' => '-1.056', 'empty' => undef, 'three' => '+33', 'Foo' => 'Bar' } }; Normally I use YAML::XS and I detected a difference by using the MongoDB driver. Le 09/01/2016 22:32, Slaven_Rezic via RT a écrit : Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=111027 > > > On 2016-01-08 16:57:39, losyme@gmail.com wrote:
>> Hello, >> Why integer becomes string ?
> I checked also YAML, YAML::Syck, and YAML::XS --- all modules behave the same. > Seems to be a general problem (or laxness) in Perl --- normally one does not need to care about this when the resulting data is processed with Perl programs, but I guess you need to interoperate with other programming languages, maybe via JSON... >
>> YAML::Tiny v1.69 >> >> afac.yml >> ------------- >> >> section: >> one: -1.056 >> three: +33 >> Foo: Bar >> empty: ~ >> canonical: 685230 >> >> >> afac.pl >> ---------- >> >> use strict; >> use warnings; >> use YAML::Tiny qw(LoadFile); >> use Data::Dumper; >> >> my $c = LoadFile('/tmp/afac.yml'); >> >> print Dumper($c), "\n"; >> >> >> perl afac.pl >> ---------------- >> >> $VAR1 = { >> 'section' => { >> 'three' => '+33', >> 'empty' => undef, >> 'one' => '-1.056', >> 'Foo' => 'Bar' >> }, >> 'canonical' => '685230' >> };
> >
On 2016-01-10 07:29:43, losyme@gmail.com wrote: Show quoted text
> The result is not the same with YAML::XS for 'canonical': $VAR1 = { > 'canonical' => 685230, 'section' => { 'one' => '-1.056', 'empty' => > undef, 'three' => '+33', 'Foo' => 'Bar' } }; >
You're right with YAML::XS. Still YAML and YAML::Syck make a PV of the canonical value. Show quoted text
> > > > > Normally I use YAML::XS and I detected a difference by using the > MongoDB > driver. > > Le 09/01/2016 22:32, Slaven_Rezic via RT a écrit :
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=111027 > > > > > On 2016-01-08 16:57:39, losyme@gmail.com wrote:
> >> Hello, > >> Why integer becomes string ?
> > I checked also YAML, YAML::Syck, and YAML::XS --- all modules behave > > the same. > > Seems to be a general problem (or laxness) in Perl --- normally one > > does not need to care about this when the resulting data is processed > > with Perl programs, but I guess you need to interoperate with other > > programming languages, maybe via JSON... > >
> >> YAML::Tiny v1.69 > >> > >> afac.yml > >> ------------- > >> > >> section: > >> one: -1.056 > >> three: +33 > >> Foo: Bar > >> empty: ~ > >> canonical: 685230 > >> > >> > >> afac.pl > >> ---------- > >> > >> use strict; > >> use warnings; > >> use YAML::Tiny qw(LoadFile); > >> use Data::Dumper; > >> > >> my $c = LoadFile('/tmp/afac.yml'); > >> > >> print Dumper($c), "\n"; > >> > >> > >> perl afac.pl > >> ---------------- > >> > >> $VAR1 = { > >> 'section' => { > >> 'three' => '+33', > >> 'empty' => undef, > >> 'one' => '-1.056', > >> 'Foo' => 'Bar' > >> }, > >> 'canonical' => '685230' > >> };
> > > >