#!/usr/bin/env perl
use Google::ProtocolBuffers::Dynamic::ProtocPlugin
    help => 'podusage',
    run  => 'Google::ProtocolBuffers::Dynamic::MakeModule';

exit 0;

__END__

=head1 NAME

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

=head1 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

=head1 DESCRIPTION

This F<protoc> plugin generates wrapper modules for protobuf messages,
to avoid the need of shipping F<.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.

=head1 OPTIONS

=head2 package=PACKAGE

Specifies the output package/file (C<package=Foo.Bar> creates a module
named F<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 C<baz> will be mapped to C<Foo::Bar::Baz>).

=head2 map_package=PACKAGE,prefix=PREFIX[,OPTIONS]

Equivalent to the C<package> mapping of L<Google::ProtocolBuffers::Dynamic/map>.

The C<prefix> sub-option is mandatory.

C<OPTIONS> is a comma-separated list, see L</Mapping options> for
available options.

=head2 pb_prefix=PACKAGE,prefix=PREFIX[,OPTIONS]

Equivalent to the C<pb_prefix> mapping of L<Google::ProtocolBuffers::Dynamic/map>.

The C<prefix> sub-option is mandatory.

C<OPTIONS> is a comma-separated list, see L</Mapping options> for
available options.

=head2 map_message=MESSAGE,<to=PACKAGE|prefix=PREFIX>[,OPTIONS]

Equivalent to either the C<map_message> or C<map_message_prefix>
mapping of L<Google::ProtocolBuffers::Dynamic/map>.

Either C<to> or C<prefix> sub-option is mandatory.

C<OPTIONS> is a comma-separated list, see L</Mapping options> for
available options.

=head2 Mapping options

The following options map one to one to the C<options> key of
L<Google::ProtocolBuffers::Dynamic/map>. When specified before the
first mapping, they are applied to all mappings.

Boolean options: C<implicit_maps>, C<use_bigints>, C<check_required_fields>,
C<explicit_defaults>, C<encode_defaults>, C<encode_defaults_proto3>, C<check_enum_values>,
C<generic_extension_methods>. When specified they set the option value
to 1, when prefixed with C<no_> (e.g. C<no_use_bigints>) they set the
option value to 0.

String options: C<accessor_style>, C<client_services> and C<boolean_values>
set the corresponding option to the specified value

=head1 INSERTION POINTS

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

The
L<official documentation for insertion points|https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.compiler.plugin.pb>
offers more details on what insertion points are and how they can be
used. L<protoc-gen-perl-gpd-add-pragma> and
L<Google::ProtocolBuffers::Dynamic::AddPragma> source code is a simple
example of a C<protoc> plugin that uses insertion points.

Currently available insertion points:

=head2 after_pragmas

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

=head2 after_loading

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

=head2 after_mapping

Inserts code after mapping options have been applied.

=cut
