Repository: lucy-clownfish Updated Branches: refs/heads/master cf29eb724 -> 1150ddb72
Remove Clownfish::to_perl Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/2348f38b Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/2348f38b Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/2348f38b Branch: refs/heads/master Commit: 2348f38b59ca8266caa4ce58bc887f0b574db824 Parents: 1182c0d Author: Nick Wellnhofer <wellnho...@aevum.de> Authored: Tue Nov 17 15:18:33 2015 +0100 Committer: Nick Wellnhofer <wellnho...@aevum.de> Committed: Tue Nov 17 18:27:56 2015 +0100 ---------------------------------------------------------------------- runtime/perl/buildlib/Clownfish/Build/Binding.pm | 16 ---------------- runtime/perl/lib/Clownfish.pm | 5 +---- runtime/perl/t/018-host.t | 6 +++--- runtime/perl/t/binding/017-hash.t | 4 ++-- 4 files changed, 6 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/2348f38b/runtime/perl/buildlib/Clownfish/Build/Binding.pm ---------------------------------------------------------------------- diff --git a/runtime/perl/buildlib/Clownfish/Build/Binding.pm b/runtime/perl/buildlib/Clownfish/Build/Binding.pm index 99fa1a3..b86732a 100644 --- a/runtime/perl/buildlib/Clownfish/Build/Binding.pm +++ b/runtime/perl/buildlib/Clownfish/Build/Binding.pm @@ -56,22 +56,6 @@ CODE: RETVAL = CFISH_OBJ_TO_SV_NOINC(obj); } OUTPUT: RETVAL - -SV* -to_perl(sv) - SV *sv; -CODE: -{ - if (sv_isobject(sv) && sv_derived_from(sv, "Clownfish::Obj")) { - IV tmp = SvIV(SvRV(sv)); - cfish_Obj* obj = INT2PTR(cfish_Obj*, tmp); - RETVAL = XSBind_cfish_to_perl(aTHX_ obj); - } - else { - RETVAL = newSVsv(sv); - } -} -OUTPUT: RETVAL END_XS_CODE my $binding = Clownfish::CFC::Binding::Perl::Class->new( http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/2348f38b/runtime/perl/lib/Clownfish.pm ---------------------------------------------------------------------- diff --git a/runtime/perl/lib/Clownfish.pm b/runtime/perl/lib/Clownfish.pm index 35dd891..9a8f03d 100644 --- a/runtime/perl/lib/Clownfish.pm +++ b/runtime/perl/lib/Clownfish.pm @@ -25,10 +25,7 @@ $VERSION = eval $VERSION; use Exporter 'import'; BEGIN { - our @EXPORT_OK = qw( - to_clownfish - to_perl - ); + our @EXPORT_OK = qw( to_clownfish ); } # On most UNIX variants, this flag makes DynaLoader pass RTLD_GLOBAL to http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/2348f38b/runtime/perl/t/018-host.t ---------------------------------------------------------------------- diff --git a/runtime/perl/t/018-host.t b/runtime/perl/t/018-host.t index 050a010..dc546fd 100644 --- a/runtime/perl/t/018-host.t +++ b/runtime/perl/t/018-host.t @@ -17,7 +17,7 @@ use strict; use warnings; use Test::More tests => 3; -use Clownfish qw( to_perl to_clownfish ); +use Clownfish qw( to_clownfish ); my %complex_data_structure = ( a => [ 1, 2, 3, { ooga => 'booga' } ], @@ -25,7 +25,7 @@ my %complex_data_structure = ( ); my $kobj = to_clownfish( \%complex_data_structure ); isa_ok( $kobj, 'Clownfish::Obj' ); -my $transformed = to_perl($kobj); +my $transformed = $kobj->to_perl; is_deeply( $transformed, \%complex_data_structure, "transform from Perl to Clownfish data structures and back" ); @@ -35,7 +35,7 @@ my $salt_and_pepper = Clownfish::Hash->new; $salt_and_pepper->store( 'salt', Clownfish::ByteBuf->new('pepper') ); $complex_data_structure{c} = $bread_and_butter; $complex_data_structure{d} = $salt_and_pepper; -$transformed = to_perl( to_clownfish( \%complex_data_structure ) ); +$transformed = to_clownfish( \%complex_data_structure )->to_perl; $complex_data_structure{c} = { bread => 'butter' }; $complex_data_structure{d} = { salt => 'pepper' }; is_deeply( $transformed, \%complex_data_structure, http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/2348f38b/runtime/perl/t/binding/017-hash.t ---------------------------------------------------------------------- diff --git a/runtime/perl/t/binding/017-hash.t b/runtime/perl/t/binding/017-hash.t index 8844255..5a3c07c 100644 --- a/runtime/perl/t/binding/017-hash.t +++ b/runtime/perl/t/binding/017-hash.t @@ -17,7 +17,7 @@ use strict; use warnings; use Test::More tests => 4; -use Clownfish qw( to_perl to_clownfish ); +use Clownfish qw( to_clownfish ); my $hash = Clownfish::Hash->new( capacity => 10 ); $hash->store( "foo", Clownfish::String->new("bar") ); @@ -32,6 +32,6 @@ ok( !defined($hash->fetch("nada")), "store/fetch undef value" ); is( $hash->get_size, 1, "size after storing undef value" ); my %hash_with_utf8_keys = ( "\x{263a}" => "foo" ); -my $round_tripped = to_perl( to_clownfish( \%hash_with_utf8_keys ) ); +my $round_tripped = to_clownfish( \%hash_with_utf8_keys )->to_perl; is_deeply( $round_tripped, \%hash_with_utf8_keys, "Round trip conversion of hash with UTF-8 keys" );