develooper Front page | perl.perl5.porters | Postings from February 2000

Re: proposed perlpod.pod patch

Thread Previous | Thread Next
Brad Appleton
February 5, 2000 16:04
Re: proposed perlpod.pod patch
Message ID:
On Sat, Feb 05, 2000 at 04:38:38PM -0600, Brad Appleton wrote:
> What if we also allowed C<<< ... >>>? We could make the rule that
> you could use as many '<' as you want, and if you use more than 1,
> you have to have the whitespace at the beginning and end.
> So theoretically, in addition to the usual /[A-Z]</ we could 
> also look for /[A-Z]<{2,}\s+/ and they always have to use the
> same number of closing angle brackets as opening angle brackets.

Good news - It was pretty easy to get this working in my prototype.
The performance is only a slight hit for each use of /[A-Z]<{2,}\s+/
because I use a variable instead of a constant-string in the regexp.
But thats only when the multi-angle-brackets are used (which shouldn't
be too often IMHO)

I also managed to get this working while allowing newlines as
the separator without too much extra overhead. (At least I think
so, how bad is it to do: ++$line for (/\n/g); that seems to be
faster than: $line += split "\n"; anybody have something faster?)

So based on this, I could now change the proposed patch to the
following (after my signature) ...

Let me know if this is okay, or if we should just allow only
double & triple angle-brackets.
Brad Appleton <>
  "And miles to go before I sleep." -- Robert Frost

*** perlpod.pod.orig	Thu Feb  3 16:10:32 2000
--- perlpod.pod	Sat Feb  5 17:58:57 2000
*** 188,193 ****
--- 188,228 ----
      	    	    E<html>		Some non-numeric HTML entity, such
  					as E<Agrave>
+ Most of the time, you will only need a single set of angle brackets to
+ delimit the beginning and end of interior sequences. However, sometimes
+ you will want to put a right angle bracket (or greater-than sign '>')
+ inside of a sequence. This is particularly common when using a sequence
+ to provide a different font-type for a snippet of code. As with all
+ things in Perl, there is more than one way to do it. One way is to
+ simply escape the closing bracket using an C<E> sequence:
+     C<$a E<lt>=E<gt> $b>
+ This will produce: "C<$a E<lt>=E<gt> $b>"
+ A more readable, and perhaps more "plain" way is to use an alternate set of
+ delimiters that doesn't require a ">" to be escaped. As of perl5.5.641,
+ doubled angle brackets ("<<" and ">>") may be used I<if and only if there
+ is whitespace immediately following the opening delimiter and immediately
+ preceding the closing delimiter!> For example, the following will do the
+ trick:
+     C<< $a <=> $b >>
+ In fact, you can use as many repeated angle-brackets as you like so
+ long as you have the same number of them in the opening and closing
+ delimiters, and make sure that whitespace immediately follows the last
+ '<' of the opening delimiter, and immediately precedes the first '>' of
+ the closing delimiter.  So the following will also work:
+     C<<< $a <=> $b >>>
+     C<<<< $a <=> $b >>>>
+ This is currently supported by pod2text (Pod::Text), pod2man (Pod::Man),
+ and any other pod2xxx and Pod::Xxxx translator that uses Pod::Parser
+ 1.093 or later.
  =head2 The Intent
  That's it.  The intent is simplicity, not power.  I wanted paragraphs

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About