Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TOML::Tiny breaks on null array elements #18

Open
hadfl opened this issue Apr 30, 2022 · 0 comments
Open

TOML::Tiny breaks on null array elements #18

hadfl opened this issue Apr 30, 2022 · 0 comments

Comments

@hadfl
Copy link

hadfl commented Apr 30, 2022

TOML::Tiny breaks when there are null array elements (edited since the initial bug report was using a top level array):

given this test:

use TOML::Tiny qw(from_toml to_toml);
use Data::Dumper;

my $data = {
    hash => [
        { a => 1, b => 2 },
        undef,
        { a => 3, b => 4 },
    ]
};

print Dumper $data;

my $data_t = to_toml $data;

print $data_t, "\n";

my $data_ = from_toml $data_t;

print Dumper $data_;

it leads to this:

$VAR1 = {
          'hash' => [
                      {
                        'a' => 1,
                        'b' => 2
                      },
                      undef,
                      {
                        'a' => 3,
                        'b' => 4
                      }
                    ]
        };
Use of uninitialized value $data in pattern match (m//) at /build/zadm/thirdparty/lib/perl5/TOML/Tiny/Writer.pm line 73.
Use of uninitialized value $data in pattern match (m//) at /build/zadm/thirdparty/lib/perl5/TOML/Tiny/Writer.pm line 74.
Use of uninitialized value $arg in substitution (s///) at /build/zadm/thirdparty/lib/perl5/TOML/Tiny/Writer.pm line 215.
Use of uninitialized value $arg in substitution (s///) at /build/zadm/thirdparty/lib/perl5/TOML/Tiny/Writer.pm line 216.
Use of uninitialized value $arg in concatenation (.) or string at /build/zadm/thirdparty/lib/perl5/TOML/Tiny/Writer.pm line 218.
hash=[
  {a=1, b=2},
  "",
  {a=3, b=4},
]
$VAR1 = {
          'hash' => [
                      {
                        'a' => 1,
                        'b' => 2
                      },
                      '',
                      {
                        'b' => 4,
                        'a' => 3
                      }
                    ]
        };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant