[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 package DBI::ProfileSubs; 2 3 our $VERSION = sprintf("0.%06d", q$Revision: 9395 $ =~ /(\d+)/o); 4 5 =head1 NAME 6 7 DBI::ProfileSubs - Subroutines for dynamic profile Path 8 9 =head1 SYNOPSIS 10 11 DBI_PROFILE='&norm_std_n3' prog.pl 12 13 This is new and still experimental. 14 15 =head1 TO DO 16 17 Define come kind of naming convention for the subs. 18 19 =cut 20 21 use strict; 22 use warnings; 23 24 25 # would be good to refactor these regex into separate subs and find some 26 # way to compose them in various combinations into multiple subs. 27 # Perhaps via AUTOLOAD where \&auto_X_Y_Z creates a sub that does X, Y, and Z. 28 # The final subs always need to be very fast. 29 # 30 31 sub norm_std_n3 { 32 # my ($h, $method_name) = @_; 33 local $_ = $_; 34 35 s/\b\d+\b/<N>/g; # 42 -> <N> 36 s/\b0x[0-9A-Fa-f]+\b/<N>/g; # 0xFE -> <N> 37 38 s/'.*?'/'<S>'/g; # single quoted strings (doesn't handle escapes) 39 s/".*?"/"<S>"/g; # double quoted strings (doesn't handle escapes) 40 41 # convert names like log20001231 into log<N> 42 s/([a-z_]+)(\d{3,})\b/$1}<N>/ig; 43 44 # abbreviate massive "in (...)" statements and similar 45 s!((\s*<[NS]>\s*,\s*){100,})!sprintf("$2,<repeated %d times>",length($1)/2)!eg; 46 47 return $_; 48 } 49 50 1;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Mar 17 22:47:18 2015 | Cross-referenced by PHPXref 0.7.1 |