develooper Front page | perl.perl5.porters | Postings from June 2008

Re: Empty regex

Thread Previous | Thread Next
From:
Paul Fenwick
Date:
June 18, 2008 22:58
Subject:
Re: Empty regex
Message ID:
4859F56D.3070401@perltraining.com.au
G'day Alfie / p5p,

alfie@share-house.com.au wrote:

> Is there anyway to make /$string/ warn if $string is empty? Maybe even in
> future releases of perl?

I'm in Sydney, teaching a course, and away from my decent research 
materials.  I know that it's possible to overload qr{}, which presumably can 
let us do whatever we want with qr'd regexps.  Does this overload also allow 
us to inspect *any* regexp in the code?  I know overloading integers allows 
us to do whatever we want with all the integers in the code.

If so, it should be easy enough make Regexp::Safer which simply forbids (or 
whines verbosely) about empty regexps.

Cheerio,

	Paul

-- 
Paul Fenwick <pjf@perltraining.com.au> | http://perltraining.com.au/
Director of Training                   | Ph:  +61 3 9354 6001
Perl Training Australia                | Fax: +61 3 9354 2681

Thread Previous | 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