Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    assertions 0.03

    Download button

    No screenshots available
    Downloads: 194  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Salvador Fandiño García | More programs
    Perl Artistic License / FREE
    April 18th, 2010, 09:07 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    assertions description

    Select assertions in blocks of code

    assertions is a Perl module that specifies the tags used to enable and disable the execution of assertion subroutines.

    An assertion subroutine is declared with the :assertion attribute. This subroutine is not normally executed: it's optimized away by perl at compile-time.

    The assertions pragma associates to its lexical scope one or several assertion tags. Then, to activate the execution of the assertions subroutines in this scope, these tags must be given to perl via the -A command-line option. For instance, if...

     use assertions 'foobar';

    is used, assertions on the same lexical scope will only be executed when perl is called as...

     perl -A=foobar script.pl

    Regular expressions can also be used within the -A switch. For instance...

     perl -A='foo.*' script.pl

    will activate assertions tagged as foo, foobar, foofoo, etc.

    SYNOPSIS

     sub assert (&) : assertion { &{$_[0]}() }

     use assertions 'foo';
     assert { print "asserting 'foo'\n" };

     {
     use assertions qw( foo bar );
     assert { print "asserting 'foo' and 'bar'\n" };
     }

     {
     use assertions qw( bar );
     assert { print "asserting only 'bar'\n" };
     }

     {
     use assertions '_ && bar';
     assert { print "asserting 'foo' && 'bar'\n" };
     }

     assert { print "asserting 'foo' again\n" };



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    assertions selector | Perl module | code | assertions | selector

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM