develooper Front page | perl.perl5.porters | Postings from April 2003

[PATCH pod/perlpod.pod] was RE: How cross-platform is `foo 2>&1` these days?

Thread Next
From:
Robin Barker
Date:
April 8, 2003 06:25
Subject:
[PATCH pod/perlpod.pod] was RE: How cross-platform is `foo 2>&1` these days?
Message ID:
533D273D4014D411AB1D00062938C4D904046395@hotel.npl.co.uk
Perhaps not, C<< 2>&1 >> is perfectly acceptable.  
See pod/perlpod.pod, which contains a typo.

Extract from pod/perlpod.pod below.  Patch attached.

Robin

A more readable, and perhaps more "plain" way is to use an alternate
set of delimiters that doesn't require a single ">" to be escaped.  With
the Pod formatters that are standard starting with perl5.5.660, doubled
angle brackets ("<<" and ">>") may be used I<if and only if there is
whitespace right after the opening delimiter and whitespace right
before 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.  (The whitespace is ignored.)  So the
following will also work:

    C<<< $a <=> $b >>>
    C<<<<  $a <=> $b     >>>>

And they all mean exactly the same as this:

    C<$a E<lt>=E<gt> $b>

As a further example, this means that if you wanted to put these bits of
code in C<C> (code) style:

    open(X, ">>thing.dat") || die $!
    $foo->bar();

you could do it like so:

    C<<< open(X, ">>thing.dat") || die $! >>>
    C<< $foo->bar(); >>

which is presumably easier to read than the old way:

    C<open(X, "E<gt>E<gt>thing.dat") || die $!>
    C<$foo-E<gt>bar(); >>

-----Original Message-----
From: PPrymmer@factset.com [mailto:PPrymmer@factset.com]
Sent: 08 April 2003 14:10
To: Craig A. Berry
Cc: perl5-porters@perl.org; rgarciasuarez@free.fr; schwern@pobox.com;
vmsperl@perl.org
Subject: Re: How cross-platform is `foo 2>&1` these days?

!>+
!>+C<< 2>&1 >> redirects stderr to stdout.
!>

Perhaps(?) that should read:

C<2E<gt>&1> redirects stderr to stdout.

podchecker -warnings -warnings could be the arbiter.

Peter Prymmer




-------------------------------------------------------------------
This e-mail and any attachments may contain confidential and/or
privileged material; it is for the intended addressee(s) only.
If you are not a named addressee, you must not use, retain or
disclose such information.

NPL Management Ltd cannot guarantee that the e-mail or any
attachments are free from viruses.

NPL Management Ltd. Registered in England and Wales. No: 2937881
Registered Office: Teddington, Middlesex, United Kingdom TW11 0LW.
-------------------------------------------------------------------
Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About