List Info

Thread: BEGIN, CHECK, INIT, END should take EXPR in addition to BLOCK




BEGIN, CHECK, INIT, END should take EXPR in addition to BLOCK
user name
2007-05-29 14:27:24
# New Ticket Created by  David Nicol 
# Please include the string:  [perl #43068]
# in the subject line of all future correspondence about
this issue. 
# <URL: h
ttp://rt.perl.org/rt3/Ticket/Display.html?id=43068 >




------------------------------------------------------------
-----
[Please enter your report here]

Occasionally the fact that there is an implied block
around a C<use> statement creates an unwanted side
effect
which is that lexical variable declarations on the use
line go away:

    use SpecialVariable my $honk => 'ooga';

must be written as 

    my $honk; use SpecialVariable $honk => 'ooga';

This is not a big deal.  However, in discussions of
whether to document this or not, it became apparent that
the situation is considered a bug to fix rather than a
behavior to document more clearly than the implication
that of course this would happen in perlfunc/use's
statement
of exact equivalence:

       use Module LIST [...] is exactly equivalent to

             BEGIN { require Module; import Module LIST; }

       except that Module must be a bareword.

Anyway, my proposal is that the situation could be remedied
by loosening the syntax of BEGIN etc. to allow rounds
instead of curlies, which would not create a new lexical
pad,
after which C<use> would be modified to have an
accurate
documented equivalence of

             BEGIN ( require Module; import Module LIST )


[Please do not change anything below this line]
------------------------------------------------------------
-----
---
Flags:
    category=core
    severity=wishlist
---
This perlbug was built using Perl v5.8.8 in the Red Hat
build system.


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )