From bd375b999dd3a55e657da8f75ed7928f569bf413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tina=20M=C3=BCller?= Date: Fri, 29 Dec 2023 23:01:52 +0100 Subject: [PATCH] WIP --- lib/YAML/PP/Loader.pm | 6 ++++-- t/58.utf8.t | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/YAML/PP/Loader.pm b/lib/YAML/PP/Loader.pm index 1dd9e145..84eacc29 100644 --- a/lib/YAML/PP/Loader.pm +++ b/lib/YAML/PP/Loader.pm @@ -80,8 +80,9 @@ sub filename { sub load_string { my ($self, $yaml) = @_; my $utf8 = $self->{utf8}; - my $p = $self->parser; - if ($self->parser->can('new_reader')) { + my $p = ref $self->parser; + no strict 'refs'; + if (defined &{$p."::new_reader"}) { $self->parser->new_reader('YAML::PP::Reader' => input => $yaml, utf8_in => $self->{utf8}, @@ -93,6 +94,7 @@ sub load_string { input => $yaml, utf8_in => $self->{utf8}, )); + $self->load(); } } diff --git a/t/58.utf8.t b/t/58.utf8.t index af58f337..e0ed9d64 100644 --- a/t/58.utf8.t +++ b/t/58.utf8.t @@ -81,8 +81,6 @@ subtest 'YAML::PP::LibYAML' => sub { utf8 => 0, ); my $p_default = YAML::PP::LibYAML->new(header => 0); - my $parser = $p_utf8->loader->parser; - warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\$parser], ['parser']); subtest 'load unicode' => sub { my $data = $p_utf8->load_string($utf8); is $data->[0], $bear_perl, 'load utf8';