Coder Social home page Coder Social logo

moox-failover's Introduction

NAME

MooX::Failover - Instantiate Moo classes with failover

VERSION

v0.3.4

SYNOPSIS

# In your class:

package MyClass;

use Moo;
use MooX::Failover;

has 'attr' => ( ... );

# after attributes are defined:

failover_to 'OtherClass';

...

# When using the class

my $obj = MyClass->new( %args );

# If %args contains missing or invalid values or new otherwise
# fails, then $obj will be of type "OtherClass".

INSTALLATION

See How to install CPAN modules.

Required Modules

This distribution requires Perl v5.10.1.

This distribution requires the following modules:

This distribution recommends the following modules:

RECENT CHANGES

Documentation

  • Fixed typos in Changes file (v0.3.3 was broken up into two sections).

See the Changes file for a longer revision history.

DESCRIPTION

This module provides constructor failover for Moo classes.

For example, if a class cannot be instantiated because of invalid arguments (perhaps from an untrusted source), then instead it returns the failover class (passing the same arguments to that class).

It is roughly equivalent to using

my $obj = eval { MyClass->new(%args) //
   OtherClass->new( %args, error => $@ );

This allows for cleaner design, by not forcing you to duplicate type checking for constructor parameters.

See the module documentation for MooX::Failover for more information.

SEE ALSO

This was originally a Moo port of MooseX::Failover. The interface was redesigned significantly, to be more efficient.

AUTHOR

Robert Rothenberg <[email protected]>

Acknowledgements

Thermeon.
Piers Cawley.
Gareth Kirwan.

COPYRIGHT

Copyright 2014-2015 Thermeon Worldwide, PLC.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.

moox-failover's People

Contributors

robrwo avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

manwar

moox-failover's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.