The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

NAME

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

SYNOPSIS

use Strict::Perl 2023.03; # 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 2023.03;

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); # not follow incompatible version-up of warnings.pm
use Fatal # by compatible routine in Strict::Perl
qw(
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); # not follow incompatible version-up of warnings.pm
use Fatal # by compatible routine in Strict::Perl
qw(
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" }; # not follow incompatible version-up of warnings.pm
use Fatal # by compatible routine in Strict::Perl
qw(
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 modules in script are;

Thread threads encoding Switch

Be useful software for you!

AUTHOR

INABA Hitoshi <ina@cpan.org> in a CPAN

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