From: Jeff Ober Date: Mon, 30 Mar 2020 20:46:25 +0000 (-0400) Subject: Fix broken OO interface X-Git-Tag: nailing-cargo/1.0.0~234^2~1 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=142ac081b10c6ab2431ce734b970029d9442c7e3;p=nailing-cargo.git Fix broken OO interface --- diff --git a/Changes b/Changes index 00a2887..5737812 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,6 @@ {{$NEXT}} -Performance improvements in TOML::Tiny::Tokenizer->next_token +-Fix totally broken OO interface (thanks noctux) 0.05 2020-01-21 -POD fixes for TOML::Tiny::Grammar diff --git a/README.pod b/README.pod index a42a7ed..911f6db 100644 --- a/README.pod +++ b/README.pod @@ -181,7 +181,7 @@ an array of mixed types if C was set. =head2 parse -Alias for C to provide compatibility with C when +Alias for C to provide compatibility with C when overriding the parser by setting C<$TOML::Parser>. =head1 DIFFERENCES FROM L AND L diff --git a/lib/TOML/Tiny.pm b/lib/TOML/Tiny.pm index 8025252..6cd88be 100644 --- a/lib/TOML/Tiny.pm +++ b/lib/TOML/Tiny.pm @@ -43,12 +43,12 @@ sub new { bless{ %param, parser => TOML::Tiny::Parser->new(%param) }, $class; } -sub encode { +sub decode { my ($self, $source) = @_; - $self->{parser}->parse; + $self->{parser}->parse($source); } -sub decode { +sub encode { my ($self, $data) = @_; TOML::Tiny::Writer::to_toml($data, strict_arrays => $self->{strict_arrays}, @@ -59,7 +59,7 @@ sub decode { # For compatibility with TOML::from_toml's use of $TOML::Parser #------------------------------------------------------------------------------- sub parse { - goto \&encode; + goto \&decode; } 1; @@ -237,7 +237,7 @@ an array of mixed types if C was set. =head2 parse -Alias for C to provide compatibility with C when +Alias for C to provide compatibility with C when overriding the parser by setting C<$TOML::Parser>.