Author: gsim Date: Fri Oct 10 12:39:23 2014 New Revision: 1630784 URL: http://svn.apache.org/r1630784 Log: PROTON-646: Fix when Perl sets a message body to be BOOL:False.
Had to work around how checking whether a body value was defined would return false if it were defined but set to false. Modified: qpid/proton/branches/examples/examples/messenger/perl/recv.pl qpid/proton/branches/examples/proton-c/bindings/perl/lib/qpid/proton/Data.pm qpid/proton/branches/examples/proton-c/bindings/perl/lib/qpid/proton/Message.pm Modified: qpid/proton/branches/examples/examples/messenger/perl/recv.pl URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/examples/messenger/perl/recv.pl?rev=1630784&r1=1630783&r2=1630784&view=diff ============================================================================== --- qpid/proton/branches/examples/examples/messenger/perl/recv.pl (original) +++ qpid/proton/branches/examples/examples/messenger/perl/recv.pl Fri Oct 10 12:39:23 2014 @@ -61,6 +61,9 @@ for(;;) if (!defined($body_type)) { print "The body type wasn't defined!\n"; + } elsif ($body_type == qpid::proton::BOOL) { + print "[BOOL]\n"; + print "" . ($body ? "TRUE" : "FALSE") . "\n"; } elsif ($body_type == qpid::proton::MAP) { print "[HASH]\n"; print Dumper(\%{$body}) . "\n"; Modified: qpid/proton/branches/examples/proton-c/bindings/perl/lib/qpid/proton/Data.pm URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/proton-c/bindings/perl/lib/qpid/proton/Data.pm?rev=1630784&r1=1630783&r2=1630784&view=diff ============================================================================== --- qpid/proton/branches/examples/proton-c/bindings/perl/lib/qpid/proton/Data.pm (original) +++ qpid/proton/branches/examples/proton-c/bindings/perl/lib/qpid/proton/Data.pm Fri Oct 10 12:39:23 2014 @@ -321,9 +321,7 @@ Handles a boolean (B<true>/B<false>) nod sub put_bool { my ($self) = @_; my $impl = $self->{_impl}; - my $value = $_[1]; - - die "bool must be defined" if !defined($value); + my $value = $_[1] || 0; cproton_perl::pn_data_put_bool($impl, $value); } Modified: qpid/proton/branches/examples/proton-c/bindings/perl/lib/qpid/proton/Message.pm URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/proton-c/bindings/perl/lib/qpid/proton/Message.pm?rev=1630784&r1=1630783&r2=1630784&view=diff ============================================================================== --- qpid/proton/branches/examples/proton-c/bindings/perl/lib/qpid/proton/Message.pm (original) +++ qpid/proton/branches/examples/proton-c/bindings/perl/lib/qpid/proton/Message.pm Fri Oct 10 12:39:23 2014 @@ -487,12 +487,12 @@ sub get_body_type { sub preencode() { my ($self) = @_; my $impl = $self->{_impl}; - my $my_body = $self->{_body}; my $body_type = $self->{_body_type}; my $body = new qpid::proton::Data(cproton_perl::pn_message_body($impl)); + $body->clear(); - $body_type->put($body, $my_body) if($my_body && $body_type); + $body_type->put($body, $my_body) if(defined($my_body) && $body_type); my $my_props = $self->{_properties}; my $props = new qpid::proton::Data(cproton_perl::pn_message_properties($impl)); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org