develooper Front page | perl.perl5.porters | Postings from July 2009

Re: "Keyword" labels now forbidden (was [perl.git] branch blead, updated. GitLive-blead-1705-gf71d615)

Thread Previous | Thread Next
Jerry D. Hedden
July 30, 2009 07:36
Re: "Keyword" labels now forbidden (was [perl.git] branch blead, updated. GitLive-blead-1705-gf71d615)
Message ID:
> In perl.git, the branch blead has been updated
> <>
> - Log -----------------------------------------------------------------
> commit f71d6157c7933c0d3df645f0411d97d7e2b66b2f
> Author: Rafael Garcia-Suarez <>
> Date:   Tue Jul 28 09:47:24 2009 +0200
>    Forbid labels with keyword names

Jerry D. Hedden wrote:
>> Interesting.  This "broke" one of my CPAN modules.  Wonder how many
>> others it will affect?

Rafael Garcia-Suarez wrote:
> I guess that only demonstrates that one can never underestimate the
> importance of backwards compatibility. I would never have guessed I
> had such a report that fast.
> What was the code you used ?

The construct was something like this:

    # Check on what we've found
    foreach my $key (keys(%{$spec})) {
        my $spec_item = $$spec{$key};
        # No specs to check
        if (ref($spec_item) ne 'HASH') {
            # The specifier entry was just 'key => regex'.  If 'key' is not in
            # the args, the we need to remove the 'undef' entry in the found
            # args hash.
            if (! defined($found{$key})) {
            next CHECK;

        ... and more similar check ...

I didn't think of the label as a keyword.  I changed it to
CHECKIT to fix the problem.

I don't have a problem with the change itself.  I think it's
a good idea.  However, the error message you get doesn't
tell you what you did wrong!  Consider:


    use strict;
    use warnings;

    foreach (1..3) {
        if ($_ == 2) {
            next CHECK;

    # EOF

When run, this produces:

    syntax error at line 7, near ":
    foreach "
    Execution of aborted due to compilation errors.

It was only because I had just seen this change to blead
that I understood what the errors I was getting were related
to.  Otherwise, I would have been scratching my head, and
probably asking for help on perl5-porters.

How about an error message that tells what the problem
really is:

    Can't use keyword as a label.

Otherwise, it may become a problem when this change hits the

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