in reply to Constants imported from other perl scripts doesn't want to exist :(

The problem is you test unless(defined (\&SOMETHING));
but you want unless ( defined(&SOMETHING));.
Boris

Replies are listed 'Best First'.
Re^2: Constants imported from other perl scripts doesn't want to exist :(
by OnionKnight (Sexton) on Sep 17, 2005 at 19:01 UTC
    I changed it but it didn't make any difference.
      I'm sure, you have a typo somewhere. This should work.
      use strict; eval 'use constant SOMETHING => "asdf"' unless(defined(&SOMETHING)); 1;
      Boris
        No I haven't. Here's the actual .config_defaults.pl:
        #!/usr/bin/perl use strict; eval 'use constant NAME_MAXLENGTH => 30' unless(defined(&NAME_MAXLENGT +H)); eval 'use constant LINK_MAXLENGTH => 256' unless(defined(&LINK_MAXLENG +TH)); eval 'use constant SUBJECT_MAXLENGTH => 256' unless(defined(&SUBJECT_M +AXLENGTH)); eval 'use constant POST_MAXLENGTH => 8192' unless(defined(&POST_MAXLEN +GTH)); 1;
        require() related:
        my $dir = dirname($ENV{"SCRIPT_FILENAME"})."/"; require("$dir.config_defaults.pl");
        Code snippet where the first error occurs (if it's commented, the next constant gets error'd):
        &error("Subject is too long/empty.") if (length $$subject > &SUBJECT_M +AXLENGTH || ($$subject eq "" && $mode eq "post"));
        The error message:
        [error] -e: Undefined subroutine &ModPerl::ROOT::ModPerl::Registry::[v +ery long fullpath]post_2epl::SUBJECT_MAXLENGTH called at (eval 50) li +ne 195.\n