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

Re: [PATCH 1/5] In perlutil.pod 'Convertors', adjust "a2p" example.

Thread Previous | Thread Next
From:
H.Merijn Brand
Date:
April 9, 2010 03:55
Subject:
Re: [PATCH 1/5] In perlutil.pod 'Convertors', adjust "a2p" example.
Message ID:
20100409125449.6639028b@pc09.procura.nl
On Fri,  9 Apr 2010 12:05:52 +0300, jari.aalto@cante.net wrote:

> From: Jari Aalto <jari.aalto@cante.net>
> 
> Add space after each comma.

For this specific example not OK, as it is what Rafael already noticed
on the find2perl example. This one is generated by a2p.

$ cat test.awk
{print $2}
$ a2p -F: test.awk | tail -4
while (<>) {
    ($Fld1,$Fld2) = split(/[:\n]/, $_, -1);
    print $Fld2;
}
$

If you want to `fix' that, you'd have to patch x2p/walk.c
Don't know if that would be an easy task.

> Signed-off-by: Jari Aalto <jari.aalto@cante.net>
> ---
>  pod/perlutil.pod |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/pod/perlutil.pod b/pod/perlutil.pod
> index 2d9b4ad..b1c332d 100644
> --- a/pod/perlutil.pod
> +++ b/pod/perlutil.pod
> @@ -88,8 +88,8 @@ F<a2p> converts F<awk> scripts to Perl programs; for example, C<a2p -F:>
>  on the simple F<awk> script C<{print $2}> will produce a Perl program
>  based around this code:
>  
> -    while (<>) {
> -        ($Fld1,$Fld2) = split(/[:\n]/, $_, 9999);
> +    while ( <> ) {
> +        my ($Fld1, $Fld2) = split(/[:\n]/, $_, 9999);
>          print $Fld2;
>      }

-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, OpenSuSE 10.3, 11.0, and 11.1, AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/

Thread Previous | 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