You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by mc...@apache.org on 2013/09/06 17:45:32 UTC
svn commit: r1520609 - in /qpid/proton/trunk:
examples/messenger/perl/recv.pl examples/messenger/perl/send.pl
proton-c/bindings/perl/ChangeLog
proton-c/bindings/perl/lib/qpid/proton/Message.pm
Author: mcpierce
Date: Fri Sep 6 15:45:32 2013
New Revision: 1520609
URL: http://svn.apache.org/r1520609
Log:
PROTON-384: Added instructions to the Perl Message class.
Modified:
qpid/proton/trunk/examples/messenger/perl/recv.pl
qpid/proton/trunk/examples/messenger/perl/send.pl
qpid/proton/trunk/proton-c/bindings/perl/ChangeLog
qpid/proton/trunk/proton-c/bindings/perl/lib/qpid/proton/Message.pm
Modified: qpid/proton/trunk/examples/messenger/perl/recv.pl
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/examples/messenger/perl/recv.pl?rev=1520609&r1=1520608&r2=1520609&view=diff
==============================================================================
--- qpid/proton/trunk/examples/messenger/perl/recv.pl (original)
+++ qpid/proton/trunk/examples/messenger/perl/recv.pl Fri Sep 6 15:45:32 2013
@@ -57,6 +57,11 @@ for(;;)
foreach (keys $props) {
print "\t$_=$props->{$_}\n";
}
+ print "Instructions:\n";
+ my $instructions = $msg->get_instructions;
+ foreach (keys $instructions) {
+ print "\t$_=" . $instructions->{$_} . "\n";
+ }
print "Annotations:\n";
my $annotations = $msg->get_annotations();
foreach (keys $annotations) {
Modified: qpid/proton/trunk/examples/messenger/perl/send.pl
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/examples/messenger/perl/send.pl?rev=1520609&r1=1520608&r2=1520609&view=diff
==============================================================================
--- qpid/proton/trunk/examples/messenger/perl/send.pl (original)
+++ qpid/proton/trunk/examples/messenger/perl/send.pl Fri Sep 6 15:45:32 2013
@@ -51,6 +51,9 @@ foreach (@messages)
# try a few different body types
my $body_type = int(rand(4));
$msg->set_property("sent", "" . localtime(time));
+ $msg->get_instructions->{"fold"} = "yes";
+ $msg->get_instructions->{"spindle"} = "no";
+ $msg->get_instructions->{"mutilate"} = "no";
$msg->get_annotations->{"version"} = 1.0;
$msg->get_annotations->{"pill"} = "RED";
Modified: qpid/proton/trunk/proton-c/bindings/perl/ChangeLog
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/perl/ChangeLog?rev=1520609&r1=1520608&r2=1520609&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/perl/ChangeLog (original)
+++ qpid/proton/trunk/proton-c/bindings/perl/ChangeLog Fri Sep 6 15:45:32 2013
@@ -4,6 +4,7 @@ version 0.6:
* qpid::proton::Message exposes the body property.
* qpid::proton::Message exposes the properties property.
* qpid::proton::Message exports the annotations property.
+ * qpid::proton::Message exposes the instructions property.
version 0.5:
* Added the qpid::proton::Data type.
Modified: qpid/proton/trunk/proton-c/bindings/perl/lib/qpid/proton/Message.pm
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/perl/lib/qpid/proton/Message.pm?rev=1520609&r1=1520608&r2=1520609&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/perl/lib/qpid/proton/Message.pm (original)
+++ qpid/proton/trunk/proton-c/bindings/perl/lib/qpid/proton/Message.pm Fri Sep 6 15:45:32 2013
@@ -31,6 +31,7 @@ sub new {
my $impl = cproton_perl::pn_message();
$self->{_impl} = $impl;
$self->{_properties} = {};
+ $self->{_instructions} = {};
$self->{_annotations} = {};
$self->{_body} = undef;
$self->{_body_type} = undef;
@@ -65,6 +66,7 @@ sub get_impl {
sub clear {
my ($self) = @_;
cproton__perl::pn_message_clear($self->{_impl});
+ $self->{_instructions} = {};
}
sub errno {
@@ -401,6 +403,22 @@ sub set_annotations {
=pod
+=cut
+
+sub get_instructions {
+ my ($self) = @_;
+ return $self->{_instructions};
+}
+
+sub set_instructions {
+ my ($self) = @_;
+ my $instructions = $_[1];
+
+ $self->{_instructions} = $instructions;
+}
+
+=pod
+
=head2 BODY
The body of the message. When setting the body value a type must be specified,
@@ -456,6 +474,11 @@ sub preencode() {
$props->clear();
qpid::proton::MAP->put($props, $my_props) if $my_props;
+ my $my_insts = $self->{_instructions};
+ my $insts = new qpid::proton::Data(cproton_perl::pn_message_instructions($impl));
+ $insts->clear;
+ qpid::proton::MAP->put($insts, $my_insts) if $my_insts;
+
my $my_annots = $self->{_annotations};
my $annotations = new qpid::proton::Data(cproton_perl::pn_message_annotations($impl));
$annotations->clear();
@@ -481,6 +504,12 @@ sub postdecode() {
$self->{_properties} = $props->get_type->get($props);
}
+ my $insts = new qpid::proton::Data(cproton_perl::pn_message_instructions($impl));
+ $insts->rewind;
+ if ($insts->next) {
+ $self->{_instructions} = $insts->get_type->get($insts);
+ }
+
my $annotations = new qpid::proton::Data(cproton_perl::pn_message_annotations($impl));
$annotations->rewind;
if ($annotations->next) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org