develooper Front page | perl.perl5.porters | Postings from October 2011

Re: [perl #102064] [PATCH] Fix use inaccuracy in perlmod.pm

Thread Previous | Thread Next
From:
Eric Brine
Date:
October 25, 2011 21:22
Subject:
Re: [perl #102064] [PATCH] Fix use inaccuracy in perlmod.pm
Message ID:
CALJW-qH3sWewAKyOfJ5Bx3xXxgCXR898hY5iSK1jzsG0FVfOtA@mail.gmail.com
On Mon, Oct 24, 2011 at 1:56 PM, chromatic <perlbug-followup@perl.org>wrote:

> # New Ticket Created by  chromatic
> # Please include the string:  [perl #102064]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=102064 >
>
>
> This is a bug report for perl from chromatic@wgz.org,
> generated with the help of perlbug 1.39 running under perl 5.14.1.
>
>
> -----------------------------------------------------------------
> [Please describe your issue here]
>
> perlmod describes the BEGIN form desugaring of use MODULE, but it
> does so incorrectly. It's trivial to write code which breaks the
> documented desugaring, while what Perl actually does works fine.
>
>
This patch corrects this documentation error.
>

What does that fix exactly? It seems to make things worse. What was a syntax
error is now valid but incorrect code.

>perl -e"sub Module { die }  use Module;"

Original documented equivalent:
>perl -e"sub Module { die }  BEGIN { require Module; import Module; }"
Bareword found where operator expected at -e line 1, near "import Module"
        (Do you need to predeclare import?)
syntax error at -e line 1, near "import Module"
BEGIN not safe after errors--compilation aborted at -e line 1.

New documented equivalent:
>perl -e"sub Module { die }  BEGIN { require Module; Module->import; }"
Died at -e line 1.
BEGIN failed--compilation aborted at -e line 1.


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