chiark / gitweb /
Fix broken OO interface
authorJeff Ober <jober@ziprecruiter.com>
Mon, 30 Mar 2020 20:46:25 +0000 (16:46 -0400)
committerJeff Ober <jober@ziprecruiter.com>
Mon, 30 Mar 2020 20:46:25 +0000 (16:46 -0400)
Changes
README.pod
lib/TOML/Tiny.pm

diff --git a/Changes b/Changes
index 00a2887be4fd3e2f3573f83730854294fdc96e4f..5737812e3d2e211b49d259e0ca485262f099dd69 100644 (file)
--- 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
index a42a7edb2453c68e17e06a8bc85b8aaa7735296c..911f6db41c8d6e3da2b495df82b43ebf65936c96 100644 (file)
@@ -181,7 +181,7 @@ an array of mixed types if C<strict_arrays> was set.
 
 =head2 parse
 
-Alias for C<encode> to provide compatibility with C<TOML::Parser> when
+Alias for C<decode> to provide compatibility with C<TOML::Parser> when
 overriding the parser by setting C<$TOML::Parser>.
 
 =head1 DIFFERENCES FROM L<TOML> AND L<TOML::Parser>
index 8025252781f9e5a89b3885915f8c21844dbd44c4..6cd88be24cf5019375e1a1c7362eac76f9b6111f 100644 (file)
@@ -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<strict_arrays> was set.
 
 =head2 parse
 
-Alias for C<encode> to provide compatibility with C<TOML::Parser> when
+Alias for C<decode> to provide compatibility with C<TOML::Parser> when
 overriding the parser by setting C<$TOML::Parser>.