Perl-Critic-Policy-ValuesAndExpressions-ProhibitFiletest_rwxRWX
view release on metacpan or search on metacpan
examples/file-access-tests view on Meta::CPAN
foreach my $fn ( @ARGV ) {
no warnings qw{ newline }; ## no critic (ProhibitNoWarnings)
foreach my $pf ( -e $fn ? all_perl_files( $fn ) : \$fn ) {
# We jump through this particular hoop because PPI::Document
# does not recognize 'use utf8;'. Instead it looks for a Byte
# Order Mark (a.k.a. non-breaking space) as the first encoded
# character of the file, and adjusts accordingly. UTF-8 files
# without a BOM are therefore not read correctly. So we incur
# the overhead of guessing and decoding if we guess a unique
# encoding. We then feed PPI::Document the possibly-decoded file
# content.
my $doc;
{
local $/ = undef;
open my $fh, '<', $pf
or die "Unable to open $pf: $!\n";
my $data = <$fh>;
close $fh;
( run in 0.366 second using v1.01-cache-2.11-cpan-e9daa2b36ef )