A hands-on introduction to Venus through annotated examples.
Venus is a comprehensive object-oriented programming (OOP) library for Perl 5 that provides:
- Modern OOP - Class building, role composition, and mixin support
- Type System - Type checking, coercion, and assertions
- Value Objects - OOP wrappers for Perl primitives (strings, arrays, hashes, etc.)
- Zero Dependencies - Built entirely with Perl core modules
- Perl 5.18+ - Backward compatible with older Perl versions
Venus brings modern programming patterns to Perl while respecting its roots and requiring no external dependencies.
Each topic includes runnable code examples with expected outputs. The examples
are extracted from test files in the tests/ directory and rendered as POD
documentation in the topics/ directory.
bye/
├── tests/
│ └── *.t # Topic test files (one per topic)
├── topics/
│ └── *.pod # Generated POD documentation
└── README.md
- hello-world - Your first Venus program
- strings - String manipulation
- numbers - Numeric operations
- arrays - Array handling
- hashes - Hash operations
- booleans - Boolean values
- true-false - Boolean singletons
- references - Reference handling
- values - Value objects
- classes - Defining classes
- attributes - Class attributes
- methods - Method definitions
- inheritance - Class inheritance
- roles - Role composition
- mixins - Mixin composition
- method-modifiers - Before/after/around modifiers
- type-checking - Runtime type checks
- type-casting - Type conversion
- type-coercion - Automatic coercion
- type-assertions - Type assertions
- assert - Assertion utilities
- schema - Schema validation
- data-validation - Data validation
- collection-iteration - Iterating collections
- slicing - Array/hash slicing
- searching - Finding elements
- sorting - Sorting collections
- joining - Joining elements
- merging - Merging structures
- reducing-folding - Reduce operations
- unique-random - Unique and random selection
- regular-expressions - Regex operations
- replace - String replacement
- search - Pattern searching
- templates - Template rendering
- paths - Path manipulation
- reading-files - Reading files
- writing-files - Writing files
- directories - Directory operations
- temp-files - Temporary files
- permissions - File permissions
- date-time - Date/time basics
- date-formatting - Formatting dates
- args - Command-line arguments
- opts - Option parsing
- vars - Environment variables
- cli - CLI applications
- errors - Error basics
- error-throwing - Throwing errors
- custom-errors - Custom error classes
- try-catch - Exception handling
- try - Try utilities
- result-monad - Result pattern
- logging - Logging utilities
- random - Random generation
- process - Process management
- match - Pattern matching
- meta - Package introspection
- space - Namespace utilities
- unpack - Argument unpacking
- boxing - Value boxing
- dispatching - Method dispatching
- constructor-functions - Constructor helpers
- argument-unpacking - Unpacking arguments
- method-chaining - Fluent interfaces
- value-assignment - Value assignment
- value-deconstruction - Destructuring values
- venus - Bootstrapping Venus
Requires Venus 5.00
Each topic has a corresponding test file.
To run an individual test (using Venus):
vns test tests/hello-world.tTo run an individual test (using Perl prove):
PERL5LIB=/path/to/venus/lib prove -v tests/hello-world.tTo run all tests (using Venus):
vns testsTo run all tests (using Perl prove):
PERL5LIB=/path/to/venus/lib prove -v tests/Apache License 2.0