Can you point me to a case where it does not work? I tested it on a a source file which failed due to a prereq, and it appeared to work for me.Index: nag.pl =================================================================== RCS file: /home/cvs/jakarta-alexandria/proposal/gump/nag.pl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- nag.pl 11 Feb 2002 16:27:45 -0000 1.7 +++ nag.pl 21 Oct 2002 07:54:42 -0000 1.8 @@ -41,6 +41,7 @@# extract just the stuff from inside the XMP tag if (m! .* <XMP> \s* (.*) \s* </XMP> !xs) { + $1 || m!(<p>.*</p>)!s; # if nothing found, look for prereqs $pageData = $1; } else { $pageData = "";It seems like the above does not quite work as expected. I have no perl knowledge but I would hazard to guess that if the first pattern does not match anything it will will go to the else section. So maybe the else should look like $pageData = m!(<p>.*</p>)!s; Of course I have no idea what m! or !s means so could be completely wrong ;)
Quick overview of what this is (supposed) to be doing:
Normally, one does matches in perl with a /regular-expression/ syntax. When the regular expressions contain slashes, they either must be escaped, or a different delimiter must be chosen. I chose the latter route, and used esclamation points. 's' is an option which indicates that the string is to be treated as a single line (in other words, matches can span lines).
Doing a match returns a true or a false. If the match string contains parenthesis, then a useful side effect occurs in that $1, $2, etc are set to the matched substring.
The else clause is for the case where there is no XMP tags. The then clause is taken when there is such a tag (even if it is empty).
|| is an operator which means "or". If the first operand is true, the second operand is not evaluated.
- Sam Ruby
--
To unsubscribe, e-mail: <mailto:alexandria-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:alexandria-dev-help@;jakarta.apache.org>
