summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarryl L. Pierce <mcpierce@apache.org>2014-02-11 15:15:14 +0000
committerDarryl L. Pierce <mcpierce@apache.org>2014-02-11 15:15:14 +0000
commit759eb840f3b5ffcc56155369b02ed360ce19c409 (patch)
tree6ed9ac939cc991a083dbe3136253430deae831ad
parente7f38ba330b84f62ca5361fabe0c16c3fa849882 (diff)
downloadqpid-python-759eb840f3b5ffcc56155369b02ed360ce19c409.tar.gz
QPID-5546: Expose the get_content_object method in Perl.
Updated the spout and drain examples to use this rather than encode/decode to retrieve the content of a message. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1567173 13f79535-47bb-0310-9956-ffa450edef68
-rwxr-xr-xqpid/cpp/bindings/qpid/examples/perl/drain.pl4
-rwxr-xr-xqpid/cpp/bindings/qpid/examples/perl/spout.pl2
-rw-r--r--qpid/cpp/bindings/qpid/perl/lib/qpid/messaging/Message.pm33
3 files changed, 36 insertions, 3 deletions
diff --git a/qpid/cpp/bindings/qpid/examples/perl/drain.pl b/qpid/cpp/bindings/qpid/examples/perl/drain.pl
index f7a710c485..d0150854b2 100755
--- a/qpid/cpp/bindings/qpid/examples/perl/drain.pl
+++ b/qpid/cpp/bindings/qpid/examples/perl/drain.pl
@@ -92,13 +92,13 @@ eval {
# if the message content was a map, then we will print
# it out as a series of name => value pairs
+ my $content = $message->get_content_object;
if ( $message->get_content_type() eq "amqp/map" ) {
- my $content = $message->get_content();
map { print "\n$_ => $content->{$_}"; } keys %{$content};
}
else {
# it's not a map, so just print the content as a string
- print $message->get_content();
+ print $content;
}
print "')\n";
diff --git a/qpid/cpp/bindings/qpid/examples/perl/spout.pl b/qpid/cpp/bindings/qpid/examples/perl/spout.pl
index 7468a25a3a..c97c2a58af 100755
--- a/qpid/cpp/bindings/qpid/examples/perl/spout.pl
+++ b/qpid/cpp/bindings/qpid/examples/perl/spout.pl
@@ -91,7 +91,7 @@ eval {
if (@entries) {
my $content = {};
setEntries($content);
- $message->set_content($content);
+ $message->set_content_object($content);
}
elsif ($content) {
$message->set_content($content);
diff --git a/qpid/cpp/bindings/qpid/perl/lib/qpid/messaging/Message.pm b/qpid/cpp/bindings/qpid/perl/lib/qpid/messaging/Message.pm
index 6437290244..6926eb221f 100644
--- a/qpid/cpp/bindings/qpid/perl/lib/qpid/messaging/Message.pm
+++ b/qpid/cpp/bindings/qpid/perl/lib/qpid/messaging/Message.pm
@@ -527,6 +527,39 @@ sub get_properties {
=pod
+=head2 CONTENT OBJECT
+
+The message content, represented as anh object.
+
+=over
+
+=item $msg->set_content_object( \%content )
+
+=item $content = $msg->get_Content_object
+
+=back
+
+=cut
+
+sub set_content_object {
+ my ($self) = @_;
+ my $impl = $self->{_impl};
+
+ my $content = $_[1];
+
+ $impl->setContentObject($content);
+}
+
+sub get_content_object {
+ my ($self) = @_;
+ my $impl = $self->{_impl};
+ my $content = $impl->getContentObject;
+
+ return $content;
+}
+
+=pod
+
=head2 CONTENT
The message content.