The following module was proposed for inclusion in the Module List: modid: Regexp::Log DSLIP: bdpOp description: A base class for log files regexp builders userid: BOOK (Philippe "BooK" Bruhat) chapterid: 11 (String_Lang_Text_Proc) communities: mailing list, CVS, web site (http://regexp-log.mongueurs.net/)
similar: rationale: Regexp::Log is a base class for a variety of modules that generate regular expressions for performing the usual data munging tasks on log files that cannot be simply split(). The goal of this module family is to compute regular expressions based on the configuration string of the log. Here is an example of code using Regexp::Log: my $foo = Regexp::Log::Foo->new( format => 'custom %g %e %a %w/%s %b %m %i %u %H/%d %c', capture => [qw( host code username )], ); # this is necessary to know in which order # we will receive the captured fields from the regexp my @fields = $foo->capture; # the all-powerful capturing regexp :-) my $re = $foo->regexp; while (<>) { my %data; @data{@fields} = /$re/; # no need for /o, it's a compiled regexp # now do something with the content of %data ... } For the moment, there is only one subclass: Regexp::Log::BlueCoat, that compute regexp for the BlueCoat system (www.blueCoat.com). Regexp::Log::Apache should be next. Regexp::Log::* modules use the configuration format string as a template, and do a search and replace operation to remove each field placeholder by the appropriate regular expression. The interesting method is the capture() method that lets you capture any field (or sub-field) you want, by name. As for the namespace, Regexp:: seems the more appropriate, since the point of the module is to create compiled regular expressions. enteredby: BOOK (Philippe "BooK" Bruhat) enteredon: Mon Jan 13 15:11:34 2003 GMT The resulting entry would be: Regexp:: ::Log bdpOp A base class for log files regexp builders BOOK Thanks for registering, The Pause Team PS: The following links are only valid for module list maintainers: Registration form with editing capabilities: https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=69100000_da3cdd7c0bb3700e&SUBMIT_pause99_add_mod_preview=1 Immediate (one click) registration: https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=69100000_da3cdd7c0bb3700e&SUBMIT_pause99_add_mod_insertit=1