Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

perl::critic::policy::inputoutput::requirecheckedopen(3) [centos 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)

Check Out this Related Man Page

Perl::Critic::Policy::InputOutput::RequireCheckedOpen(3pUser Contributed Perl DocumentatPerl::Critic::Policy::InputOutput::RequireCheckedOpen(3pm)

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.14.2 2012-06-07 Perl::Critic::Policy::InputOutput::RequireCheckedOpen(3pm)
Man Page

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unix command in Perl

Hi, I have a perl script. It needs to open a file but the file that it will open will depend on the result of a unix command "tail -1". How can I do that in perl, to open a file which is the results from a unix command? Thanks in advance! Hope you can help me. (2 Replies)
Discussion started by: ayhanne
2 Replies

2. Programming

What does open() do anyways?

I know its kind of silly to think about it, but what does this function do anyways? I know it is used to open a given file with a variety of options but what is the best place to find out what is happening internally? I think it updates the file descriptor table and provides a lock file but does it... (3 Replies)
Discussion started by: Legend986
3 Replies

3. UNIX for Advanced & Expert Users

getting error when open vi editor

helo I install my product for koren language I m uisng RHEL -4 operating system now problem is whenever I open any file vi filename I got following error on the screen E557: Cannot open termcap file 'vt100' not known. Available builtin terminals are: builtin_ansi ... (1 Reply)
Discussion started by: amitpansuria
1 Replies

4. UNIX for Dummies Questions & Answers

ways to open a file

How many ways are there to open a file in unix? wha i know is mentioned below suppose if xx is a filename, then 1) cat xx 2) more xx 3) view xx 4) less xx I heard there are seven ways to open a file. If so, can anyone tell me all the ways to open a file and correct me the above... (3 Replies)
Discussion started by: venkatesht
3 Replies

5. UNIX and Linux Applications

Ocr

Is there any open-source software that OCRs PDFs? (2 Replies)
Discussion started by: CRGreathouse
2 Replies

6. Shell Programming and Scripting

grabbing specific column perl

Alright, I'm new to Perl so be gentle. Given the following script: ---- open(file, "<file.txt"); @lines = <file>; close(file); $var = print $lines; ---- So I'm printing line 18 of the file "file.txt". I now want the 5th column, minus the forward slash. The line looks like this: ... (2 Replies)
Discussion started by: wxornot
2 Replies

7. Shell Programming and Scripting

Perl and Sockets - Error handling

Hello all, I have created a Perl script that tries to open connections to various systems on different ports in order to see if the machines are reachable, the ports are open, etc. There appears to be a difference between Solaris (10) and Linux (RH/Oracle and Ubuntu) in the status or error it... (4 Replies)
Discussion started by: Hollinch
4 Replies

8. Shell Programming and Scripting

Perl, open multiple files with wildcards

I have a question regarding Perl scripting. If I want to say open files that all look like this and assign them to a filehandle and then assign the filehandle to a variable, how do I do this? The file names are strand1.fa.gz.tmp strand2.fa.gz.tmp strand3.fa.gz.tmp strand4.fa.gz.tmp ...... (6 Replies)
Discussion started by: japaneseguitars
6 Replies

9. Shell Programming and Scripting

Script to open a saved file and modify the content

I am looking for a script where I need to open a file and modify the data like changing the parameters.Can anyone help me? open a file software.rsp . It already contains following data. parameter = false threads=100 user= demf The above should be changed to paramter=true thread= 133... (3 Replies)
Discussion started by: sriki32
3 Replies

10. UNIX for Dummies Questions & Answers

vi does not open file properly....

Hello all, I am trying to edit a file using VI on hp-ux....but when i try to open the file using vi <filename> it dose not let me open up the right way...it just messes up the whole file....i cant even read that file...so for example...here is a file i created test1.txt...when i cat... (6 Replies)
Discussion started by: abdul.irfan2
6 Replies

11. Shell Programming and Scripting

Help !! perl open function

Help Please perl Gurus, I am trying to add ungrouped passengers in a group and I creating a script however it fails on first step only I tried all the options it returns following error. syntax error at junki line 4, near "open " Execution of junki aborted due to compilation errors. ... (2 Replies)
Discussion started by: dynamax
2 Replies

12. Cybersecurity

Solaris I/O Error

When i trying to open any exising floder iam unable to open it.It is showing the following error . Can anyone help me out of this (5 Replies)
Discussion started by: kkalyan
5 Replies

13. Shell Programming and Scripting

How to open a huge text file?

Hi. I have a 10 Gb text file.the default text editor in ubuntu doens't open it. Does anyone know how can i open it?? Thanks (4 Replies)
Discussion started by: stalaei
4 Replies

14. UNIX for Dummies Questions & Answers

how to open the linux text file in windows

Hi friends, help me i downloaded some file from the Linux and i copied it to windows.Now i am unable to open those file. please help me how to open those file. the files are something like test.tcl note.tcl Thanking you Praveen (2 Replies)
Discussion started by: prakumar
2 Replies

15. Shell Programming and Scripting

Dealing with filename spaces in Perl

The following command to replace text in place in multiple files in a directory is tripping up on filename spaces (Windows environment). I really don't know Perl. find '\\server\directory' | xargs perl -pi -e 's/textA/textB/g'Mike (2 Replies)
Discussion started by: Michael Stora
2 Replies