NAME
Protobuf::Descriptor::File - Descriptor for a .proto file
VERSION
version 0.03
SYNOPSIS
my $pool = Protobuf::DescriptorPool->generated_pool;
my $file_def = $pool->find_file_by_name('my/app/stuff.proto');
if ($file_def) {
print "File Name: ", $file_def->name, "
";
print "Package: ", $file_def->get_package, "
";
for my $i (0 .. $file_def->top_level_message_count - 1) {
my $msg = $file_def->get_top_level_message($i);
print " Message: ", $msg->full_name, "
";
}
}
DESCRIPTION
This class represents the descriptor for a single .proto file. It contains information about the file's name, package, and the top-level messages, enums, and extensions defined within it.
Instances of this class are usually obtained from a Protobuf::DescriptorPool when a file is loaded, for example, via $pool->add_serialized_file().
METHODS
name()
Returns the path/name of the .proto file.
get_package()
Returns the package name declared in the .proto file.
top_level_message_count()
Returns the number of top-level message types defined in this file.
get_top_level_message($index)
Returns the Protobuf::Descriptor::MessageDef for the top-level message at the given $index (0-based).
SEE ALSO
Protobuf, Protobuf::DescriptorPool, Protobuf::Descriptor, Protobuf::Descriptor::MessageDef
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.