Revision 4 (by moose, 2009/02/13 04:09:19) * add msgtest2.pl test for new highlevel api
* separate XS into Message and Item related code
* remove Makefile.old from svn
* add encode/decode support to hl CSE::Proto::Message class
* convert CSE::Proto::C::Item to use a simple blessed pointer instead of a hashref holding the handle
* fix CSE::Proto::Message::Item::clone to properly clone the value, not just copy an ARRAY ref
* add support for MESSAGE type items in the parser
#!/usr/bin/perl

use strict;
use warnings;

use lib qw/lib/;
use CSE::Proto::Message::Parser;

# want to make this automatic some how.
my $msg = CSE::Proto::Message::Parser->new(file => 'test.proto');
$msg->parse;


use CSE::Proto::Message;
print "create obj1\n";

my $obj = CSE::Proto::Message->create('Test2');

print "set values\n";
$obj->item('teststring')->set_value('test!');
my $testint32 = $obj->item('testint32');
$testint32->add_value(100);
$testint32->add_value(200);
$testint32->add_value(300);
#$obj->item('testint32')->add_value(1);
#$obj->item('testint32')->add_value(2);
#$obj->item('testint32')->add_value(3);

print "encode obj1\n";
my $data = $obj->encode;

print "create obj2\n";
my $obj2 = CSE::Proto::Message->create('Test2');

print "decode data to obj2\n";
$obj2->decode($data);

print "compare obj1 & obj2\n";
if($obj->compare($obj2)) {
   print "obj1 == obj2\n";
}
else {
   print "obj1 != obj2\n";
}