The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Strict::Perl - Perl module to restrict old/unsafe constructs

SYNOPSIS

  use Strict::Perl 2014.10; # must version, must match

DESCRIPTION

Strict::Perl provides a restricted scripting environment excluding old/unsafe constructs, on both modern Perl and traditional Perl.

Strict::Perl works in concert with Modern::Open and Fake::Our if those are used in your script.

Version specify is required when use Strict::Perl, like;

  use Strict::Perl 2014.10;

It's die if specified version doesn't match Strict::Perl's version.

On Perl 5.010001 or later, Strict::Perl works as;

  use strict;
  use warnings qw(FATAL all);
  use Fatal qw( # by compatible routine in Strict::Perl
      seek sysseek
      dbmclose dbmopen
      binmode close chmod chown fcntl flock ioctl open sysopen truncate
      chdir closedir opendir link mkdir readlink rename rmdir symlink
      pipe
      msgctl msgget msgrcv msgsnd
      semctl semget semop
      shmctl shmget shmread
      accept bind connect getsockopt listen recv send setsockopt shutdown socketpair
      fork
  );
  use autodie qw(
      read sysread syswrite
      fileno
  );

On Perl 5.006 or later,

  use strict;
  use warnings qw(FATAL all);
  use Fatal qw( # by compatible routine in Strict::Perl
      seek sysseek
      dbmclose dbmopen
      binmode close chmod chown fcntl flock ioctl open sysopen truncate
      chdir closedir opendir link mkdir readlink rename rmdir symlink
      pipe
      msgctl msgget msgrcv msgsnd
      semctl semget semop
      shmctl shmget shmread
      accept bind connect getsockopt listen recv send setsockopt shutdown socketpair
      fork
  );

On Perl 5.00503 or later,

  use strict;
  $^W = 1;
  $SIG{__WARN__} = sub { die "$_[0]\n" };
  use Fatal qw( # by compatible routine in Strict::Perl
      seek sysseek
      dbmclose dbmopen
      binmode close chmod chown fcntl flock ioctl open sysopen truncate
      chdir closedir opendir link mkdir readlink rename rmdir symlink
      pipe
      msgctl msgget msgrcv msgsnd
      semctl semget semop
      shmctl shmget shmread
      accept bind connect getsockopt listen recv send setsockopt shutdown socketpair
      fork
  );

Prohibited Keywords in your script are;

  goto  redo  until  foreach
  format  write  formline
  msgctl  msgget  msgrcv  msgsnd
  semctl  semget  semop
  shmctl  shmget  shmread  shmwrite
  given  when

Prohibited Special Variables are;

  $ARRAY_BASE                        $[
  $OFMT                              $#
                                     @F
                                     $^H
  $OUTPUT_FIELD_SEPARATOR   $OFS     $,
  $OUTPUT_RECORD_SEPARATOR  $ORS     $\
  $LIST_SEPARATOR                    $"
  $SUBSCRIPT_SEPARATOR      $SUBSEP  $;
  $MULTILINE_MATCHING                $*
  $PREMATCH                          $`
  $MATCH                             $&
  $POSTMATCH                         $'
  $FORMAT_PAGE_NUMBER                $%
  $FORMAT_LINES_PER_PAGE             $=
  $FORMAT_LINES_LEFT                 $-
  $FORMAT_NAME                       $~
  $FORMAT_TOP_NAME                   $^
  $FORMAT_LINE_BREAK_CHARACTERS      $:
  $FORMAT_FORMFEED                   $^L
  $ACCUMULATOR                       $^A

Prohibited Operator is;

  ~~ (smartmatch)

Prohibited modules in script are;

  Thread  threads  encoding  Switch

Must Keyword in your script is;

  VERSION
  Any of scalar variable or any variable, subroutine name,
  literal string, or comment

Be useful software for you!

AUTHOR

INABA Hitoshi <ina@cpan.org>

This project was originated by INABA Hitoshi.

LICENSE AND COPYRIGHT

This software is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

SEE ALSO