Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

perl::critic::policy::controlstructures::prohibitdeepnests(3pm) [debian man page]

Perl::Critic::Policy::ControlStructures::ProhibitDeepNesUserpContributed Perl DocumPerl::Critic::Policy::ControlStructures::ProhibitDeepNests(3pm)

NAME
Perl::Critic::Policy::ControlStructures::ProhibitDeepNests - Don't write deeply nested loops and conditionals. AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
Deeply nested code is often hard to understand and may be a sign that it needs to be refactored. There are several good books on how to refactor code. I like Martin Fowler's "Refactoring: Improving The Design of Existing Code". CONFIGURATION
The maximum number of nested control structures can be configured via a value for "max_nests" in a .perlcriticrc file. Each for-loop, if- else, while, and until block is counted as one nest. Postfix forms of these constructs are not counted. The default maximum is 5. Customization in a .perlcriticrc file looks like this: [ControlStructures::ProhibitDeepNests] max_nests = 3 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. 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::ControlStructures::ProhibitDeepNests(3pm)

Check Out this Related Man Page

Perl::Critic::Policy::ControlStructures::ProhibitUntilBlUser(Contributed Perl DocPerl::Critic::Policy::ControlStructures::ProhibitUntilBlocks(3pm)

NAME
Perl::Critic::Policy::ControlStructures::ProhibitUntilBlocks - Write "while(! $condition)" instead of "until($condition)". AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
Conway discourages using "until" because it leads to double-negatives that are hard to understand. Instead, reverse the logic and use "while". until($condition) { do_something() } #not ok until(! $no_flag) { do_something() } #really bad while( ! $condition) { do_something() } #ok This Policy only covers the block-form of "until". For the postfix variety, see "ProhibitPostfixControls". CONFIGURATION
This Policy is not configurable except for the standard options. SEE ALSO
Perl::Critic::Policy::ControlStructures::ProhibitPostfixControls 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. 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::ControlStructures::ProhibitUntilBlocks(3pm)
Man Page

11 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Improving Unix Skills

Kindly any advice to improve my unix skills as electronic books i can download or valuable sites as this one etc... (3 Replies)
Discussion started by: sak900354
3 Replies

2. Shell Programming and Scripting

file reading in nested loops

I have to to read files simultaneously in two nested loops,but am getting error can anyone do the needful. useridFile=userIds.txt fname=kiran.txt exec<$useridFile while read line do echo "User IDs are..$line" USER_ID=$line REMOTE_DIR_LOCATION="/home/test/$USER_ID" SOURCE_DIR=$USER_ID... (1 Reply)
Discussion started by: KiranKumarKarre
1 Replies

3. UNIX for Dummies Questions & Answers

Understanding Code in IF LOOP

Hello All, I would like to know and understand the difference between the below 3 IF loops and also if possible what are the different other parameters i could use other than those mentioed in the below lF LOOP conditions, appreciate your help. Thanks, Sam. (1 Reply)
Discussion started by: Ariean
1 Replies

4. Shell Programming and Scripting

nested for loops

I need help getting over this bump on how nested for loops work in shell. Say i was comparing files in a directory in any other language my for loop would look like so for(int i=0;to then end; i++) for(int y = i+1; to the end; y++) I can't seem to understand how i can translate that... (5 Replies)
Discussion started by: taiL
5 Replies

5. What is on Your Mind?

How to write good code

Too good, and (sadly) too real to pass over: xkcd: Good Code (1 Reply)
Discussion started by: pludi
1 Replies

6. Shell Programming and Scripting

KSH nested loops?

KSH isn't my strong suit but it's what my company has to offer. I've got a script with two nested loops, a FOR and UNTIL, and that works fine. When I add a CASE into the mix I end up getting "Unexpected 'done' at line xx" errors. Any suggestions on this? for divi in at ce ci cm co de di fl... (9 Replies)
Discussion started by: mrice
9 Replies

7. UNIX for Dummies Questions & Answers

Faster than nested while read loops?

Hi experts, I just want to know if there is a better solution to my nested while read loops below: while read line; do while read line2; do while read line3; do echo "$line $line2 $line3" done < file3.txt done < file2.txt done < file1.txt >... (4 Replies)
Discussion started by: chstr_14
4 Replies

8. UNIX for Dummies Questions & Answers

How to use nested ifs in unix?

how to use nested ifs in unix (1 Reply)
Discussion started by: pratima.kumari
1 Replies

9. Shell Programming and Scripting

Two variables in output file name nested for loops

I am trying to use two nested for loops to process some files and then create a new file using both variables in the output file name. I have several files in this naming style: S1_L3_all_R1.fastq S1_L3_all_R2.fastq S1_L4_all_R1.fastq S1_L4_all_R2.fastq . . S1_L8_all_R1.fastq... (3 Replies)
Discussion started by: aminards
3 Replies

10. Programming

If else block C code

Hi, We have hundreds of c codes for which we need to identify and analyse all the if , nested if and while conditions used in code.. is thr any tool to do that. All we is like index (like 1.2.1.3 in case of nested if)and the corresponding code (may be wrriten in a table/file). Thanks..! (2 Replies)
Discussion started by: anijan
2 Replies

11. What is on Your Mind?

O'Reilly Site Lists 165 Things Every Programmer Should Know

Hi. Interesting set of brief essays ... cheers, drl Slashdot 10% sample: Code Is Design by Ryan Brush Continuous Learning by Clint Shank Do Lots of Deliberate Practice by Jon Jagger Don't Touch that Code! by Cal Evans Floating-point Numbers Aren't Real by Chuck Allison Install Me... (1 Reply)
Discussion started by: drl
1 Replies