| ARGV-readonly documentation | Contained in the ARGV-readonly distribution. |
ARGV::readonly - make <> open files regardless of leading/trailing whitespace and/or control characters such as |, >, amd <.
this module allows
use ARGV::readonly;
while(<>){
...
to be safer in hostile environments where one is bullheaded enough to give * as the command line argument. See rants on P5P from July, 2008.
the code is shorter than the documentation. Please look at it.
None by default.
ideally a suite of ARGV::* modules will appear, each doing their little thing,
in a way that they won't stomp on each other's toes. This module has no
exclusion interface or anything, so an @ARGV modifier that, for instance,
preprocesses *.gz into "gunzip -c $_ |" is either going to have to undo
the mods made here or be incompatible.
modified suggestion made by Tom Christiansen in Message-ID: <24692.1217339882@chthon>
July 2008 perl5 porters archive
furtively assembled by David Nicol <davidnico@cpan.org>
This module is hereby placed in the public domain.
| ARGV-readonly documentation | Contained in the ARGV-readonly distribution. |
package ARGV::readonly; use 5.00001; $VERSION = '0.01'; sub import{ # Tom Christiansen in Message-ID: <24692.1217339882@chthon> # reccomends essentially the following: for (@ARGV){ s/^(\s+)/.\/$1/; # leading whitespace preserved s/^/< /; # force open for input $_.=qq/\0/; # trailing whitespace preserved & pipes forbidden }; }; 1; __END__