tphyahoo has asked for the wisdom of the Perl Monks concerning the following question:

Monks, I was just trying to install CPANPLUS on my hosted shell account, and it errored out because on my particular Linux build, use constant a => sub {}; has problems.

I've never seen this idiom before, and not that much experience on unix. Should I be worried? Is this an important feature of perl, and/or an issue that will likely cause further annoynance, beyond just not being able to install cpanplus? Or is it no big deal?

Thanks for shedding light!

(See Can/should I run an upgraded version of perl locally, on a shared web server where I don't have root? for original question and Re^2: Can/should I run an upgraded version of perl locally, on a shared web server where I don't have root? for where I noted that the problem was perl 5.8 on my particular linux version, not that perl 5.8 was too early a version as I originally mistakenly thought. The second link also quotes from the part of the makefile that was causing problems when I tried to install.)

Replies are listed 'Best First'.
Re: How important is 'use constant a => sub {};'
by Perl Mouse (Chaplain) on Oct 06, 2005 at 10:47 UTC
    The fact that
    use constant a => sub {};
    has problems is a big deal. Because it's correct syntax, and if something with correct syntax has "problems" (whatever they are), something is rotten.

    But without telling us what the "problems" are, we can offer no guidance in solving it.

    It's not a Unix thing though.

    Perl --((8:>*
      Well, the CPANPLUS makefile says it is a unix thing, kind of -- something particular to the default perl installed with this redhat distro. From the second node I linked:
      ### there's issues with redhat 9.0's stock perl -- they applied some ### custom patches on their 5.8.0 and it breaks use constant a => sub +{}; if( $^O eq 'linux' and -e '/etc/redhat-release' and $] == '5.008' and (grep /Red Hat, Inc/, values %Config::Config) ) { print loc(" ### IMPORTANT! ###################################################### You are using perl $] supplied by RedHat, who have applied custom patches that break various perl modules, including this one. You will have to migrate to a perl without these flaws. You could do this for example by building a perl installation by hand. You can obtain the sources from www.cpan.org. We're sorry for the inconvenience. ##################################################################### ") . $/; require 5.008001; }
      I guess I could comment that out of the makefile and see if I get something usable... but nah, I'm going to let this alone for now.
Re: How important is 'use constant a => sub {};'
by blazar (Canon) on Oct 06, 2005 at 11:07 UTC
    Monks, I was just trying to install CPANPLUS on my hosted shell account, and it errored out because on my particular Linux build, use constant a => sub {}; has problems.
    It's hard to believe it is something that gives an error because of "your particular Linux build". It's more likely that you simply have an outdated Perl distro -- I don't have the slightest idea at which time constant.pm made its way through the core modules...

    However it's valid Perl and it's a commonly used module, so you may not like it, but you may want to upgrade in any case. Or else, if you're up to date, there may be something broken in your perl system.

      I don't have the slightest idea at which time constant.pm made its way through the core modules
      Sometime between 5.003_22 and 5.004_05, ie before Apr 1999.

      Dave.

      Well, if you read the snip from the makefile (see my reply to perl mouse), it seems that this is indeed what the makefile thinks. This perl on that version of linux = bad.
        Ok, now I read it. As far a I'm concerned I may go as far as to say that 'that version of Linux = bad'; but I may also s/=/==/ or s/=/eq/. Whatever, I don't want to start a distro flame war.

        I would have never expected this additional difficulty. I only knew about the well known issues of 5.8.0 under "some" distros due to the ("too") improved unicode support.