NAME sanity - The ONLY meta pragma you'll ever need! SYNOPSIS use sanity; use sanity 'strictures'; use sanity 'Modern::Perl'; use sanity qw( strictures -warnings/uninitialized/FATAL NO:autovivification NO:autovivification/store PRINT_PRAGMA_HASH ); use sanity '!0*b^Npow{8T7_yZtunimport() use sanity '-indirect'; # Dies, as there is no such flag/alias # This runs through the strictures alias and runs autovivification->unimport() use sanity qw(strictures NO:autovivification); # This runs through the strictures alias WITHOUT running indirect->unimport() use sanity qw(strictures -NO:indirect); use sanity '-indirect'; # This isn't what you want... no sanity 'NO:indirect'; # ...you really meant to do this... use indirect; # ...but this is better Special clearing of strict/warnings Since most people want exactly the strictness and warnings they specify, sanity will clear these out first before running through the list. # This... use sanity qw(strict -strict/vars); # ...is the same as this... no strict; use strict qw(subs refs); Also, some special magic is in place to ensure that newer warnings/features aren't fatal to older Perls. See https://rt.perl.org/rt3/Ticket/Display.html?id=112920. "Author" pragmas Certain pragmas really only exist to make sure the code is designed right. These pragmas are deemed "optional" by sanity. In other words, if the user doesn't have them, it will just silently ignore them and move on. If sanity thinks you're an author/coder of the module itself (.git/svn/$ENV checks), it will give you a warning that they are missing, but move on. The following modules don't "instadie". Modules that fall under this list don't change the nature of how Perl works, or would let you do something that would normally fatally error. overloading autovivification indirect multidimensional bareword::filehandles criticism # (autovivification probably shouldn't be here, since it actually # prevents autoviv, but it's generally used as an author tool.) This feature was borrowed from strictures and tweaked. LIST OF FLAGS Emulation of "meta pragmas" ex::caution: strict warnings NO:crap: # Same as above shit: # Same as above latest: strict warnings feature sane: strict warnings feature utf8 NO:nonsense: strict warnings true namespace::autoclean Modern::Perl: strict warnings mro 'dfs' feature IO::File IO::Handle strictures: (without the 5.8.4 checks; that crap is old) v5.8.4 (forced, to make sure things work) strict warnings FATAL => 'all' no indirect 'fatal' no multidimensional no bareword::filehandles common::sense: (without the "memory usage" BS) utf8 strict qw(subs vars) feature qw(say state switch) no warnings warnings FATAL => qw(closed threads internal debugging pack malloc portable prototype inplace io pipe unpack deprecated glob digit printf layer reserved taint closure semicolon) no warnings qw(exec newline unopened); uni::perl: (ditto) v5.10 strict feature qw(say state switch) no warnings warnings qw(FATAL closed threads internal debugging pack substr malloc unopened portable prototype inplace io pipe unpack regexp deprecated exiting glob digit printf utf8 layer reserved parenthesis taint closure semicolon) no warnings qw(exec newline) utf8 open (:utf8 :std) mro 'c3' Carp sanity: v5.10.1 utf8 open (:utf8 :std) mro 'c3' strict qw(subs vars) no strict 'refs' warnings FATAL => 'all' no warnings qw(uninitialized experimental::smartmatch) feature '5.10' no autovivification qw(fetch exists delete store strict) no indirect 'fatal' no multidimensional perl5i::0 / 1 / 2 / latest: [the real module] (the pragma is too insane to try to duplicate here) Acme::Very::Modern::Perl: (a joke, but it's still here all the same) strict warnings mro 'c3' feature IO::File IO::Handle utf8 open (:utf8 :std) no warnings warnings FATAL => qw(closed threads internal debugging pack malloc portable prototype inplace io pipe unpack deprecated glob digit printf layer reserved taint closure semicolon) no warnings qw(exec newline unopened); perl5i::latest Toolkit Carp Other flags/aliases strict/* => strict '[whatever]' # supports all flags strict => strict qw(refs subs vars) # other "hints" integer locale bytes re/taint re/eval filetest utf8 NO:overloading warnings/* => warnings NONFATAL => '[whatever]' # supports all flags, multi or not warnings/*/FATAL => warnings FATAL => '[whatever]' # supports all flags; FATAL trumps NONFATAL warnings => warnings NONFATAL => 'all' warnings/FATAL => warnings FATAL => 'all' feature/* => feature '[whatever]' # supports all flags feature/5.## => # similar to feature enabling via 'use v5.##'; major version only feature/5.9.5 => # also exists, just like feature/5.10 feature => feature ':all' # not exactly, but in spirit # Perl versions, described above v5.##.## # autodie autodie/* => autodie ':[whatever]' # supports all _category_ flags, like all, io, shm, etc. # (Will expand if requested, but I don't want to waste # all of that bit space right now.) autodie => autodie ':default' # other CORE pragmas bigint bignum bigrat charnames charnames/short charnames/full encoding::warnings encoding::warnings/FATAL mro/dfs # default for 'mro' mro/c3 open/* # namespace cleaners namespace::clean # included last; adds -except => 'meta' namespace::functions # included last namespace::autoclean namespace::sweep # others NO:autovivification/* NO:autovivification => no autovivification qw(fetch exists delete) criticism/* criticism => criticism 'gentle' experimental/* perl5i::0 perl5i::1 perl5i::2 perl5i::3 perl5i::latest NO:indirect NO:indirect/global NO:indirect/fatal NO:multidimensional NO:bareword::filehandles subs::auto utf8::all IO::File IO::Handle IO::All Carp vendorlib true autolocale Toolkit Function::Parameters Function::Parameters/strict Switch::Plain Quote::Code Am I missing something? Let me know. TODO Actually need to write sanity::sanity POD. AVAILABILITY The project homepage is https://github.com/SineSwiper/sanity. The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit http://www.perl.com/CPAN/ to find a CPAN site near you, or see https://metacpan.org/module/sanity/. SUPPORT Internet Relay Chat You can get live help by using IRC ( Internet Relay Chat ). If you don't know what IRC is, please read this excellent guide: http://en.wikipedia.org/wiki/Internet_Relay_Chat. Please be courteous and patient when talking to us, as we might be busy or sleeping! You can join those networks/channels and get help: * irc.perl.org You can connect to the server at 'irc.perl.org' and talk to this person for help: SineSwiper. Bugs / Feature Requests Please report any bugs or feature requests via https://github.com/SineSwiper/sanity/issues. AUTHOR Brendan Byrd CONTRIBUTOR Graham Knop COPYRIGHT AND LICENSE This software is Copyright (c) 2014 by Brendan Byrd. This is free software, licensed under: The Artistic License 2.0 (GPL Compatible)