Venus
Venus is an object-orientation framework and extendible standard library for Perl 5 with classes which wrap most native Perl data types. Venus has a simple modular architecture, robust library of classes and methods, supports pure-Perl autoboxing, advanced exception handling, “true” and “false” keywords, package introspection, command-line options parsing, and more.
package Person;
use Venus::Class;
attr 'name';
attr 'email';
package main;
my $p = Person->new(name => 'Elliot Alderson');
# bless({name => 'Elliot Alderson'})
The Venus library for Perl is designed to simplify Perl programming by offering a range of helpful utilities and abstractions that improve how Perl applications are structured and maintained. Created with a strong focus on object-oriented programming and functional programming paradigms, Venus provides various classes, methods, and functions that help developers write cleaner, more concise, and reusable Perl code.
Here’s a quick rundown of its main features and purpose:
- Object-Oriented Design: Venus streamlines creating and managing objects in Perl. It introduces clear syntax and methods that make Perl’s object-oriented features more approachable.
- Functional Utilities: It includes several functional programming utilities for working with common data structures (like arrays, hashes, strings, etc.), which is not inherently easy in Perl’s standard library.
- Syntactic Sugar and Abstractions: Venus provides syntactic enhancements to make common Perl operations feel more intuitive and less verbose, allowing developers to write code that’s more readable and easier to maintain.
- Standalone and Lightweight: Venus is fairly lightweight and designed as a modular library, so you can pick and choose components based on your needs without overloading your application with dependencies.
- Inspired by Modern Programming: While staying within Perl’s ecosystem, Venus draws inspiration from other modern programming languages and libraries, particularly Ruby, Python, and Go, in terms of structure and design, making Perl feel more “modern.”
Venus has a focus on versatility and enhancing Perl’s expressive power, which is especially appealing to Perl developers looking for ways to improve productivity and code maintainability without switching languages.
Core Philosophy
The core philosophy and goal of Venus revolve around modernizing Perl 5 by providing an opinionated, object-oriented standard library that aligns with modern software engineering practices.
Core Philosophy: “Be a compliment, not a cudgel” The guiding ethic of Venus is to serve as a helpful compliment rather than a restrictive tool. This philosophy manifests in several key principles:
- Strictly Opt-In: Every feature in Venus, including autoboxing and object automation, is completely optional. Developers can adopt the parts they need and integrate them with other Perl code without being forced to write their entire application in a rigid framework.
- No “Magic”: Venus avoids source filtering and experimental features. Instead, it relies solely on vanilla Perl and core modules to create a stable layer of abstraction and automation. It operates with zero non-core dependencies.
- Developer Ergonomics: The framework explicitly prioritizes developer ergonomics, consistency, and intuitive behaviors over absolute execution speed or code conciseness. It champions a “convention over configuration” architecture to make the programming experience smoother.
Primary Goal: Providing a Modern Software Baseline Venus aims to equip Perl with a “baseline feature set for modern software development” that mirrors the industry standards and “batteries-included” capabilities found in languages like Ruby, Python, and Go. Its practical goals include:
- Eliminating Decision Fatigue: By offering a robust set of built-in classes for handling common computing tasks — such as manipulating data structures, file I/O, concurrency, and serialization — Venus saves developers from constantly having to search CPAN or build bespoke solutions from scratch.
- Modernizing Perl Tooling: Venus introduces modern primitives to the language, including a comprehensive type system, flexible exception handling (try/catch/throw), simple package reflection, and CLI tooling.
- Respecting Core Perl: Even as it modernizes the development experience, Venus is designed to preserve Perl’s multi-paradigm roots and core sensibilities. Almost all Venus library methods return native Perl data types, ensuring it plays nicely with traditional Perl routines.