perl::critic::policy::inputoutput::prohibitbarewordfilehandles(3pm) [debian man page]
Perl::Critic::Policy::InputOutput::ProhibitBarewordFileHUsereContributed Perl DPerl::Critic::Policy::InputOutput::ProhibitBarewordFileHandles(3pm)NAME
Perl::Critic::Policy::InputOutput::ProhibitBarewordFileHandles - Write "open my $fh, q{<}, $filename;" instead of "open FH, q{<},
$filename;".
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Using bareword symbols to refer to file handles is particularly evil because they are global, and you have no idea if that symbol already
points to some other file handle. You can mitigate some of that risk by "local"izing the symbol first, but that's pretty ugly. Since Perl
5.6, you can use an undefined scalar variable as a lexical reference to an anonymous filehandle. Alternatively, see the IO::Handle or
IO::File or FileHandle modules for an object-oriented approach.
open FH, '<', $some_file; #not ok
open my $fh, '<', $some_file; #ok
my $fh = IO::File->new($some_file); #ok
There are three exceptions: STDIN, STDOUT and STDERR. These three standard filehandles are always package variables.
CONFIGURATION
This Policy is not configurable except for the standard options.
SEE ALSO
IO::Handle
IO::File
AUTHOR
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
COPYRIGHT
Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-06-07 Perl::Critic::Policy::InputOutput::ProhibitBarewordFileHandles(3pm)
Check Out this Related Man Page
Perl::Critic::Policy::InputOutput::RequireCheckedOpen(3)User Contributed Perl DocumentatioPerl::Critic::Policy::InputOutput::RequireCheckedOpen(3)NAME
Perl::Critic::Policy::InputOutput::RequireCheckedOpen - Write "my $error = open $fh, $mode, $filename;" instead of "open $fh, $mode,
$filename;".
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
The perl builtin I/O function "open" returns a false value on failure. That value should always be checked to ensure that the open was
successful.
my $error = open( $filehandle, $mode, $filename ); # ok
open( $filehandle, $mode, $filename ) or die "unable to open: $!"; # ok
open( $filehandle, $mode, $filename ); # not ok
use autodie;
open $filehandle, $mode, $filename; # ok
You can use autodie, Fatal, or Fatal::Exception to get around this. Currently, autodie is not properly treated as a pragma; its lexical
effects aren't taken into account.
CONFIGURATION
This Policy is not configurable except for the standard options.
AUTHOR
Andrew Moore <amoore@mooresystems.com>
ACKNOWLEDGMENTS
This policy module is based heavily on policies written by Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>.
COPYRIGHT
Copyright (c) 2007-2011 Andrew Moore. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license
can be found in the LICENSE file included with this module.
perl v5.16.3 2014-06-09 Perl::Critic::Policy::InputOutput::RequireCheckedOpen(3)
Very new user with a dumb question. While performing ls command I found some files in my directory that look like this:
#filename#
What does this mean. I cannot open with vi, cat, head, nor can I delete it with rm. Can someone educate me please, and how to fix?
THX
Dereck (8 Replies)
Hello.
Source file are in : /a/b/c/d/e/f/g/some_file
Destination is : /d/e where sub-directories "f" and "g" may missing or not.
After copying I want /a/b/c/d/e/f/g/file1 in /d/e/f/g/file1
On source /a is top-level directory
On destination /d is top-level directory
I would like... (2 Replies)