NAME

protoc-gen-perl-gpd - protoc plugin for Google::ProtocolBuffers::Dynamic

SYNOPSIS

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

DESCRIPTION

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.

OPTIONS

package=PACKAGE

Specifies the output package/file (package=Foo.Bar creates a module named Foo/Bar.pm under the output directory).

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).

map_package=PACKAGE,prefix=PREFIX[,OPTIONS]

Equivalent to the package mapping of "map" in Google::ProtocolBuffers::Dynamic.

The prefix sub-option is mandatory.

OPTIONS is a comma-separated list, see "Mapping options" for available options.

pb_prefix=PACKAGE,prefix=PREFIX[,OPTIONS]

Equivalent to the pb_prefix mapping of "map" in Google::ProtocolBuffers::Dynamic.

The prefix sub-option is mandatory.

OPTIONS is a comma-separated list, see "Mapping options" for available options.

Mapping options

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.

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.

String options: accessor_style, client_services set the corresponding option to the specified value

INSERTION POINTS

Generated code uses insertion points to enable customization via protoc plugins.

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:

after_pragmas

Inserts code after the use strict / use warnings at the top of the module.

after_loading

Inserts code after serialized descriptors have been loaded, but beforre mapping.

after_mapping

Inserts code after mapping options have been applied.