Changeset 9

Show
Ignore:
Timestamp:
05/17/00 10:37:58
Author:
schwern
Message:

Version 0.02. Removed lots of unnecessary qr//s to allow it to work under 5.005

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Email-Find/trunk/Makefile.PL

    r6 r9  
    66# Alternatively, you can say the hell with this and use h2xs. 
    77 
    8 # Apparently due to the heavy use of qr's embedded in qr's, this module 
    9 # is so slow under 5.005_03 as to be unusable.  5.005_63 is orders of 
    10 # magnitude faster. 
    11 require 5.005_63;       # Ilya++ 
    12  
    138use ExtUtils::MakeMaker; 
    149# See lib/ExtUtils/MakeMaker.pm for details of how to influence 
    1510# the contents of the Makefile that is written. 
     11 
     12# Need qr//. 
     13require 5.005; 
    1614 
    1715$PACKAGE = 'Email::Find'; 
  • Email-Find/trunk/lib/Email/Find.pm

    r5 r9  
    11package Email::Find; 
    2  
    3 # Sorry, embedded qr//'s appear to be really, really, really slow 
    4 # under 5.005 stable. 
    5 require 5.005_63; 
    62 
    73use strict; 
    84use vars qw($VERSION @EXPORT); 
    9 $VERSION = 0.01; 
     5$VERSION = '0.02'; 
     6 
     7# Need qr//. 
     8require 5.005; 
    109 
    1110use base qw(Exporter); 
     
    2625$Char     = '\000-\177'; 
    2726$Ctl      = '\000-\037\177'; 
    28 $Atom_re  = qr/[^$Ctl$Space$Specials]+/; 
     27$Atom_re  = qq/[^$Ctl$Space$Specials]+/; 
    2928$Specials_cheat = $Specials; 
    3029$Specials_cheat =~ s/\\\.//; 
    31 $Atom_cheat_re = qr/[^$Ctl$Space$Specials_cheat]+/; 
     30$Atom_cheat_re = qq/[^$Ctl$Space$Specials_cheat]+/; 
    3231 
    3332# Build quoted string regex 
    3433use vars qw($Qtext_re $Qpair_re $Quoted_string_re); 
    3534$Qtext_re = '[^"\\\r]+';      # " # 
    36 $Qpair_re = qr/\\[$Char]/; 
    37 $Quoted_string_re = qr/"(?:$Qtext_re|$Qpair_re)*"/; 
     35$Qpair_re = qq/\\\\[$Char]/; 
     36$Quoted_string_re = qq/"(?:$Qtext_re|$Qpair_re)*"/; 
    3837 
    3938# Build domain regex. 
     
    4342           ); 
    4443$Domain_ref_re = $Atom_re; 
    45 $Dtext_re = qr/[^\[\]\\\r]/; 
    46 $Domain_literal_re = qr/\[(?:$Dtext_re|$Qpair_re)*\]/; 
     44$Dtext_re = q/[^\[\]\\\\\r]/; 
     45$Domain_literal_re = q/\[(?:$Dtext_re|$Qpair_re)*\]/; 
    4746$Sub_domain_re = "(?:$Domain_ref_re|$Domain_literal_re)"; 
    4847$Domain_ref_cheat_re = $Atom_cheat_re; 
    4948 
    5049$Sub_domain_literal_cheat_re = "(?:$Dtext_re|$Qpair_re)*"; 
    51 $Domain_literal_cheat_re = qr/\[$Sub_domain_literal_cheat_re\]/; 
     50$Domain_literal_cheat_re = qq/\\[$Sub_domain_literal_cheat_re\\]/; 
    5251 
    5352# Build local part regex. 
    5453use vars qw($Word_re $Local_part_re $Local_part_cheat_re); 
    5554$Word_re = "(?:$Atom_re|$Quoted_string_re)+"; 
    56 $Local_part_re = qr/$Word_re(?:\.$Word_re)*/; 
    57 $Local_part_cheat_re = qr/(?:$Atom_cheat_re|$Quoted_string_re)+/; 
     55$Local_part_re = qq/$Word_re(?:\\.$Word_re)*/; 
     56$Local_part_cheat_re = qq/(?:$Atom_cheat_re|$Quoted_string_re)+/; 
    5857 
    5958# Finally, the address-spec regex (more or less)