NAME

Venus - OO Library

ABSTRACT

OO Standard Library for Perl 5

VERSION

0.02

SYNOPSIS

package main;

use Venus qw(
  catch
  error
  raise
);

# error handling
my ($error, $result) = catch {
  error;
};

# boolean keywords
if ($result and $result eq false) {
  true;
}

# raise exceptions
if (false) {
  raise 'MyApp::Error';
}

# and much more!
true ne false;

DESCRIPTION

This library provides an object-orientation framework and extendible standard library for Perl 5, built on top of Moo 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. This package will always automatically exports true and false keyword functions (unless existing routines of the same name already exist in the calling package), otherwise exports keyword functions as requested at import. This library requires Perl 5.18+.

FUNCTIONS

This package provides the following functions:

catch

catch(CodeRef $block) (Error, Any)

The catch function executes the code block trapping errors and returning the caught exception in scalar context, and also returning the result as a second argument in list context.

Since 0.01

error

error(Maybe[HashRef] $args) (Error)

The error function throws a Venus::Error exception object using the exception object arguments provided.

Since 0.01

false

false() (Bool)

The false function returns a falsy boolean value which is designed to be practically indistinguishable from the conventional numerical 0 value.

Since 0.01

raise

raise(Str $class | Tuple[Str, Str] $class, Maybe[HashRef] $args) (Error)

The raise function generates and throws a named exception object derived from Venus::Error, or provided base class, using the exception object arguments provided.

Since 0.01

true

true() (Bool)

The true function returns a truthy boolean value which is designed to be practically indistinguishable from the conventional numerical 1 value.

Since 0.01

FEATURES

This package provides the following features:

AUTHORS

Cpanery, cpanery@cpan.org

LICENSE

Copyright (C) 2021, Cpanery

Read the "license" file.

PROJECT

https://venus.cpanery.com

https://github.com/cpanery/venus/wiki

https://github.com/cpanery/venus/issues

https://cpanery.com