{"id":28994027,"url":"https://github.com/ccakes/protobuf-pl","last_synced_at":"2025-06-25T03:10:16.474Z","repository":{"id":300510253,"uuid":"997977014","full_name":"ccakes/protobuf-pl","owner":"ccakes","description":"A simple, vibe-coded Protocol Buffers code generator for Perl 5","archived":false,"fork":false,"pushed_at":"2025-06-22T04:47:07.000Z","size":62,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-22T05:27:17.683Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ccakes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-07T15:53:40.000Z","updated_at":"2025-06-22T04:47:10.000Z","dependencies_parsed_at":"2025-06-22T05:37:24.637Z","dependency_job_id":null,"html_url":"https://github.com/ccakes/protobuf-pl","commit_stats":null,"previous_names":["ccakes/protobuf-pl"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ccakes/protobuf-pl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccakes%2Fprotobuf-pl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccakes%2Fprotobuf-pl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccakes%2Fprotobuf-pl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccakes%2Fprotobuf-pl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ccakes","download_url":"https://codeload.github.com/ccakes/protobuf-pl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccakes%2Fprotobuf-pl/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261795344,"owners_count":23210621,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-25T03:10:14.476Z","updated_at":"2025-06-25T03:10:16.460Z","avatar_url":"https://github.com/ccakes.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# protobuf-pl - Protocol Buffers Compiler for Perl\n\n\u003e **Note**: This entire repository was generated by AI with very little human intervention except to verify that it (mostly) works.\n\nA pure Perl implementation of a Protocol Buffers compiler that generates Perl code from `.proto` files. This tool provides a solution for working with Protocol Buffers in Perl without requiring the official protoc compiler or external dependencies.\n\n## Features\n\n- **Pure Perl Implementation**: No external dependencies beyond Perl core modules\n- **Proto3 Support**: Full support for Protocol Buffers version 3 syntax\n- **Complete Wire Format**: Proper binary encoding/decoding using Protocol Buffers wire format\n- **All Field Types**: Support for scalars, messages, enums, repeated fields, and maps\n- **Nested Types**: Support for nested messages and enums\n- **Import System**: Handle proto file imports and dependencies\n- **Round-trip Fidelity**: Preserves unknown fields for forward/backward compatibility\n\n## Quick Start\n\n### Installation\n\nClone this repository and ensure the `script/protoc-gen-pl5` is executable:\n\n```bash\ngit clone https://github.com/ccakes/protobuf-pl5\ncd protobuf-pl\nchmod +x script/protoc-gen-pl5\n```\n\n### Basic Usage\n\n```bash\n# Generate Perl code from a proto file\n./script/protoc-gen-pl5 proto/example.proto\n\n# Specify output directory\n./script/protoc-gen-pl5 --out=lib/generated proto/example.proto\n\n# Add include paths for imports\n./script/protoc-gen-pl5 -I./proto -I./common --out=lib proto/example.proto\n```\n\n### Using Generated Code\n\n```perl\nuse lib 'generated';\nuse Example::Person;\nuse Example::Status;\n\n# Create a new message\nmy $person = Example::Person-\u003enew(\n    name =\u003e 'John Doe',\n    id   =\u003e 123,\n    email =\u003e 'john@example.com'\n);\n\n# Add repeated fields\n$person-\u003ephone_numbers(['555-1234', '555-5678']);\n\n# Encode to binary format\nmy $binary = $person-\u003eencode;\n\n# Decode from binary format  \nmy $decoded = Example::Person-\u003edecode($binary);\n\n# Access fields\nprint $decoded-\u003ename;  # 'John Doe'\nprint $decoded-\u003eid;    # 123\n```\n\n## Architecture\n\nThe compiler consists of four main components:\n\n### 1. Parser (`lib/Proto/PL/Parser.pm`)\n- Tokenizes and parses `.proto` files\n- Handles imports and include paths\n- Builds an Abstract Syntax Tree (AST)\n- Supports proto3 syntax and features\n\n### 2. AST (`lib/Proto/PL/AST.pm`)\n- Defines node types for the syntax tree\n- Represents messages, fields, enums, and file structure\n- Provides methods for traversing and querying the AST\n\n### 3. Generator (`lib/Proto/PL/Generator.pm`)\n- Converts AST to Perl code\n- Generates message classes with proper inheritance\n- Creates field accessors and validation\n- Handles package mapping to Perl namespaces\n\n### 4. Runtime (`lib/Proto/PL/Runtime.pm`)\n- Base classes for generated code\n- Wire format encoding/decoding\n- Message serialization and deserialization\n- Field presence tracking and unknown field handling\n\n## Generated Code Structure\n\nFor a proto file with package `example` containing a message `Person`, the generator creates:\n\n```\nlib/\n└── Example/\n    └── Person.pm\n```\n\nEach generated class:\n- Extends `Proto::PL::Runtime::Message`\n- Provides field accessor methods\n- Includes `encode()` and `decode()` methods\n- Supports conversion to/from hash representations\n- Maintains wire format compatibility\n\n## Command Line Options\n\n```bash\n./script/protoc-gen-pl5 [options] proto_file...\n\nOptions:\n    --out, --output-dir DIR    Output directory (default: lib)\n    -I, --include-path DIR     Add directory to import search path\n    -h, --help                 Show help message\n    --version                  Show version information\n```\n\n## Supported Features\n\n### ✅ Currently Supported\n- Proto3 syntax\n- Messages with all field types (scalar, message, enum)\n- Nested messages and enums\n- Repeated fields and maps\n- Oneofs (union types)\n- Optional fields\n- Import statements\n- Package declarations\n- Wire format encoding/decoding\n- JSON serialization\n- Unknown field preservation\n\n### ❌ Not Yet Supported\n- Services and RPC definitions\n- Proto2 specific features (required/optional semantics)\n- Reflection capabilities\n- Custom options\n\n## Requirements\n\n- Perl 5.10 or later\n- Core Perl modules only (no CPAN dependencies)\n\n## License\n\nThis software is distributed under the same terms as Perl itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccakes%2Fprotobuf-pl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fccakes%2Fprotobuf-pl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccakes%2Fprotobuf-pl/lists"}