develooper Front page | perl.perl5.porters | Postings from May 2007

[PATCH] minor assertions improvements

Thread Next
From:
Ricardo SIGNES
Date:
May 30, 2007 18:48
Subject:
[PATCH] minor assertions improvements
Message ID:
20070531014715.GA26562@knight.manxome.org

Okay, here's my first swing at improving the default core implementation of
assertions.

1.  assertions.pm says "if the entry in @{^ASSERTING} is ref-eq-Regexp, match
    it; otherwise, call the 'check' method on it"

    The patch uses re::is_regexp instead of ref eq, and calls the non-regex
    values as subrefs.  This is a smidge closer to using ~~, which is probably
    what a non-back-compat matcher would do.

2.  makes assertions::activate pass non-regex refs through unaltered, rather
    than stringifying and qr//-wrapping them; this meant that the "as object"
    assertions could never be activated with the core activator

3.  tests the above

I think there's a long way to go to make these great, but I think that making
things more ~~-compatible will help with future improved assertions
implementations.

-- 
rjbs

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About