protoc-gen-perl-gpd - protoc plugin for Google::ProtocolBuffers::Dynamic
protoc --perl-gpd_out=package=Foo.Bar:lib foo.proto protoc --perl-gpd_out=package=Foo.Bar,check_enum_values:lib foo.proto protoc --perl-gpd_out=package=Foo.Bar,no_check_enum_values:lib foo.proto
This protoc plugin generates wrapper modules for protobuf messages, to avoid the need of shipping .proto files with a module/distribution.
Note that since protoc command-line parsing reserves the colon as a separator between options list and output directory, the dot is used as a package separator for both protobuf and Perl packages.
Specifies the output package/file (package=Foo.Bar creates a module named Foo/Bar.pm under the output directory).
package=Foo.Bar
If no explicit mapping is specified, protobuf packages are automatically mapped to Perl packages under the main package (e.g. protobuf package baz will be mapped to Foo::Bar::Baz).
baz
Foo::Bar::Baz
Equivalent to the package mapping of "map" in Google::ProtocolBuffers::Dynamic.
package
The prefix sub-option is mandatory.
prefix
OPTIONS is a comma-separated list, see "Mapping options" for available options.
OPTIONS
Equivalent to the pb_prefix mapping of "map" in Google::ProtocolBuffers::Dynamic.
pb_prefix
Equivalent to either the map_message or map_message_prefix mapping of "map" in Google::ProtocolBuffers::Dynamic.
map_message
map_message_prefix
Either to or prefix sub-option is mandatory.
to
The following options map one to one to the options key of "map" in Google::ProtocolBuffers::Dynamic. When specified before the first mapping, they are applied to all mappings.
options
Boolean options: implicit_maps, use_bigints, check_required_fields, explicit_defaults, encode_defaults, encode_defaults_proto3, check_enum_values, generic_extension_methods. When specified they set the option value to 1, when prefixed with no_ (e.g. no_use_bigints) they set the option value to 0.
implicit_maps
use_bigints
check_required_fields
explicit_defaults
encode_defaults
encode_defaults_proto3
check_enum_values
generic_extension_methods
no_
no_use_bigints
String options: accessor_style, client_services and boolean_values set the corresponding option to the specified value
accessor_style
client_services
boolean_values
Generated code uses insertion points to enable customization via protoc plugins.
protoc
The official documentation for insertion points offers more details on what insertion points are and how they can be used. protoc-gen-perl-gpd-add-pragma and Google::ProtocolBuffers::Dynamic::AddPragma source code is a simple example of a protoc plugin that uses insertion points.
Currently available insertion points:
Inserts code after the use strict / use warnings at the top of the module.
use strict / use warnings
Inserts code after serialized descriptors have been loaded, but beforre mapping.
Inserts code after mapping options have been applied.
To install Google::ProtocolBuffers::Dynamic, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Google::ProtocolBuffers::Dynamic
CPAN shell
perl -MCPAN -e shell install Google::ProtocolBuffers::Dynamic
For more information on module installation, please visit the detailed CPAN module installation guide.