change $VERSION in generated code

4 views
Skip to first unread message

Seth Daniel

unread,
Feb 22, 2009, 3:28:05 AM2/22/09
to protobu...@googlegroups.com
Hi,

Currently it looks like the perlxs generator hardcodes the $VERSION of
the generated perl module to "1.0".

Does it make sense to add an option to protoxs, say '--module_version',
that allows a developer to specify what that $VERSION should be?

Or is there a better way?

(I'm willing to write the patch for this, I just want to make certain
I'm going down the right path)

--
seth /\ sethdaniel.org

Seth Daniel

unread,
Feb 22, 2009, 6:25:33 AM2/22/09
to protobu...@googlegroups.com


I apologize for following up my own message, but I had forgotten
entirely about custom options. I imagine it would be more appropriate
to specify the $VERSION for the generated perl module in an option?

--
seth /\ sethdaniel.org

Dave Bailey

unread,
Feb 23, 2009, 6:43:20 PM2/23/09
to protobu...@googlegroups.com
Hi Seth,

I think you're right, $VERSION is something we should allow to be
specified in a custom option.

We have a couple of other things for which custom options might be
useful - for example, in

http://code.google.com/p/protobuf-perlxs/source/browse/trunk/examples/package/messages.proto

it would be nice if we could suppress generation of the .pm files for
each of the message types (One, Two, and Three), since they are not
needed. These both seem to be message-level options, but I'm sure we
can come up with many other options to provide users with better
control over the generated code.

We (protobuf-perlxs) have been allocated field number 1001 for custom
options in Protocol Buffers, so we have the ability to define these
options at the file, message, field, and other levels. I haven't
tried it yet, but Kenton Varda described to me how we could do this:

=====================================
OK, take field number 1001 for all options types. If you have
multiple options that apply to the same type you can group them
together into a message, e.g.:

package perlxs;

message FieldOptions {
optional int32 foo = 1;
optional string bar = 2;
}

extend google.protobuf.FieldOptions {
optional FieldOptions field_options = 1001;
}

// Elsewhere...
message Foo {
optional int32 a = 1 [perlxs.field_options.foo = 1,
perlxs.field_options.bar = "blah"];
}
==========================================

-dave
Reply all
Reply to author
Forward
0 new messages