in reply to Re: apache2 conflicts with strict declaration
in thread apache2 conflicts with strict declaration

Ok, a night's sleep definitely gives you some perspective. So why does:
use strict qw(@ISA);
seem to do the right thing before 5.8.1? Well, it's very easy. If you do that in Perl's before 5.8.1, strict is not enforced at all in your program!.

Observe:

$ perl5.8.1 -Mstrict=@ISA -e '$foo = 1' Unknown 'strict' tag(s) '@ISA' at -e line 0 BEGIN failed--compilation aborted.
now fails at attempting to use "@ISA" as a keyword. Older versions of Perl, allowed this:
$ perl5.8.0 -Mstrict=@ISA -e '$foo = 1'
In other words, the "$foo" not being declared, does not give an error. It should have said:
$ perl5.8.0 -Mstrict -e '$foo = 1' Global symbol "$foo" requires explicit package name at -e line 1. Execution of -e aborted due to compilation errors.

So, the statement "that everything works fine" may well be true, as you can make perfectly running programs without using strict. But had the original developer made errors in the naming of variables, you wouldn't have known about it because of the lack stricture actually being applied.

Hope this clears up this little riddle.

Liz

Replies are listed 'Best First'.
Re: no strict with 'use strict qw(@ISA)'
by antirice (Priest) on Sep 11, 2003 at 08:17 UTC

    Looking at the source for strict.pm under 5.8.1 RC4, this seems weird. I guess they just moved some checks into use? Seems strange they they didn't just check for them in strict.pm.

    antirice    
    The first rule of Perl club is - use Perl
    The
    ith rule of Perl club is - follow rule i - 1 for i > 1

      The latest 5.8.1 snapshot has in strict.pm:
      my %bitmask = ( refs => 0x00000002, subs => 0x00000200, vars => 0x00000400 ); sub bits { my $bits = 0; my @wrong; foreach my $s (@_) { push @wrong, $s unless exists $bitmask{$s}; $bits |= $bitmask{$s} || 0; } if (@wrong) { require Carp; Carp::croak("Unknown 'strict' tag(s) '@wrong'"); } $bits; }

      which clearly shows that it is just inside the "strict" module to me.

      I believe it was patch 17869. From Changes:

      [ 17869] Subject: [perl #17061] no strict 'garbage' From: Elizabeth Mattijsen (via RT) <perlbug@perl.org> Date: 6 Sep 2002 19:31:02 -0000 Message-Id: <rt-17061-36808.6.19994322284541@bugs6.perl.org> Date: Sat, 07 Sep 2002 13:40:22 +0200 Message-Id: <4.2.0.58.20020907133846.02476d40@mickey.dijkmat.nl>

      Liz