Tag: bigquery

  • Why Perl Lost the Cloud Era, and How Native gRPC, Protobuf, and GenAI SDKs Can Bring It Back

    Disclaimer: The opinions stated here are my own, not those of my employer.

    Every so often, someone asks why Perl—once the undisputed duct tape of the Internet—faded from mainstream greenfield software development. Was there a single cultural flashpoint that “canceled” Perl? Was it the fifteen-year wait for Perl 6? Or did Damian Conway’s Perl Best Practices, Perl::Critic, and CPAN’s Kwalitee metrics simply arrive too late?

    Having spent time recently building a modern Protocol Buffers and gRPC cloud client stack for Perl, I’ve come to a simple conclusion: languages don’t fade solely because of syntax debates. They decline when the friction of talking to the current generation of infrastructure outweighs the language’s natural strengths.

    Here is a look back at why Perl lost momentum during the 2000s enterprise shift—and why the GenAI and gRPC era offers an unexpected opening for a modern Perl resurgence.


    1. What Actually Drove Perl’s Decline?

    Perl wasn’t sidelined by a single societal scandal. Rather, several technical, historical, and organizational forces converged between 2000 and 2012:

    TIMTOWTDI vs. Readability at Scale

    Designed by Larry Wall—a linguist by training—Perl embraced natural-language expressiveness under the motto “There’s More Than One Way To Do It” (TIMTOWTDI). Context sensitivity, topicalizers ($_), and compact regex idioms made Perl extraordinarily fast for an individual developer or sysadmin to write. Seat a hundred engineers in a shared codebase without shared guardrails, however, and TIMTOWTDI produces divergent dialects.

    As software teams scaled in the late 1990s and 2000s, engineering leadership increasingly favored Python’s counter-philosophy (“There should be one—and preferably only one—obvious way to do it”), prioritizing uniform, easily reviewable code over expressive flexibility. Tellingly, the public Google Style Guides repository maintains official prose guides for C++, C#, Go, Java, JavaScript, Python, Shell, and TypeScript—while omitting Perl altogether, leaving open-source Google Perl projects to codify standards directly in executable .perlcriticrc and .perltidyrc configurations alongside core perlstyle and Perl Best Practices.

    The Perl 6 (Raku) Waiting Game & Ecosystem Shifts

    If one historical event hurt Perl’s momentum above all else, it was the Perl 6 transition. Announced in 2000 as an ambitious, backward-incompatible redesign, Perl 6 took 15 years to reach a stable specification (ultimately renaming to Raku in 2019 as a distinct sister language). During that 2000–2015 window, much of the industry assumed Perl 5 was in maintenance mode—even as Perl 5 underwent a major renaissance between 2007 and 2012 (Modern Perl, Perl 5.10+, Moose, Moo, PSGI/Plack, and cpanminus).

    Meanwhile, Perl’s traditional strongholds migrated elsewhere: CGI.pm and mod_perl gave way to PHP, Ruby on Rails, and Django; cloud and DevOps tooling (Puppet, Chef, Ansible, Docker, Kubernetes, Terraform) coalesced around Ruby, Python, and Go; and scientific computing shifted from Perl’s 1990s bioinformatics dominance to Python’s C-extension ecosystem (NumPy, SciPy, Pandas, PyTorch). Even the 2020 debates over a proposed jump to “Perl 7″—which never came to fruition, ultimately giving way to the Perl Steering Council and steady incremental modernization via use v5.36 and use v5.40—happened long after that 2000s market shift.

    Why Perl Best Practices, Perl::Critic, and Kwalitee Didn’t Reverse the Trend Alone

    Damian Conway’s Perl Best Practices (2005), static analysis via Perl::Critic (built on PPI), formatting via Perl::Tidy, and CPAN’s Kwalitee metrics (Module::CPANTS::Analyse) solved many of the readability complaints associated with 1990s Perl. Enforce strict Perl::Critic policies and modern conventions, and Perl code becomes remarkably clear and intentional. Yet four structural factors kept those tools from reversing the broader industry trend:

    • Opt-in discipline vs. language defaults: Unlike Python’s indentation grammar or Go’s gofmt, clean Perl relies on opt-in team toolchain discipline—and two “Modern Perl” teams can still choose different object dialects (blessed hashes, Moose, Moo, or Perl 5.38+ Corinna class blocks).
    • Static analysis limits (“Only perl can parse Perl”): Because BEGIN blocks, prototypes, and symbol-table manipulation make Perl 5 undecidable to parse statically in full generality, PPI excels at lint policies but cannot easily power the deep static type checking and automated million-line AST refactorings that enterprise monorepos rely on.
    • What Kwalitee actually measures: Coined as a tongue-in-cheek pun on “Quality” (“it looks like quality, it sounds like quality, but it’s not quite quality”), Kwalitee measures CPAN distribution hygiene—metadata, licenses, POD, use strict, and test suites—making CPAN extraordinarily reliable, without addressing application-scale type safety.
    • The 2005–2011 timing gap: By the time Modern Perl matured, major tech companies had already locked in build systems, hermetic toolchains, and RPC code generators for Python and Java, leaving little appetite to fund parallel infrastructure for a second dynamic scripting language.

    2. The Real Blocker Today: The Protobuf & gRPC Chasm

    If you write Perl 5.36–5.40+ today—with native subroutine signatures, try/catch, builtin booleans, Moo or Corinna class blocks, and strict Perl::Critic gates—the language itself is clean, fast, and expressive.

    The real wall a modern Perl engineer hits isn’t syntax. It’s infrastructure integration.

    Over the past decade, cloud databases and AI services standardized on Protocol Buffers (Proto3 / Edition 2024) and gRPC over HTTP/2, using automated generators like GAPIC to ship official client libraries for Python, Go, Java, TypeScript, C#, Ruby, and PHP. Perl was left off that list. Even major commercial libraries such as the Google Ads API Perl Client Library had to build custom HTTP/1.1 REST/JSON wrappers because Perl lacked an official upb Protobuf runtime and native gRPC stack.

    When calling Cloud Spanner or an LLM requires hand-rolling OAuth2 token flows, REST wrappers, and JSON payload builders for every service, Perl loses its greatest superpower: getting complex things done fast.


    3. Closing the Gap: A Modular Cloud & AI Stack for Perl

    To test whether modern API ergonomics can revitalize Perl for cloud and AI engineering, I’ve been building an open-source modular stack (published on CPAN and GitHub) that brings first-class Protocol Buffers, gRPC, DBI drivers, and automated client generation to Perl:

    Architecture diagram of the modular Perl Cloud, gRPC, and GenAI client stack
    Figure 1: Open-source Protocol Buffers, gRPC, and automated client-generation stack for Perl.

    With this stack in place, querying Cloud Spanner over native gRPC in Perl requires zero hand-rolled REST boilerplate:

    use strict;
    use warnings;
    use Google::Cloud::Spanner::V1;
    use Google::Auth;
    
    # 1. Initialize Application Default Credentials (ADC)
    my $auth = Google::Auth->default();
    
    # 2. Initialize Spanner Client over gRPC transport
    my $spanner = Google::Cloud::Spanner::V1->new(
        credentials => $auth,
    );
    
    # 3. Execute SQL Query
    my $result = $spanner->execute_sql(
        database => 'projects/my-proj/instances/my-inst/databases/my-db',
        sql      => 'SELECT 1 AS alive',
    );

    And calling Gemini via Google::Ai::Generativelanguage::V1 with automatic nested hashref-to-Protobuf coercion feels just as ergonomic as Python or Go:

    use strict;
    use warnings;
    use Google::Ai::Generativelanguage::V1;
    use Google::Auth;
    
    my $gemini = Google::Ai::Generativelanguage::V1->new(
        credentials => Google::Auth->default(),
    );
    
    my $response = $gemini->generate_content(
        model    => 'models/gemini-2.5-pro',
        contents => [
            {
                role  => 'user',
                parts => [ { text => 'Summarize this stack trace in three bullets.' } ],
            },
        ],
    );

    4. What This Means for Debian Developers and Systems Administrators

    Nowhere is this gap—and the opportunity to close it—more tangible than on Debian.

    While greenfield web startups may have moved on from Perl, Debian remains one of the largest, healthiest Modern Perl ecosystems on the planet. Core project tooling—dpkg-dev (Dpkg::*), debhelper, lintian, devscripts (uscan, dch, debuild), debconf, and po4a—is written in Perl, backed by more than 4,000 lib*-perl packages maintained by the Debian Perl Group (pkg-perl). And Debian 13 (trixie) ships Perl v5.40.1 right in base, giving every Debian machine native subroutine signatures, lexical try/catch, and builtin booleans out of the box.

    Yet until now, a Debian developer or systems administrator who wanted to interface with Google Cloud from an existing Perl tool had to either install the multi-hundred-megabyte Python-bundled google-cloud-cli (gcloud / bq) just to shell out and scrape stdout, or rewrite working Perl automation into another language.

    Having a native Perl gRPC, Protobuf, and Auth stack—and pairing it with native Debian packaging—changes day-to-day life on Debian in four concrete ways:

    1. Keyless IAM Auth on Debian Cloud VMs

    When running official Debian Cloud images on Compute Engine, GKE (with Workload Identity), or Cloud Run, Google::Auth->default() speaks directly to the local GCE metadata server (metadata.google.internal) to fetch and cache short-lived OAuth2 tokens for the attached IAM service account. Sysadmins no longer need to deploy long-lived service-account JSON keys into /etc/ or shell out to gcloud auth print-access-token inside cron jobs and systemd units.

    2. Moving Beyond local::lib (and venv) to Native pkg-perl Packages

    Right now, before these distributions land in the Debian archive, installing them cleanly from CPAN without polluting /usr requires local::lib (e.g., cpanm --local-lib=~/perl5)—which is the exact Perl counterpart to maintaining an isolated Python venv on Debian 12 (bookworm) and Debian 13 (trixie) under PEP 668 (EXTERNALLY-MANAGED). Even under local::lib, keeping cloud RPC calls in-process avoids pulling in the ~500 MB google-cloud-cli bundle or splitting an existing Perl daemon across two runtimes.

    The real goal on Debian, however, is eliminating per-user overlay trees altogether via native .deb packages maintained with the Debian Perl Group (pkg-perl)—so administrators can install libgoogle-auth-perl, libgoogle-grpc-perl, and service clients straight from apt with dpkg verification, sbuild reproducibility, and autopkgtest-pkg-perl coverage.

    3. Alignment with Debian’s Packaged Libraries & Policy

    Most of the runtime and build prerequisites already ship in Debian main (verified on trixie), making native packaging straightforward:

    • libssl-dev backs Google::Auth‘s XS crypto bindings, and libnghttp2-dev provides the shared system C library for Google::gRPC‘s C/XS HTTP/2 engine—while libprotocol-http2-perl (already in Debian main) powers the 100% pure-Perl HTTP/2 fallback.
    • libmoo-perl, libtype-tiny-perl, libfuture-perl, liblog-any-perl, libperl-critic-perl, and perltidy are all available via apt today.
    • Draft placeholder before publishing: Add links to the WNPP ITP bugs and Salsa / pkg-perl packaging repositories (including coordinating upb packaging details under Debian Policy §4.13 for Protobuf).

    4. Practical Workflows for DDs and Sysadmins

    On a Debian 13 (trixie) host running Perl v5.40, streaming structured fleet telemetry to BigQuery or triaging failed sbuild / autopkgtest logs with Gemini fits naturally into idiomatic modern Perl—using native v5.40 signatures and try/catch without a single shell-out:

    #!/usr/bin/perl
    use v5.40;
    use Google::Auth;
    use Google::Cloud::Bigquery::V2;
    use Sys::Hostname qw(hostname);
    
    sub record_package_audit ($pkg, $version, $status) {
        my $bq = Google::Cloud::Bigquery::V2->new(
            credentials => Google::Auth->default(), # GCE metadata server / ADC
        );
    
        try {
            $bq->insert_all(
                project_id => 'my-debian-fleet',
                dataset_id => 'ops_telemetry',
                table_id   => 'dpkg_audits',
                rows       => [
                    {
                        json => {
                            host    => hostname(),
                            package => $pkg,
                            version => $version,
                            status  => $status,
                        },
                    },
                ],
            );
        }
        catch ($err) {
            warn "BigQuery telemetry insert failed: $errn";
        }
    }

    Whether it is archiving buildd and QA metrics into BigQuery, storing distributed coordination state in Cloud Spanner, or summarizing 10,000-line FTBFS (“Fails To Build From Source”) logs via Google::Ai::Generativelanguage::V1, Debian maintainers and sysadmins can keep their automation in a single, auditable, dpkg-managed language rather than splitting glue code across Perl, bash, jq, and Python virtualenvs.


    5. Why the GenAI Era Plays to Perl’s Strengths—and the Headwinds Ahead

    In classical machine learning, Python’s lead was anchored by in-process C/C++ tensor libraries (NumPy, PyTorch). In the LLM and AI Agent era, however, the heavy matrix math happens remotely behind an RPC endpoint. What happens on the client side?

    • Ingesting gigabytes of messy, compressed distributed-system event logs and diagnostic traces.
    • Running high-speed regular expressions and text distillation pipelines.
    • Validating structured outputs and coercing hashrefs into strict request schemas via Type::Tiny.
    • Orchestrating Unix CLI tools, SQL queries, and concurrent gRPC calls.

    That is Perl’s historic wheelhouse. Just as importantly, thousands of enterprises and veteran SREs still maintain battle-tested brownfield Perl systems; drop-in CPAN clients for Spanner, BigQuery, and Gemini let teams modernize those systems in place rather than forcing a costly rewrite into Python or Go simply to call a gRPC API.

    Two realistic headwinds remain:

    1. The AI code-generation feedback loop: Modern LLM coding assistants are trained overwhelmingly on recent Python, TypeScript, Go, and Rust code, and can default to dated 2000s Perl idioms if left unguided. Embedding automated 00_critic.t, 00_tidy.t, and 00_pod.t author tests—backed by concrete .perlcriticrc and .perltidyrc rulesets—directly into generated Module::Starter::Protobuf skeletons turns out to be an ideal counterweight, acting as an automated guardrail that keeps AI-assisted Perl clean and idiomatic.
    2. The education and hiring pipeline: Universities and bootcamps standardized on Python and JavaScript over the past 15 years, so greenfield staffing decisions will continue to favor larger hiring pools.

    Will ergonomic gRPC and GenAI SDKs make universities teach Perl 101 again? Unlikely. Will they make Perl a high-leverage powerhouse again for engineers and organizations who value its text-processing and Unix orchestration strengths? Without question—because in an API-driven world, a language is only as alive as the services it can talk to natively.