24 Jul 2022 06:28:31 UTC
- Distribution: Perl-Critic-Community
- Module version: v1.0.3
- Source (raw)
- Browse (raw)
- How to Contribute
- KwaliteeBus factor: 1
- 89.40% Coverage
- License: artistic_2
- Perl: v5.10.1
- Activity24 month
- Download (46.32KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:2 non-PAUSE usersDBOOK Dan Book
- Reverse dependencies
- CPAN Testers List
- Dependency graph
Perl::Critic::Policy::Community::OpenArgs - Always use the three-argument form of open
open()function may be called in a two-argument form where the filename is parsed to determine the mode of opening, which may include piping input or output. (In the one-argument form, this filename is retrieved from a global variable, but the same magic is used.) This can lead to vulnerabilities if the filename is retrieved from user input or could begin or end with a special character. The three-argument form specifies the open mode as the second argument, so it is always distinct from the filename.
open FILE; # not ok open my $fh, "<$filename"; # not ok open my $fh, '<', $filename; # ok
This policy is similar to the core policy Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen, but additionally prohibits one-argument opens.
This policy is part of Perl::Critic::Community.
This policy is not configurable except for the standard options.
Copyright 2015, Dan Book.
This library is free software; you may redistribute it and/or modify it under the terms of the Artistic License version 2.0.
Module Install Instructions
To install Perl::Critic::Community, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Perl::Critic::Community
For more information on module installation, please visit the detailed CPAN module installation guide.