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

How come code that's in modules can violate 'use strict' but it won't give an error? The Symbol module uses symbolic references, but it dosen't need to use 'no strict qw(refs)'...

2001-03-17 Edit by Corion: Changed title

Replies are listed 'Best First'.
Re: Modules exempt from 'use strict'
by chipmunk (Parson) on Mar 17, 2001 at 10:17 UTC
    The Symbol module doesn't need 'no strict qw(refs)' because it doesn't 'use strict' in the first place. :)

    Remember that strict, like most pragmas, is lexically scoped. It only applies to the end of the enclosing block (and a file is a block too).

    Setting warnings with -w or $^W, on the other hand, is global. Since this can be problematic, perl5.6.0 added a warnings pragma, which is lexically scoped.

Re (tilly) 1: Modules exempt from 'use strict'
by tilly (Archbishop) on Mar 17, 2001 at 06:01 UTC
Re: Modules exempt from
by MrNobo1024 (Hermit) on Mar 17, 2001 at 05:53 UTC
    Oops. I meant to call this node Modules exempt from "use strict"? but it seems this site dosen't like double quotes in node titles.