perl-Error-ROP-0.04-alt1.noarch.rpm


Advertisement

Description

perl-Error-ROP - Error-ROP - A simple and lightweight implementation error handling library for Perl,

Property Value
Distribution ALT Linux Sisyphus
Repository Autoimports noarch
Package name perl-Error-ROP
Package version 0.04
Package release alt1
Package architecture noarch
Package type rpm
Installed size 24.04 KB
Download size 24.04 KB
Official Mirror ftp.altlinux.org
The purpose of the `rop' function is to let you focus in the happy path
and provide a nice way to treat failures without filling the code
with `eval's and `if's that always serve almost the same purpose.
Supose you have a computation that can fail depending on some condition.
For the sake of simplicity consider the following code
sub compute_meaning {
my $divisor = shift;
return 2 + 80 / $divisor;
};
that will fail when called with a zero argument.
Following the style of the Railway Oriented Programming, you wrap the part
that could fail in a `rop' block and focus on programming the happy
path:
sub compute_meaning {
my $divisor = shift;
return rop { 80 / $divisor }
->then(sub { $_ + 2 });
};
This way, the `compute_meaning' function will never blow, even when
passed in a zero argument and the computation doesn't make sense. The caller
can check that the computation succeeded by asking the `rop' result
object.
When the computation succeeds, the `value' property contains
the computation result
my $meaning = compute_meaning(2);
say "The life meaning is " $meaning->value if $meaning->is_valid;
and when the computation fails, you can also inform the user or decide how to
proceed, by inspecting the `failure' value, which will contain the captured
error.
my $meaning = compute_meaning(0);
warn "Life has no meaning: " . $meaning->failure if not $meaning->is_valid;

Alternatives

Package Version Architecture Repository
perl-Error-ROP - - -

Requires

Name Value
/usr/share/perl5 -
perl(Moose.pm) -
rpmlib(PayloadIsLzma) -

Provides

Name Value
perl(Error/ROP.pm) = 0.040
perl(Error/ROP/Imp.pm) -
perl-Error-ROP = 0.04-alt1

Download

Type URL
Binary Package perl-Error-ROP-0.04-alt1.noarch.rpm
Source Package perl-Error-ROP-0.04-alt1.src.rpm

Install Howto

  1. Add the following line to /etc/apt/sources.list:
    
    rpm [Sisyphus] http://ftp.altlinux.org/pub/distributions/ALTLinux/autoimports/Sisyphus noarch autoimports
    rpm [Sisyphus] http://ftp.altlinux.org/pub/distributions/ALTLinux/autoimports/Sisyphus noarch autoimports
    
  2. Update the package index:
    # sudo apt-get update
  3. Install perl-Error-ROP rpm package:
    # sudo apt-get install perl-Error-ROP

Files

Path
/usr/share/doc/perl-Error-ROP-0.04/LICENSE
/usr/share/doc/perl-Error-ROP-0.04/README.md
/usr/share/perl5/Error/ROP.pm
/usr/share/perl5/Error/ROP/Imp.pm

See Also

Package Description
perl-Error-Return-1.110510-alt1.noarch.rpm Really return() from a try/catch-block
perl-Error-Subclasses-0.05-alt1.noarch.rpm A collection of utility exception subclasses
perl-Error-Tiny-0.03-alt1.noarch.rpm Tiny exceptions
perl-Error-TryCatch-0.07-alt1.noarch.rpm perl module Error-TryCatch
perl-Error-Unhandled-1.02-alt1.noarch.rpm perl module Error-Unhandled
perl-Error-Wait-0.05-alt1.noarch.rpm perl module Error-Wait
perl-Error-errors-0.13-alt1.noarch.rpm errors - Error Handling for Perl
perl-Etcd-0.004-alt1.noarch.rpm Client library for etcd
perl-Etcd3-0.003-alt1.noarch.rpm Provide access to the etcd v3 API
perl-Etherpad-1.2.13.0-alt1.noarch.rpm interact with Etherpad API
perl-Etherpad-API-1.2.12.1-alt1.noarch.rpm Access Etherpad Lite API easily
perl-Etsy-StatsD-1.002002-alt1.noarch.rpm Object-Oriented Client for Etsy's StatsD Server
perl-Eval-Logic-1-alt1.noarch.rpm Evaluate simple logical expressions from a string
perl-Eval-Reversible-0.90-alt1.noarch.rpm Evals with undo stacks
perl-Eval-Util-0.002-alt1.noarch.rpm Utilities related to eval()
Advertisement
Advertisement