NAME
Protobuf::Descriptor::Enum - Descriptor for a Protocol Buffer enum
VERSION
version 0.04
SYNOPSIS
my $pool = Protobuf::DescriptorPool->generated_pool;
my $enum_def = $pool->find_enum_by_name('my.package.MyEnum');
if ($enum_def) {
print "Enum Name: ", $enum_def->full_name, "
";
for my $i (0 .. $enum_def->value_count - 1) {
# Note: methods to get value details are on EnumValueDef
# This example just shows count and name by index.
print " Value: ", $enum_def->value_name($i), "
";
}
}
DESCRIPTION
This class represents the descriptor for a single Protocol Buffer enum type. It provides methods to introspect the enum's name and values.
Instances of this class are usually obtained from a Protobuf::DescriptorPool.
METHODS
full_name()
Returns the fully qualified name of the enum (e.g., my.package.MyEnum).
name()
Returns the short name of the enum (e.g., MyEnum).
value_count()
Returns the number of values defined in this enum.
value_name($index)
Returns the string name of the enum value at the given $index (0-based).
SEE ALSO
Protobuf, Protobuf::DescriptorPool, Protobuf::Descriptor
AUTHOR
C.J. Collier <cjac@google.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Google LLC.
This is free software; you can redistribute it and/or modify it under the terms of the BSD 3-Clause License.