Karen Etheridge > Cond-Expr-0.03 > Cond::Expr

Download:
Cond-Expr-0.03.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.03   Source  

NAME ^

Cond::Expr - conditionals as expressions

VERSION ^

version 0.03

SYNOPSIS ^

    my %args = (
        foo => 'bar',
        (cond
            ($answer == 42) { answer => $answer }
            ($answer)       { wrong_answer => 1 }
            otherwise       { no_answer    => 1 }
        ),
    );

DESCRIPTION ^

This module implements a Lisp-alike cond control structure.

How is this different from…

FUNCTIONS ^

cond

Takes a set of test/expression pairs. It evaluates each test one at a time. If a test returns logical true, cond evaluates and returns the value of the corresponding expression and doesn't evaluate any of the other tests or expressions. When none of the provided tests yield a true value, () or undef is returned in list and scalar context, respectively.

PERL REQUIREMENTS ^

Due to the particular XS interfaces being used, this module requires a minimum Perl version of 5.014.

AUTHOR ^

Florian Ragwitz <rafl@debian.org>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2012 by Florian Ragwitz.

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

syntax highlighting: