From da95c414033799c3a62606f299c3c00b5c77ca11 Mon Sep 17 00:00:00 2001 From: Nito Martinez Date: Sun, 11 Apr 2010 20:38:30 +0100 Subject: [PATCH] Build all packages removed dependencies of libtest-exception-perl libtest-warn-perl and libtest-harness-perl --- .../libperl-critic-perl-1.088/Build.PL | 178 +++ .../libperl-critic-perl-1.088/Changes | 1260 +++++++++++++++ .../libperl-critic-perl-1.088/INSTALL | 35 + .../libperl-critic-perl-1.088/LICENSE | 377 +++++ .../libperl-critic-perl-1.088/MANIFEST | 413 +++++ .../libperl-critic-perl-1.088/META.yml | 595 +++++++ .../libperl-critic-perl-1.088/Makefile.PL | 124 ++ .../libperl-critic-perl-1.088/README | 704 +++++++++ .../libperl-critic-perl-1.088/TODO.pod | 574 +++++++ .../libperl-critic-perl-1.088/bin/perlcritic | 1387 ++++++++++++++++ .../libperl-critic-perl-1.088/debian/changelog | 77 + .../libperl-critic-perl-1.088/debian/compat | 1 + .../libperl-critic-perl-1.088/debian/control | 47 + .../libperl-critic-perl-1.088/debian/control~ | 47 + .../libperl-critic-perl-1.088/debian/copyright | 30 + .../libperl-critic-perl-1.088/debian/docs | 1 + .../libperl-critic-perl-1.088/debian/examples | 1 + .../libperl-critic-perl-1.088/debian/rules | 3 + .../libperl-critic-perl-1.088/debian/watch | 3 + .../examples/generatestats | 309 ++++ .../examples/loadanalysisdb | 349 +++++ .../examples/perlcriticrc | 148 ++ .../examples/perlcriticrc-conway | 283 ++++ .../extras/KomodoIntegration.pod | 88 ++ .../libperl-critic-perl-1.088/extras/perlcritic.el | 681 ++++++++ .../inc/Devel/AssertOS.pm | 81 + .../inc/Devel/AssertOS/AIX.pm | 13 + .../inc/Devel/AssertOS/Amiga.pm | 13 + .../inc/Devel/AssertOS/Apple.pm | 13 + .../inc/Devel/AssertOS/BSDOS.pm | 13 + .../inc/Devel/AssertOS/BeOS.pm | 13 + .../inc/Devel/AssertOS/Cygwin.pm | 13 + .../inc/Devel/AssertOS/DEC.pm | 13 + .../inc/Devel/AssertOS/DGUX.pm | 13 + .../inc/Devel/AssertOS/DragonflyBSD.pm | 13 + .../inc/Devel/AssertOS/Dynix.pm | 13 + .../inc/Devel/AssertOS/FreeBSD.pm | 13 + .../inc/Devel/AssertOS/HPUX.pm | 13 + .../inc/Devel/AssertOS/Interix.pm | 13 + .../inc/Devel/AssertOS/Irix.pm | 13 + .../inc/Devel/AssertOS/Linux.pm | 13 + .../inc/Devel/AssertOS/MPEiX.pm | 13 + .../inc/Devel/AssertOS/MSDOS.pm | 13 + .../inc/Devel/AssertOS/MSWin32.pm | 13 + .../inc/Devel/AssertOS/MacOSX.pm | 13 + .../inc/Devel/AssertOS/MacOSclassic.pm | 13 + .../inc/Devel/AssertOS/MachTen.pm | 13 + .../inc/Devel/AssertOS/MicrosoftWindows.pm | 13 + .../inc/Devel/AssertOS/NeXT.pm | 13 + .../inc/Devel/AssertOS/NetBSD.pm | 13 + .../inc/Devel/AssertOS/Netware.pm | 13 + .../inc/Devel/AssertOS/OS2.pm | 13 + .../inc/Devel/AssertOS/OS390.pm | 13 + .../inc/Devel/AssertOS/OS400.pm | 13 + .../inc/Devel/AssertOS/OSF.pm | 13 + .../inc/Devel/AssertOS/OpenBSD.pm | 13 + .../inc/Devel/AssertOS/POSIXBC.pm | 13 + .../inc/Devel/AssertOS/RISCOS.pm | 13 + .../inc/Devel/AssertOS/SCO.pm | 13 + .../inc/Devel/AssertOS/Solaris.pm | 13 + .../inc/Devel/AssertOS/Sun.pm | 13 + .../inc/Devel/AssertOS/SunOS.pm | 13 + .../inc/Devel/AssertOS/SysVr4.pm | 13 + .../inc/Devel/AssertOS/SysVr5.pm | 13 + .../inc/Devel/AssertOS/Unicos.pm | 13 + .../inc/Devel/AssertOS/Unix.pm | 40 + .../inc/Devel/AssertOS/VMESA.pm | 13 + .../inc/Devel/AssertOS/VMS.pm | 13 + .../inc/Devel/AssertOS/VOS.pm | 13 + .../libperl-critic-perl-1.088/inc/Devel/CheckOS.pm | 238 +++ .../inc/Perl/Critic/BuildUtilities.pm | 230 +++ .../libperl-critic-perl-1.088/lib/Perl/Critic.pm | 1158 ++++++++++++++ .../lib/Perl/Critic/Config.pm | 1165 ++++++++++++++ .../lib/Perl/Critic/DEVELOPER.pod | 1058 +++++++++++++ .../lib/Perl/Critic/Document.pm | 326 ++++ .../lib/Perl/Critic/Exception.pm | 95 ++ .../Critic/Exception/AggregateConfiguration.pm | 202 +++ .../lib/Perl/Critic/Exception/Configuration.pm | 90 ++ .../Perl/Critic/Exception/Configuration/Generic.pm | 95 ++ .../Perl/Critic/Exception/Configuration/Option.pm | 142 ++ .../Exception/Configuration/Option/Global.pm | 71 + .../Configuration/Option/Global/ExtraParameter.pm | 123 ++ .../Configuration/Option/Global/ParameterValue.pm | 132 ++ .../Exception/Configuration/Option/Policy.pm | 98 ++ .../Configuration/Option/Policy/ExtraParameter.pm | 125 ++ .../Configuration/Option/Policy/ParameterValue.pm | 133 ++ .../lib/Perl/Critic/Exception/Fatal.pm | 112 ++ .../lib/Perl/Critic/Exception/Fatal/Generic.pm | 80 + .../lib/Perl/Critic/Exception/Fatal/Internal.pm | 80 + .../Critic/Exception/Fatal/PolicyDefinition.pm | 81 + .../lib/Perl/Critic/Exception/IO.pm | 97 ++ .../lib/Perl/Critic/Exception/Parse.pm | 92 ++ .../lib/Perl/Critic/OptionsProcessor.pm | 291 ++++ .../lib/Perl/Critic/Policy.pm | 881 +++++++++++ .../Policy/BuiltinFunctions/ProhibitBooleanGrep.pm | 156 ++ .../BuiltinFunctions/ProhibitComplexMappings.pm | 146 ++ .../BuiltinFunctions/ProhibitLvalueSubstr.pm | 100 ++ .../BuiltinFunctions/ProhibitReverseSortBlock.pm | 135 ++ .../BuiltinFunctions/ProhibitSleepViaSelect.pm | 110 ++ .../Policy/BuiltinFunctions/ProhibitStringyEval.pm | 106 ++ .../BuiltinFunctions/ProhibitStringySplit.pm | 116 ++ .../BuiltinFunctions/ProhibitUniversalCan.pm | 107 ++ .../BuiltinFunctions/ProhibitUniversalIsa.pm | 110 ++ .../Policy/BuiltinFunctions/ProhibitVoidGrep.pm | 104 ++ .../Policy/BuiltinFunctions/ProhibitVoidMap.pm | 104 ++ .../Policy/BuiltinFunctions/RequireBlockGrep.pm | 113 ++ .../Policy/BuiltinFunctions/RequireBlockMap.pm | 109 ++ .../Policy/BuiltinFunctions/RequireGlobFunction.pm | 97 ++ .../BuiltinFunctions/RequireSimpleSortBlock.pm | 116 ++ .../Policy/ClassHierarchies/ProhibitAutoloading.pm | 97 ++ .../Policy/ClassHierarchies/ProhibitExplicitISA.pm | 93 ++ .../Policy/ClassHierarchies/ProhibitOneArgBless.pm | 101 ++ .../Critic/Policy/CodeLayout/ProhibitHardTabs.pm | 133 ++ .../CodeLayout/ProhibitParensWithBuiltins.pm | 237 +++ .../Policy/CodeLayout/ProhibitQuotedWordLists.pm | 163 ++ .../CodeLayout/ProhibitTrailingWhitespace.pm | 148 ++ .../Policy/CodeLayout/RequireConsistentNewlines.pm | 125 ++ .../Critic/Policy/CodeLayout/RequireTidyCode.pm | 193 +++ .../Policy/CodeLayout/RequireTrailingCommas.pm | 126 ++ .../ControlStructures/ProhibitCStyleForLoops.pm | 109 ++ .../ControlStructures/ProhibitCascadingIfElse.pm | 133 ++ .../Policy/ControlStructures/ProhibitDeepNests.pm | 124 ++ .../ProhibitLabelsWithSpecialBlockNames.pm | 124 ++ .../ProhibitMutatingListFunctions.pm | 308 ++++ ...egativeExpressionsInUnlessAndUntilConditions.pm | 208 +++ .../ControlStructures/ProhibitPostfixControls.pm | 191 +++ .../ControlStructures/ProhibitUnlessBlocks.pm | 103 ++ .../ControlStructures/ProhibitUnreachableCode.pm | 222 +++ .../ControlStructures/ProhibitUntilBlocks.pm | 102 ++ .../Critic/Policy/Documentation/PodSpelling.pm | 335 ++++ .../Documentation/RequirePackageMatchesPodName.pm | 115 ++ .../Critic/Policy/Documentation/RequirePodAtEnd.pm | 131 ++ .../Policy/Documentation/RequirePodSections.pm | 477 ++++++ .../Critic/Policy/ErrorHandling/RequireCarping.pm | 430 +++++ .../RequireCheckingReturnValueOfEval.pm | 374 +++++ .../InputOutput/ProhibitBacktickOperators.pm | 143 ++ .../InputOutput/ProhibitBarewordFileHandles.pm | 119 ++ .../Policy/InputOutput/ProhibitExplicitStdin.pm | 126 ++ .../Policy/InputOutput/ProhibitInteractiveTest.pm | 89 ++ .../Policy/InputOutput/ProhibitJoinedReadline.pm | 119 ++ .../Policy/InputOutput/ProhibitOneArgSelect.pm | 108 ++ .../InputOutput/ProhibitReadlineInForLoop.pm | 99 ++ .../Policy/InputOutput/ProhibitTwoArgOpen.pm | 140 ++ .../RequireBracedFileHandleWithPrint.pm | 143 ++ .../Critic/Policy/InputOutput/RequireBriefOpen.pm | 310 ++++ .../Policy/InputOutput/RequireCheckedClose.pm | 105 ++ .../Policy/InputOutput/RequireCheckedOpen.pm | 105 ++ .../Policy/InputOutput/RequireCheckedSyscalls.pm | 190 +++ .../Critic/Policy/Miscellanea/ProhibitFormats.pm | 95 ++ .../Perl/Critic/Policy/Miscellanea/ProhibitTies.pm | 94 ++ .../Policy/Miscellanea/RequireRcsKeywords.pm | 195 +++ .../Policy/Modules/ProhibitAutomaticExportation.pm | 151 ++ .../Critic/Policy/Modules/ProhibitEvilModules.pm | 178 +++ .../Policy/Modules/ProhibitExcessMainComplexity.pm | 150 ++ .../Policy/Modules/ProhibitMultiplePackages.pm | 95 ++ .../Policy/Modules/RequireBarewordIncludes.pm | 128 ++ .../Critic/Policy/Modules/RequireEndWithOne.pm | 112 ++ .../Policy/Modules/RequireExplicitPackage.pm | 153 ++ .../Modules/RequireFilenameMatchesPackage.pm | 126 ++ .../Modules/RequireNoMatchVarsWithUseEnglish.pm | 199 +++ .../Critic/Policy/Modules/RequireVersionVar.pm | 176 +++ .../NamingConventions/ProhibitAmbiguousNames.pm | 203 +++ .../NamingConventions/ProhibitMixedCaseSubs.pm | 114 ++ .../NamingConventions/ProhibitMixedCaseVars.pm | 127 ++ .../Policy/References/ProhibitDoubleSigils.pm | 102 ++ .../ProhibitCaptureWithoutTest.pm | 161 ++ .../RegularExpressions/ProhibitComplexRegexes.pm | 190 +++ .../ProhibitEnumeratedClasses.pm | 216 +++ .../ProhibitEscapedMetacharacters.pm | 173 ++ .../ProhibitFixedStringMatches.pm | 177 +++ .../ProhibitSingleCharAlternation.pm | 134 ++ .../RegularExpressions/ProhibitUnusedCapture.pm | 403 +++++ .../ProhibitUnusualDelimiters.pm | 144 ++ .../RequireBracesForMultiline.pm | 162 ++ .../RequireExtendedFormatting.pm | 121 ++ .../RequireLineBoundaryMatching.pm | 111 ++ .../Policy/Subroutines/ProhibitAmpersandSigils.pm | 105 ++ .../Policy/Subroutines/ProhibitBuiltinHomonyms.pm | 112 ++ .../Policy/Subroutines/ProhibitExcessComplexity.pm | 143 ++ .../Subroutines/ProhibitExplicitReturnUndef.pm | 148 ++ .../Critic/Policy/Subroutines/ProhibitManyArgs.pm | 189 +++ .../Policy/Subroutines/ProhibitNestedSubs.pm | 115 ++ .../Subroutines/ProhibitSubroutinePrototypes.pm | 91 ++ .../Policy/Subroutines/ProtectPrivateSubs.pm | 129 ++ .../Policy/Subroutines/RequireArgUnpacking.pm | 242 +++ .../Policy/Subroutines/RequireFinalReturn.pm | 261 +++ .../Policy/TestingAndDebugging/ProhibitNoStrict.pm | 152 ++ .../TestingAndDebugging/ProhibitNoWarnings.pm | 151 ++ .../ProhibitProlongedStrictureOverride.pm | 118 ++ .../TestingAndDebugging/RequireTestLabels.pm | 157 ++ .../Policy/TestingAndDebugging/RequireUseStrict.pm | 155 ++ .../TestingAndDebugging/RequireUseWarnings.pm | 168 ++ .../ProhibitCommaSeparatedStatements.pm | 252 +++ .../ValuesAndExpressions/ProhibitConstantPragma.pm | 98 ++ .../ValuesAndExpressions/ProhibitEmptyQuotes.pm | 110 ++ .../ProhibitEscapedCharacters.pm | 105 ++ .../ProhibitImplicitNewlines.pm | 110 ++ .../ProhibitInterpolationOfLiterals.pm | 172 ++ .../ValuesAndExpressions/ProhibitLeadingZeros.pm | 249 +++ .../ProhibitLongChainsOfMethodCalls.pm | 185 +++ .../ValuesAndExpressions/ProhibitMagicNumbers.pm | 607 +++++++ .../ProhibitMismatchedOperators.pm | 154 ++ .../ProhibitMixedBooleanOperators.pm | 150 ++ .../ValuesAndExpressions/ProhibitNoisyQuotes.pm | 114 ++ .../ProhibitQuotesAsQuotelikeOperatorDelimiters.pm | 300 ++++ .../ValuesAndExpressions/ProhibitVersionStrings.pm | 112 ++ .../RequireInterpolationOfMetachars.pm | 121 ++ .../RequireNumberSeparators.pm | 124 ++ .../RequireQuotedHeredocTerminator.pm | 108 ++ .../RequireUpperCaseHeredocTerminator.pm | 106 ++ .../Variables/ProhibitConditionalDeclarations.pm | 114 ++ .../Critic/Policy/Variables/ProhibitLocalVars.pm | 130 ++ .../Critic/Policy/Variables/ProhibitMatchVars.pm | 125 ++ .../Critic/Policy/Variables/ProhibitPackageVars.pm | 228 +++ .../Policy/Variables/ProhibitPerl4PackageNames.pm | 121 ++ .../Policy/Variables/ProhibitPunctuationVars.pm | 129 ++ .../Policy/Variables/ProhibitUnusedVariables.pm | 158 ++ .../Critic/Policy/Variables/ProtectPrivateVars.pm | 102 ++ .../Variables/RequireInitializationForLocalVars.pm | 116 ++ .../Variables/RequireLexicalLoopIterators.pm | 137 ++ .../Variables/RequireLocalizedPunctuationVars.pm | 186 +++ .../Policy/Variables/RequireNegativeIndices.pm | 254 +++ .../lib/Perl/Critic/PolicyConfig.pm | 314 ++++ .../lib/Perl/Critic/PolicyFactory.pm | 421 +++++ .../lib/Perl/Critic/PolicyListing.pm | 113 ++ .../lib/Perl/Critic/PolicyParameter.pm | 402 +++++ .../lib/Perl/Critic/PolicyParameter/Behavior.pm | 115 ++ .../Critic/PolicyParameter/Behavior/Boolean.pm | 112 ++ .../Critic/PolicyParameter/Behavior/Enumeration.pm | 236 +++ .../Critic/PolicyParameter/Behavior/Integer.pm | 205 +++ .../Perl/Critic/PolicyParameter/Behavior/String.pm | 107 ++ .../Critic/PolicyParameter/Behavior/StringList.pm | 165 ++ .../lib/Perl/Critic/PolicySummary.pod.PL | 154 ++ .../lib/Perl/Critic/ProfilePrototype.pm | 248 +++ .../lib/Perl/Critic/Statistics.pm | 315 ++++ .../lib/Perl/Critic/TestUtils.pm | 542 +++++++ .../lib/Perl/Critic/Theme.pm | 244 +++ .../lib/Perl/Critic/ThemeListing.pm | 124 ++ .../lib/Perl/Critic/UserProfile.pm | 424 +++++ .../lib/Perl/Critic/Utils.pm | 1657 ++++++++++++++++++++ .../lib/Perl/Critic/Utils/Constants.pm | 125 ++ .../lib/Perl/Critic/Utils/DataConversion.pm | 111 ++ .../lib/Perl/Critic/Utils/McCabe.pm | 200 +++ .../lib/Perl/Critic/Utils/POD.pm | 719 +++++++++ .../lib/Perl/Critic/Utils/PPI.pm | 141 ++ .../lib/Perl/Critic/Utils/PPIRegexp.pm | 328 ++++ .../lib/Perl/Critic/Violation.pm | 451 ++++++ .../libperl-critic-perl-1.088/t/00_modules.t | 296 ++++ .../t/01_bad_perlcriticrc | 29 + .../libperl-critic-perl-1.088/t/01_config.t | 407 +++++ .../t/01_config_bad_perlcriticrc.t | 151 ++ .../libperl-critic-perl-1.088/t/01_policy_config.t | 184 +++ .../libperl-critic-perl-1.088/t/02_policy.t | 164 ++ .../libperl-critic-perl-1.088/t/03_pragmas.t | 857 ++++++++++ .../t/04_optionsprocessor.t | 104 ++ .../libperl-critic-perl-1.088/t/05_utils.t | 421 +++++ .../libperl-critic-perl-1.088/t/05_utils_pod.t | 696 ++++++++ .../libperl-critic-perl-1.088/t/05_utils_ppi.t | 280 ++++ .../libperl-critic-perl-1.088/t/06_violation.t | 185 +++ .../libperl-critic-perl-1.088/t/07_perlcritic.t | 192 +++ .../libperl-critic-perl-1.088/t/08_document.t | 130 ++ .../libperl-critic-perl-1.088/t/09_theme.t | 259 +++ .../libperl-critic-perl-1.088/t/10_userprofile.t | 173 ++ .../libperl-critic-perl-1.088/t/11_policyfactory.t | 118 ++ .../libperl-critic-perl-1.088/t/12_policylisting.t | 63 + .../libperl-critic-perl-1.088/t/12_themelisting.t | 62 + .../t/13_bundled_policies.t | 45 + .../t/14_policy_parameter_behavior_boolean.t | 101 ++ .../t/14_policy_parameter_behavior_enumeration.t | 163 ++ .../t/14_policy_parameter_behavior_integer.t | 170 ++ .../t/14_policy_parameter_behavior_list_string.t | 170 ++ .../t/14_policy_parameter_behavior_string.t | 66 + .../t/14_policy_parameters.t | 130 ++ .../libperl-critic-perl-1.088/t/15_statistics.t | 105 ++ .../t/16_roundtrip_defaults.t | 236 +++ .../libperl-critic-perl-1.088/t/20_policies.t | 127 ++ .../t/20_policy_podspelling.t | 147 ++ .../t/20_policy_prohibithardtabs.t | 107 ++ .../t/20_policy_prohibittrailingwhitespace.t | 66 + .../t/20_policy_requireconsistentnewlines.t | 74 + .../t/20_policy_requiretidycode.t | 143 ++ .../libperl-critic-perl-1.088/t/92_memory_leaks.t | 72 + .../libperl-critic-perl-1.088/t/98_pod_syntax.t | 27 + .../libperl-critic-perl-1.088/t/99_pod_coverage.t | 70 + .../t/BuiltinFunctions/ProhibitBooleanGrep.run | 140 ++ .../t/BuiltinFunctions/ProhibitComplexMappings.run | 71 + .../t/BuiltinFunctions/ProhibitLvalueSubstr.run | 55 + .../BuiltinFunctions/ProhibitReverseSortBlock.run | 58 + .../t/BuiltinFunctions/ProhibitSleepViaSelect.run | 71 + .../t/BuiltinFunctions/ProhibitStringyEval.run | 45 + .../t/BuiltinFunctions/ProhibitStringySplit.run | 100 ++ .../t/BuiltinFunctions/ProhibitUniversalCan.run | 34 + .../t/BuiltinFunctions/ProhibitUniversalIsa.run | 34 + .../t/BuiltinFunctions/ProhibitVoidGrep.run | 65 + .../t/BuiltinFunctions/ProhibitVoidMap.run | 64 + .../t/BuiltinFunctions/RequireBlockGrep.run | 48 + .../t/BuiltinFunctions/RequireBlockMap.run | 48 + .../t/BuiltinFunctions/RequireGlobFunction.run | 51 + .../t/BuiltinFunctions/RequireSimpleSortBlock.run | 59 + .../t/ClassHierarchies/ProhibitAutoloading.run | 44 + .../t/ClassHierarchies/ProhibitExplicitISA.run | 34 + .../t/ClassHierarchies/ProhibitOneArgBless.run | 44 + .../t/CodeLayout/ProhibitParensWithBuiltins.run | 138 ++ .../t/CodeLayout/ProhibitQuotedWordLists.run | 67 + .../t/CodeLayout/RequireTrailingCommas.run | 122 ++ .../t/ControlStructures/ProhibitCStyleForLoops.run | 45 + .../ControlStructures/ProhibitCascadingIfElse.run | 91 ++ .../t/ControlStructures/ProhibitDeepNests.run | 139 ++ .../ProhibitLabelsWithSpecialBlockNames.run | 51 + .../ProhibitMutatingListFunctions.run | 133 ++ ...iveExpressionsInUnlessAndUntilConditions.run.PL | 296 ++++ .../ControlStructures/ProhibitPostfixControls.run | 163 ++ .../t/ControlStructures/ProhibitUnlessBlocks.run | 37 + .../ControlStructures/ProhibitUnreachableCode.run | 200 +++ .../t/ControlStructures/ProhibitUntilBlocks.run | 37 + .../Documentation/RequirePackageMatchesPodName.run | 262 ++++ .../t/Documentation/RequirePodAtEnd.run | 131 ++ .../t/Documentation/RequirePodSections.run | 130 ++ .../t/ErrorHandling/RequireCarping.run | 344 ++++ .../RequireCheckingReturnValueOfEval.run | 393 +++++ .../t/InputOutput/ProhibitBacktickOperators.run | 91 ++ .../t/InputOutput/ProhibitBarewordFileHandles.run | 37 + .../t/InputOutput/ProhibitExplicitStdin.run | 59 + .../t/InputOutput/ProhibitInteractiveTest.run | 14 + .../t/InputOutput/ProhibitJoinedReadline.run | 62 + .../t/InputOutput/ProhibitOneArgSelect.run | 39 + .../t/InputOutput/ProhibitReadlineInForLoop.run | 20 + .../t/InputOutput/ProhibitTwoArgOpen.run | 95 ++ .../RequireBracedFileHandleWithPrint.run | 98 ++ .../t/InputOutput/RequireBriefOpen.run | 345 ++++ .../t/InputOutput/RequireCheckedClose.run | 146 ++ .../t/InputOutput/RequireCheckedOpen.run | 148 ++ .../t/InputOutput/RequireCheckedSyscalls.run | 328 ++++ .../t/Miscellanea/ProhibitFormats.run | 31 + .../t/Miscellanea/ProhibitTies.run | 27 + .../t/Miscellanea/RequireRcsKeywords.run | 76 + .../t/Modules/ProhibitAutomaticExportation.run | 97 ++ .../t/Modules/ProhibitEvilModules.run | 66 + .../t/Modules/ProhibitExcessMainComplexity.run | 102 ++ .../t/Modules/ProhibitMultiplePackages.run | 34 + .../t/Modules/RequireBarewordIncludes.run | 35 + .../t/Modules/RequireEndWithOne.run | 109 ++ .../t/Modules/RequireExplicitPackage.run | 109 ++ .../t/Modules/RequireFilenameMatchesPackage.run | 203 +++ .../t/Modules/RequireNoMatchVarsWithUseEnglish.run | 232 +++ .../t/Modules/RequireVersionVar.run | 105 ++ .../t/NamingConventions/ProhibitAmbiguousNames.run | 110 ++ .../t/NamingConventions/ProhibitMixedCaseSubs.run | 30 + .../t/NamingConventions/ProhibitMixedCaseVars.run | 58 + .../t/References/ProhibitDoubleSigils.run | 54 + .../ProhibitCaptureWithoutTest.run | 95 ++ .../RegularExpressions/ProhibitComplexRegexes.run | 75 + .../ProhibitEnumeratedClasses.run | 92 ++ .../ProhibitEscapedMetacharacters.run | 62 + .../ProhibitFixedStringMatches.run | 112 ++ .../ProhibitSingleCharAlternation.run | 54 + .../t/RegularExpressions/ProhibitUnusedCapture.run | 314 ++++ .../ProhibitUnusualDelimiters.run | 89 ++ .../RequireBracesForMultiline.run | 109 ++ .../RequireExtendedFormatting.run | 85 + .../RequireLineBoundaryMatching.run | 84 + .../t/Subroutines/ProhibitAmpersandSigils.run | 39 + .../t/Subroutines/ProhibitBuiltinHomonyms.run | 28 + .../t/Subroutines/ProhibitExcessComplexity.run | 46 + .../t/Subroutines/ProhibitExplicitReturnUndef.run | 38 + .../t/Subroutines/ProhibitManyArgs.run | 105 ++ .../t/Subroutines/ProhibitNestedSubs.run | 33 + .../t/Subroutines/ProhibitSubroutinePrototypes.run | 16 + .../t/Subroutines/ProtectPrivateSubs.run | 29 + .../t/Subroutines/RequireArgUnpacking.run | 202 +++ .../t/Subroutines/RequireFinalReturn.run | 158 ++ .../t/TestingAndDebugging/ProhibitNoStrict.run | 96 ++ .../t/TestingAndDebugging/ProhibitNoWarnings.run | 69 + .../ProhibitProlongedStrictureOverride.run | 79 + .../t/TestingAndDebugging/RequireTestLabels.run | 94 ++ .../t/TestingAndDebugging/RequireUseStrict.run | 161 ++ .../t/TestingAndDebugging/RequireUseWarnings.run | 196 +++ .../ProhibitCommaSeparatedStatements.run | 283 ++++ .../ProhibitConstantPragma.run | 34 + .../t/ValuesAndExpressions/ProhibitEmptyQuotes.run | 52 + .../ProhibitEscapedCharacters.run | 37 + .../ProhibitImplicitNewlines.run | 65 + .../ProhibitInterpolationOfLiterals.run | 83 + .../ValuesAndExpressions/ProhibitLeadingZeros.run | 168 ++ .../ProhibitLongChainsOfMethodCalls.run | 90 ++ .../ValuesAndExpressions/ProhibitMagicNumbers.run | 935 +++++++++++ .../ProhibitMismatchedOperators.run | 61 + .../ProhibitMixedBooleanOperators.run | 76 + .../t/ValuesAndExpressions/ProhibitNoisyQuotes.run | 85 + ...ProhibitQuotesAsQuotelikeOperatorDelimiters.run | 181 +++ .../ProhibitVersionStrings.run | 62 + .../RequireInterpolationOfMetachars.run | 69 + .../RequireNumberSeparators.run | 95 ++ .../RequireQuotedHeredocTerminator.run | 65 + .../RequireUpperCaseHeredocTerminator.run | 54 + .../Variables/ProhibitConditionalDeclarations.run | 106 ++ .../t/Variables/ProhibitLocalVars.run | 46 + .../t/Variables/ProhibitMatchVars.run | 46 + .../t/Variables/ProhibitPackageVars.run | 149 ++ .../t/Variables/ProhibitPerl4PackageNames.run | 259 +++ .../t/Variables/ProhibitPunctuationVars.run | 72 + .../t/Variables/ProhibitUnusedVariables.run | 132 ++ .../t/Variables/ProtectPrivateVars.run | 41 + .../RequireInitializationForLocalVars.run | 53 + .../t/Variables/RequireLexicalLoopIterators.run | 52 + .../RequireLocalizedPunctuationVars.run.PL | 244 +++ .../t/Variables/RequireNegativeIndices.run | 79 + ...erate_without_optional_dependencies_wrappers.PL | 156 ++ .../t/tlib/Perl/Critic/Policy/Test.pm | 34 + .../Critic/TestUtilitiesWithMinimalDependencies.pm | 97 ++ .../t/tlib/ViolationTest.pm | 35 + .../t/tlib/ViolationTest2.pm | 28 + .../libperl-critic-perl-1.088/tools/ppidump | 66 + .../libperl-critic-perl-1.088/tools/svnkeywords | 1 + .../xt/author/40_criticize-code.t | 93 ++ .../xt/author/40_perlcriticrc-code | 37 + .../xt/author/41_criticize-policies.t | 67 + .../xt/author/41_perlcriticrc-policies | 15 + .../xt/author/80_policysummary.t | 96 ++ .../xt/author/93_version.t | 56 + .../xt/author/94_includes.t | 102 ++ .../xt/author/95_kwalitee.t | 21 + .../libperl-critic-perl_1.088-1.diff.gz | Bin 0 -> 2874 bytes .../libperl-critic-perl_1.088-1.dsc | 33 + .../libperl-critic-perl_1.088.orig.tar.gz | Bin 0 -> 367270 bytes 425 files changed, 64645 insertions(+) create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/Build.PL create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/Changes create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/INSTALL create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/LICENSE create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/MANIFEST create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/META.yml create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/Makefile.PL create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/README create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/TODO.pod create mode 100755 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/bin/perlcritic create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/changelog create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/compat create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/control create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/control~ create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/copyright create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/docs create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/examples create mode 100755 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/rules create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/watch create mode 100755 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/examples/generatestats create mode 100755 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/examples/loadanalysisdb create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/examples/perlcriticrc create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/examples/perlcriticrc-conway create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/extras/KomodoIntegration.pod create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/extras/perlcritic.el create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/AIX.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Amiga.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Apple.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/BSDOS.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/BeOS.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Cygwin.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/DEC.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/DGUX.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/DragonflyBSD.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Dynix.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/FreeBSD.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/HPUX.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Interix.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Irix.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Linux.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MPEiX.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MSDOS.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MSWin32.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MacOSX.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MacOSclassic.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MachTen.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MicrosoftWindows.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/NeXT.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/NetBSD.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Netware.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OS2.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OS390.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OS400.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OSF.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OpenBSD.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/POSIXBC.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/RISCOS.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/SCO.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Solaris.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Sun.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/SunOS.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/SysVr4.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/SysVr5.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Unicos.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Unix.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/VMESA.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/VMS.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/VOS.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/CheckOS.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Perl/Critic/BuildUtilities.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Config.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/DEVELOPER.pod create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Document.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/AggregateConfiguration.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Generic.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Global.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Global/ExtraParameter.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Global/ParameterValue.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Policy.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Policy/ExtraParameter.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Policy/ParameterValue.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Fatal.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Fatal/Generic.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Fatal/Internal.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Fatal/PolicyDefinition.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/IO.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Parse.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/OptionsProcessor.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitBooleanGrep.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitComplexMappings.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitLvalueSubstr.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitReverseSortBlock.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitSleepViaSelect.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitStringyEval.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitStringySplit.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitUniversalCan.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitUniversalIsa.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitVoidGrep.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitVoidMap.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/RequireBlockGrep.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/RequireBlockMap.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/RequireGlobFunction.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/RequireSimpleSortBlock.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ClassHierarchies/ProhibitAutoloading.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ClassHierarchies/ProhibitExplicitISA.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ClassHierarchies/ProhibitOneArgBless.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/ProhibitHardTabs.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/ProhibitParensWithBuiltins.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/ProhibitQuotedWordLists.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/ProhibitTrailingWhitespace.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/RequireConsistentNewlines.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/RequireTidyCode.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/RequireTrailingCommas.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitCStyleForLoops.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitCascadingIfElse.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitDeepNests.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitLabelsWithSpecialBlockNames.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitMutatingListFunctions.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitPostfixControls.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitUnlessBlocks.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitUnreachableCode.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitUntilBlocks.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Documentation/PodSpelling.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Documentation/RequirePackageMatchesPodName.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Documentation/RequirePodAtEnd.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Documentation/RequirePodSections.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ErrorHandling/RequireCarping.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ErrorHandling/RequireCheckingReturnValueOfEval.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitBacktickOperators.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitBarewordFileHandles.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitExplicitStdin.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitInteractiveTest.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitJoinedReadline.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitOneArgSelect.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitReadlineInForLoop.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitTwoArgOpen.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireBracedFileHandleWithPrint.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireBriefOpen.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireCheckedClose.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireCheckedOpen.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireCheckedSyscalls.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Miscellanea/ProhibitFormats.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Miscellanea/ProhibitTies.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Miscellanea/RequireRcsKeywords.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Modules/ProhibitAutomaticExportation.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Modules/ProhibitEvilModules.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Modules/ProhibitExcessMainComplexity.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Modules/ProhibitMultiplePackages.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Modules/RequireBarewordIncludes.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Modules/RequireEndWithOne.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Modules/RequireExplicitPackage.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Modules/RequireFilenameMatchesPackage.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Modules/RequireNoMatchVarsWithUseEnglish.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Modules/RequireVersionVar.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/NamingConventions/ProhibitAmbiguousNames.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/NamingConventions/ProhibitMixedCaseSubs.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/NamingConventions/ProhibitMixedCaseVars.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/References/ProhibitDoubleSigils.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/RegularExpressions/ProhibitCaptureWithoutTest.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/RegularExpressions/ProhibitComplexRegexes.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/RegularExpressions/ProhibitEnumeratedClasses.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/RegularExpressions/ProhibitEscapedMetacharacters.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/RegularExpressions/ProhibitFixedStringMatches.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/RegularExpressions/ProhibitSingleCharAlternation.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/RegularExpressions/ProhibitUnusedCapture.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/RegularExpressions/ProhibitUnusualDelimiters.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/RegularExpressions/RequireBracesForMultiline.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/RegularExpressions/RequireExtendedFormatting.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/RegularExpressions/RequireLineBoundaryMatching.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Subroutines/ProhibitAmpersandSigils.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Subroutines/ProhibitBuiltinHomonyms.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Subroutines/ProhibitExcessComplexity.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Subroutines/ProhibitExplicitReturnUndef.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Subroutines/ProhibitManyArgs.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Subroutines/ProhibitNestedSubs.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Subroutines/ProhibitSubroutinePrototypes.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Subroutines/ProtectPrivateSubs.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Subroutines/RequireArgUnpacking.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Subroutines/RequireFinalReturn.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/TestingAndDebugging/ProhibitNoStrict.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/TestingAndDebugging/ProhibitNoWarnings.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/TestingAndDebugging/ProhibitProlongedStrictureOverride.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/TestingAndDebugging/RequireTestLabels.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/TestingAndDebugging/RequireUseStrict.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/TestingAndDebugging/RequireUseWarnings.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitCommaSeparatedStatements.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitConstantPragma.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitEmptyQuotes.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitEscapedCharacters.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitImplicitNewlines.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitInterpolationOfLiterals.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitLeadingZeros.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitLongChainsOfMethodCalls.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitMagicNumbers.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitMismatchedOperators.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitMixedBooleanOperators.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitNoisyQuotes.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitQuotesAsQuotelikeOperatorDelimiters.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitVersionStrings.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ValuesAndExpressions/RequireInterpolationOfMetachars.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ValuesAndExpressions/RequireNumberSeparators.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ValuesAndExpressions/RequireQuotedHeredocTerminator.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ValuesAndExpressions/RequireUpperCaseHeredocTerminator.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Variables/ProhibitConditionalDeclarations.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Variables/ProhibitLocalVars.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Variables/ProhibitMatchVars.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Variables/ProhibitPackageVars.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Variables/ProhibitPerl4PackageNames.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Variables/ProhibitPunctuationVars.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Variables/ProhibitUnusedVariables.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Variables/ProtectPrivateVars.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Variables/RequireInitializationForLocalVars.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Variables/RequireLexicalLoopIterators.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Variables/RequireLocalizedPunctuationVars.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Variables/RequireNegativeIndices.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/PolicyConfig.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/PolicyFactory.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/PolicyListing.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/PolicyParameter.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/PolicyParameter/Behavior.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/PolicyParameter/Behavior/Boolean.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/PolicyParameter/Behavior/Enumeration.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/PolicyParameter/Behavior/Integer.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/PolicyParameter/Behavior/String.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/PolicyParameter/Behavior/StringList.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/PolicySummary.pod.PL create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/ProfilePrototype.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Statistics.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/TestUtils.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Theme.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/ThemeListing.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/UserProfile.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Utils.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Utils/Constants.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Utils/DataConversion.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Utils/McCabe.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Utils/POD.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Utils/PPI.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Utils/PPIRegexp.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Violation.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/00_modules.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/01_bad_perlcriticrc create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/01_config.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/01_config_bad_perlcriticrc.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/01_policy_config.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/02_policy.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/03_pragmas.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/04_optionsprocessor.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/05_utils.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/05_utils_pod.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/05_utils_ppi.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/06_violation.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/07_perlcritic.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/08_document.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/09_theme.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/10_userprofile.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/11_policyfactory.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/12_policylisting.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/12_themelisting.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/13_bundled_policies.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/14_policy_parameter_behavior_boolean.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/14_policy_parameter_behavior_enumeration.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/14_policy_parameter_behavior_integer.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/14_policy_parameter_behavior_list_string.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/14_policy_parameter_behavior_string.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/14_policy_parameters.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/15_statistics.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/16_roundtrip_defaults.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/20_policies.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/20_policy_podspelling.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/20_policy_prohibithardtabs.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/20_policy_prohibittrailingwhitespace.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/20_policy_requireconsistentnewlines.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/20_policy_requiretidycode.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/92_memory_leaks.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/98_pod_syntax.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/99_pod_coverage.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/BuiltinFunctions/ProhibitBooleanGrep.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/BuiltinFunctions/ProhibitComplexMappings.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/BuiltinFunctions/ProhibitLvalueSubstr.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/BuiltinFunctions/ProhibitReverseSortBlock.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/BuiltinFunctions/ProhibitSleepViaSelect.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/BuiltinFunctions/ProhibitStringyEval.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/BuiltinFunctions/ProhibitStringySplit.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/BuiltinFunctions/ProhibitUniversalCan.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/BuiltinFunctions/ProhibitUniversalIsa.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/BuiltinFunctions/ProhibitVoidGrep.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/BuiltinFunctions/ProhibitVoidMap.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/BuiltinFunctions/RequireBlockGrep.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/BuiltinFunctions/RequireBlockMap.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/BuiltinFunctions/RequireGlobFunction.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/BuiltinFunctions/RequireSimpleSortBlock.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ClassHierarchies/ProhibitAutoloading.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ClassHierarchies/ProhibitExplicitISA.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ClassHierarchies/ProhibitOneArgBless.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/CodeLayout/ProhibitParensWithBuiltins.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/CodeLayout/ProhibitQuotedWordLists.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/CodeLayout/RequireTrailingCommas.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ControlStructures/ProhibitCStyleForLoops.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ControlStructures/ProhibitCascadingIfElse.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ControlStructures/ProhibitDeepNests.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ControlStructures/ProhibitLabelsWithSpecialBlockNames.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ControlStructures/ProhibitMutatingListFunctions.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run.PL create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ControlStructures/ProhibitPostfixControls.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ControlStructures/ProhibitUnlessBlocks.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ControlStructures/ProhibitUnreachableCode.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ControlStructures/ProhibitUntilBlocks.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Documentation/RequirePackageMatchesPodName.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Documentation/RequirePodAtEnd.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Documentation/RequirePodSections.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ErrorHandling/RequireCarping.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ErrorHandling/RequireCheckingReturnValueOfEval.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/InputOutput/ProhibitBacktickOperators.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/InputOutput/ProhibitBarewordFileHandles.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/InputOutput/ProhibitExplicitStdin.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/InputOutput/ProhibitInteractiveTest.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/InputOutput/ProhibitJoinedReadline.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/InputOutput/ProhibitOneArgSelect.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/InputOutput/ProhibitReadlineInForLoop.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/InputOutput/ProhibitTwoArgOpen.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/InputOutput/RequireBracedFileHandleWithPrint.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/InputOutput/RequireBriefOpen.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/InputOutput/RequireCheckedClose.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/InputOutput/RequireCheckedOpen.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/InputOutput/RequireCheckedSyscalls.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Miscellanea/ProhibitFormats.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Miscellanea/ProhibitTies.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Miscellanea/RequireRcsKeywords.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Modules/ProhibitAutomaticExportation.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Modules/ProhibitEvilModules.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Modules/ProhibitExcessMainComplexity.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Modules/ProhibitMultiplePackages.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Modules/RequireBarewordIncludes.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Modules/RequireEndWithOne.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Modules/RequireExplicitPackage.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Modules/RequireFilenameMatchesPackage.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Modules/RequireNoMatchVarsWithUseEnglish.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Modules/RequireVersionVar.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/NamingConventions/ProhibitAmbiguousNames.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/NamingConventions/ProhibitMixedCaseSubs.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/NamingConventions/ProhibitMixedCaseVars.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/References/ProhibitDoubleSigils.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/RegularExpressions/ProhibitCaptureWithoutTest.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/RegularExpressions/ProhibitComplexRegexes.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/RegularExpressions/ProhibitEnumeratedClasses.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/RegularExpressions/ProhibitEscapedMetacharacters.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/RegularExpressions/ProhibitFixedStringMatches.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/RegularExpressions/ProhibitSingleCharAlternation.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/RegularExpressions/ProhibitUnusedCapture.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/RegularExpressions/ProhibitUnusualDelimiters.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/RegularExpressions/RequireBracesForMultiline.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/RegularExpressions/RequireExtendedFormatting.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/RegularExpressions/RequireLineBoundaryMatching.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Subroutines/ProhibitAmpersandSigils.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Subroutines/ProhibitBuiltinHomonyms.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Subroutines/ProhibitExcessComplexity.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Subroutines/ProhibitExplicitReturnUndef.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Subroutines/ProhibitManyArgs.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Subroutines/ProhibitNestedSubs.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Subroutines/ProhibitSubroutinePrototypes.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Subroutines/ProtectPrivateSubs.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Subroutines/RequireArgUnpacking.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Subroutines/RequireFinalReturn.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/TestingAndDebugging/ProhibitNoStrict.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/TestingAndDebugging/ProhibitNoWarnings.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/TestingAndDebugging/ProhibitProlongedStrictureOverride.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/TestingAndDebugging/RequireTestLabels.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/TestingAndDebugging/RequireUseStrict.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/TestingAndDebugging/RequireUseWarnings.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/ProhibitCommaSeparatedStatements.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/ProhibitConstantPragma.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/ProhibitEmptyQuotes.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/ProhibitEscapedCharacters.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/ProhibitImplicitNewlines.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/ProhibitInterpolationOfLiterals.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/ProhibitLeadingZeros.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/ProhibitLongChainsOfMethodCalls.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/ProhibitMagicNumbers.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/ProhibitMismatchedOperators.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/ProhibitMixedBooleanOperators.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/ProhibitNoisyQuotes.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/ProhibitQuotesAsQuotelikeOperatorDelimiters.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/ProhibitVersionStrings.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/RequireInterpolationOfMetachars.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/RequireNumberSeparators.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/RequireQuotedHeredocTerminator.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/RequireUpperCaseHeredocTerminator.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Variables/ProhibitConditionalDeclarations.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Variables/ProhibitLocalVars.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Variables/ProhibitMatchVars.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Variables/ProhibitPackageVars.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Variables/ProhibitPerl4PackageNames.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Variables/ProhibitPunctuationVars.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Variables/ProhibitUnusedVariables.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Variables/ProtectPrivateVars.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Variables/RequireInitializationForLocalVars.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Variables/RequireLexicalLoopIterators.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Variables/RequireLocalizedPunctuationVars.run.PL create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Variables/RequireNegativeIndices.run create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/generate_without_optional_dependencies_wrappers.PL create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/tlib/Perl/Critic/Policy/Test.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/tlib/Perl/Critic/TestUtilitiesWithMinimalDependencies.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/tlib/ViolationTest.pm create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/tlib/ViolationTest2.pm create mode 100755 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/tools/ppidump create mode 100755 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/tools/svnkeywords create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/xt/author/40_criticize-code.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/xt/author/40_perlcriticrc-code create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/xt/author/41_criticize-policies.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/xt/author/41_perlcriticrc-policies create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/xt/author/80_policysummary.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/xt/author/93_version.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/xt/author/94_includes.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/xt/author/95_kwalitee.t create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl_1.088-1.diff.gz create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl_1.088-1.dsc create mode 100644 dev/i386/libperl-critic-perl/libperl-critic-perl_1.088.orig.tar.gz diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/Build.PL b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/Build.PL new file mode 100644 index 0000000..c187e6b --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/Build.PL @@ -0,0 +1,178 @@ +####################################################################### +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/Build.PL $ +# $Date: 2008-06-17 14:27:21 -0500 (Tue, 17 Jun 2008) $ +# $Author: clonezone $ +# $Revision: 2450 $ +######################################################################## + +use 5.006001; + +use strict; +use warnings; + +use lib 'inc'; +use lib 't/tlib'; + +use Module::Build; + +use Perl::Critic::BuildUtilities qw< + recommended_module_versions + test_wrappers_to_generate + get_PL_files + dump_unlisted_or_optional_module_versions + emit_tar_warning_if_necessary +>; + +emit_tar_warning_if_necessary(); + + +my $class = Module::Build->subclass( code => <<'END_SUBCLASS' ); + + sub ACTION_test { + my ($self) = @_; + + $self->depends_on('manifest'); + + return $self->SUPER::ACTION_test(); + } + + sub ACTION_authortest { + my ($self) = @_; + + $self->depends_on('build'); + $self->depends_on('manifest'); + $self->depends_on('distmeta'); + + $self->test_files( qw< t xt/author > ); + $self->recursive_test_files(1); + + $self->depends_on('test'); + + return; + } + + sub ACTION_distdir { + my ($self) = @_; + + $self->depends_on('authortest'); + + return $self->SUPER::ACTION_distdir(); + } + +END_SUBCLASS + +my $builder = $class->new( + module_name => 'Perl::Critic', + dist_author => 'Jeffrey Thalhammer ', + dist_abstract => 'Critique Perl source code for best-practices.', + license => 'perl', + dynamic_config => 1, + create_readme => 1, + create_packlist => 1, + sign => 0, + + requires => { + 'B::Keywords' => 1.05, + 'Carp' => 0, + 'Config::Tiny' => 2, + 'English' => 0, + 'Exception::Class' => 1.23, + 'Exporter' => 0, + 'File::Basename' => 0, + 'File::Find' => 0, + 'File::Path' => 0, + 'File::Spec' => 0, + 'File::Spec::Unix' => 0, + 'File::Temp' => 0, + 'Getopt::Long' => 0, + 'IO::String' => 0, + 'List::MoreUtils' => 0, + 'List::Util' => 0, + 'Module::Pluggable' => 3.1, + 'PPI' => 1.203, + 'PPI::Document' => 1.203, + 'PPI::Document::File' => 1.203, + 'PPI::Node' => 1.203, + 'PPI::Token::Quote::Single' => 1.203, + 'PPI::Token::Whitespace' => 1.203, + 'Pod::PlainText' => 0, + 'Pod::Select' => 0, + 'Pod::Usage' => 0, + 'Readonly' => 1.03, + 'Scalar::Util' => 0, + 'String::Format' => 1.13, + 'base' => 0, + 'charnames' => 0, + 'overload' => 0, + 'strict' => 0, + 'version' => 0, + 'warnings' => 0, + 'overload' => 0, + 'strict' => 0, + 'version' => 0, + 'warnings' => 0, + }, + + recommends => { recommended_module_versions() }, + + build_requires => { + 'lib' => 0, + 'Test::More' => 0, + }, + + PL_files => get_PL_files(), + + script_files => ['bin/perlcritic'], + + meta_merge => { + resources => { + homepage => 'http://perlcritic.com', + license => 'http://dev.perl.org/licenses/', + Repository => 'http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/', + MailingList => 'http://perlcritic.tigris.org/servlets/SummarizeList?listName=users', + }, + no_index => { + file => [ + qw< + TODO.pod + lib/Perl/Critic/PolicySummary.pod.PL + > + ], + directory => [ + qw< + doc + > + ], + }, + }, + + add_to_cleanup => [ + qw< + lib/Perl/Critic/PolicySummary.pod + Makefile + Makefile.old + MANIFEST + MANIFEST.bak + META.yml + pm_to_blib + README + t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run + t/Variables/RequireLocalizedPunctuationVars.run + >, + test_wrappers_to_generate(), + ], +); + +$builder->create_build_script(); + +dump_unlisted_or_optional_module_versions(); + +############################################################################## +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/Changes b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/Changes new file mode 100644 index 0000000..467b3fe --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/Changes @@ -0,0 +1,1260 @@ +[1.088] Released on 2008-07-03 + + New Policies + * ErrorHandling::RequireCheckingReturnValueOfEval + + Policy Changes: + * ValuesAndExpressions::ProhibitLeadingZeros now accepts octal numbers + for the Unix permissions argument to chmod, dbmopen, mkdir, sysopen, or + umask, by default. Use the "strict" option to get the old behavior. + RT #31977. + * Due to the consensus at YAPC::NA 2008, + Variables::ProhibitUnusedVariables default severity has been raised to + medium/3. + + Minor Changes: + * The perlcritic "--Version" option is now "--version" in order to act + like the rest of the world. + +[1.087] Released on 2008-06-21 + + Policy Changes: + * CodeLayout::ProhibitParensWithBuiltins no longer complains about + sort(foo(@x)). + * TestingAndDebugging::RequireUseWarnings will not complain about files + that contain a "use 5.005" statement or similar for perls prior to 5.6. + Lesson of the day: computer conferences where you can meet in the real + world can clarify conversations greatly. Good to finally meet you Adam. + * InputOutput::ProhibitTwoArgOpen similarly will not complain if there's + a "use/require 5.005" statement in the file. RT #34385. + + Bug fixes: + * Perl::Critic can now critique a file named "0". However, PPI will give + a parse error until the next version comes out. Fixes RT #36127. + * Moved detection of the lack of any enabled Policies from P::C::Config + to Perl::Critic. This was causing the perlcritic.t in Parrot to fail. + Note, however, there are plans afoot to change how Perl::Critic is + configured and things that depend upon that may break. Please contact + users@perlcritic.tigris.org and tell us how you're using P::C::Config + directly so that we can take your needs into account. + +[1.086] Released on 2008-06-12 + + Policy Changes: + * NamingConventions::ProhibitAmbiguousNames now specifies the name that + it had problems with in its violation descriptions. + + Bug fixes: + * The color option wasn't being correctly set from a .perlcriticrc. + RT #36569. + + Minor changes: + * --colour is now a synonym for --color. + +[1.085] Released on 2008-06-07 + + New Policies: + * Documentation::RequirePackageMatchesPodName + + Policy Changes: + * Variables::ProhibitUnusedVariables detects a few more cases. It's + still very limited, though. + + Bug fixes: + * ControlStructures::ProhibitUnreachableCode didn't notice "until" was an + conditional expression. + + Minor documentation updates. + +[1.084] Released on 2008-05-24 + + New Features: + * perlcritic now supports a --list-themes option. + * You can specify the maximum number of violations you want per Policy + per document. Developers can give a default value for this for a + Policy by overriding default_maximum_violations_per_document(). + See RequireUseStrict and ProhibitMagicNumbers for examples. + + Policy Moved: + * The ValuesAndExpressions::ProhibitMagicNumbers policy has been moved + from Perl::Critic::More into the primary Perl::Critic distribution. + + New Policies: + * Variables::ProhibitUnusedVariables (very dumb, limited initial + implementation.) + * ControlStructures::ProhibitLabelsWithSpecialBlockNames + Contributed by Mike O'Regan. Kickin' ass, Mike. + + Policy Changes: + * ControlStructures::ProhibitUnreachableCode now handles the perl 5.10 + "//" and "err" operators. RT #36080 + * InputOutput::RequireBriefOpen now ignores opens of STDIN, STDOUT, + and STDERR. You're generally trying to make long-lasting global + effects when manipulating these. (RT #35774) + * RegularExpressions::ProhibitUnusualDelimiters now supports an + "allow_all_brackets" option. + * RegularExpressions::RequireBracesForMultiline now supports an + "allow_all_brackets" option. + * TestingAndDebugging::RequireUseStrict now accepts "use Moose::Role" + as equivalent to "use strict". (RT #34838) + * TestingAndDebugging::RequireUseWarnings now accepts "use Moose::Role" + as equivalent to "use warnings". (RT #34838) + * ValuesAndExpressions::ProhibitMagicNumbers now accepts constant + subroutines. + * Variables::ProhibitMatchVars no longer detects "use English;". + This problem is detected in a more clear way by + Modules::RequireNoMatchVarsWithUseEnglish. + * Variables::ProhibitPerl4PackageNames no longer complains about + $'/$POSTMATCH. RT #36059 + * Variables::RequireLocalizedPunctuationVars now allows the use of "my". + RT #33937 + + Bug Fixes: + * No longer falls over if a single file has a parse error. + + New Developer Features: + * If a document specifies a minimum perl version, e.g. "use 5.008003", + P::C::Document::highest_explicit_perl_version() will tell you what it + is. + * The parameter to P::C::Policy::initialize_if_enabled is now a + P::C::PolicyConfig object instead of a hash reference. + + Minor Changes: + * LOTS of documentation updates. + * A few more statistics are emitted by perlcritic with the --statistics + option. + * perlcritic --profile-proto now includes policy abstracts in its + output. + + Prerequisites: + * Now depends upon PPI 1.203. + * New dependency upon version. + +[1.083_006] Released on 2008-05-20 +[1.083_005] Released on 2008-05-19 +[1.083_004] Released on 2008-05-18 +[1.083_003] Released on 2008-05-17 +[1.083_002] Released on 2008-05-17 +[1.083_001] Released on 2008-04-13 + + Changes summarized into 1.084 above. For exact details, see Changes in + 1.083_006 on BackPAN. + +[1.082] Released on 2008-03-08 + + New Features: + * A new metadata system for defining policy parameters/options has been + added. This makes the life of policy authors easier because + configuration validation and parsing can be taken care of + automatically, in most cases. This allows greater integration with + IDEs and allows the perlcritic "--profile-proto" option to produce + better output. + + Note: This change does NOT REQUIRE ANY CHANGES to policies outside of + this distribution; they should continue to work as is. However, use + of this facility can reduce the size of your code and provide the + means for tools to discover more about your policy. If this change + does break any of your policies, please let us know. + + To learn how to take advantage of this facility, read + Perl::Critic::DEVELOPER and look at the source of any of the + configurable policies included in this distribution. + + There is a discussion of the design considerations for this facility in + the source repository under doc/PolicyParameter_Notes.pod. + + * Added support for "criticism-fatal" option in your perlcriticrc + file. This will be used by the criticism pragma to cause execution + to abort if the file contains any violations. + + New Policy: + * Module::RequireNoMatchVarsWithUseEnglish + + Policy Changes: + * Added an allow_last_statement_to_be_comma_separated_in_map_and_grep + option to ValuesAndExpressions::ProhibitCommaSeparatedStatements. + Partial response to http://rt.cpan.org/Public/Bug/Display.html?id=27654. + * ControlStructures::ProhibitPostfixControls gains the ability to have + the flow control statements allowed to be modified. This in response + to RT #29540. + * TestingAndDebugging::RequireUseStrict now accepts "use Moose" as + equivalent to "use strict". + * TestingAndDebugging::RequireUseWarnings now accepts "use Moose" as + equivalent to "use warnings". + + Bug Fixes: + * RT #31281 perlcritic doesn't recognize "#!/bin/env perl" shebang + * Replace usage of Unicode property escapes with POSIX character classes + order to restore 5.6 compatability. + * RT #30388 ValuesAndExpressions::ProhibitVersionStrings complained + about numbered directories in "use lib". + * Fixed handling of badly behaved spelling programs in PodSpelling. + +[1.081_006] Released on 2008-03-02 +[1.081_005] Released on 2007-12-29 +[1.081_004] Released on 2007-12-20 +[1.081_003] Released on 2007-12-16 +[1.081_002] Released on 2007-12-16 +[1.081_001] Released on 2007-12-15 + + Changes summarized into 1.082 above. For exact details, see Changes in + 1.081_006 on BackPAN. + +[1.080] Released on 2007-11-11 + + New Features: + * Allow a "## no critic" statement after a shebang on line 1 of a + file. This allows users to block violations that apply to + whole files and still allow shebangs. + + New Policies: (funded by a Perl Foundation grant) + * InputOutput::ProhibitExplicitStdin + * RegularExpressions::ProhibitFixedStringMatches + * RegularExpressions::RequireBracesForMultiline + * RegularExpressions::ProhibitUnusualDelimiters + * RegularExpressions::ProhibitUnusedCapture + * RegularExpressions::ProhibitComplexRegexes + * RegularExpressions::ProhibitSingleCharAlternation + * RegularExpressions::ProhibitEscapedMetacharacters + * RegularExpressions::ProhibitEnumeratedClasses + * InputOutput::RequireBriefOpen + * InputOutput::RequireCheckedSyscalls + + Other New Policies + * ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions + + Policy Changes: + * Variables::ProhibitConditionalDeclarations now permits you to local-ize + variables in conditional declarations. This makes sense, since + C is actually a variable modifier, rather than a declaration. + Thanks to David Golden for reporting this. + + New Developer Features: + * Perl::Critic::Utils::PPIRegexp encapsulates interaction with + the PPI Regexp token classes. Those classes have very sparse + APIs, so this package hides away the ugly fiddling with PPI + internals. + * Added a new optional_modules parameter for the .run syntax. + + Bug fixes: + * PPI::Structure::List can now contain multiple children, + so P::C::Utils::parse_arg_list() needs to handle it. + + This was done in the process of fixing + http://rt.cpan.org/Ticket/Display.html?id=24924, which was a problem + with TestingAndDebugging::RequireTestLabels. + + * ValuesAndExpressions::ProhibitLongChainsOfMethodCalls wasn't resetting + chain length when it ran into the end of a sub-expression. + + http://rt.cpan.org/Public/Bug/Display.html?id=30040 + + * ValuesAndExpressions::ProhibitCommaSeparatedStatements was reporting + false positives when builtins which accept both no and multiple + arguments were involved. + + http://rt.cpan.org/Public/Bug/Display.html?id=27654 + + Internals: + * Removed all use of Carp in favor of exceptions. + + Prerequisites: + * Now requires PPI 1.201. A number of workarounds for PPI bugs have been + removed. + * New dependency upon Exception::Class. + + Installation: + * Use Devel::CheckOS to see whether Perl::Critic is being installed on + a Solaris system and warn about tar(1) chopping file names off if it + is. + +[1.079_003] Released on 2007-10-22 +[1.079_002] Released on 2007-10-21 +[1.079_001] Released on 2007-10-09 + + Changes summarized into 1.080 above. For exact details, see Changes in + 1.079_003 on BackPAN. + +[1.078] Released on 2007-09-19 + + Restore Perl::Critic::TestUtils::should_skip_author_tests() and + get_author_test_skip_message(). Some Perl::Critic add-on distributions + are using them. + +[1.077] Released on 2007-09-15 + + Note: if you don't have any problems installing Perl::Critic 1.076, there + is no need to upgrade to this version. There are no functionality + changes. This release only contains changes related to installation that + a few people were experiencing. + + Minor changes: + * Removed build-time use of Readonly, again, due to problems some people + were having when trying to compile the code by hand, rather than using + CPAN(PLUS)?. + * Don't run author tests if there's a .svn directory present because + users who grabbed the code from the source repository were executing + them and getting failures. + * Don't generate optional, module-hiding test wrappers if author tests + are not enabled. + + +[1.076] Released on 2007-09-07 + + It appears from reports on the 1.075_001 release that the subroutine + sigils were indeed the problem. Release to the general populace. + + +[1.075_001] Released on 2007-09-06 + + Bug Fixes: + Undo the changes in 1.073 and 1.074. Instead, stop using the subroutine + sigil in import and export lists. It is suspected that the problem lies + with Exporter stripping off ampersands. + +[1.074] Released on 2007-09-04 + + Bug Fixes: + Repeat the Makefile.PL change on + t/generate_without_optional_dependencies_wrappers.PL. + I love CPAN Testers. + +[1.073] Released on 2007-09-04 + + Bug Fixes: + Work around problems with the combination of Exporter & Readonly in + Makefile.PL on some machines. + +[1.072] Released on 2007-09-03 + + Bug Fixes: + * The Makefile generated by Makefile.PL was not syntactically correct + according to some versions of Solaris. Thanks to Diab Jerius + (DJERIUS) for discovery and testing. + * Fixed mis-definition of "quiet" value for the "--profile-strictness" + option. + * Enhanced testing with the absence of optional modules. + +[1.071] Released on 2007-08-24 + + The "Brown Paper Bag" Release + + Bug Fixes: + * Tests would not pass in environments that did not have all optional + dependencies installed. + +[1.07] Released on 2007-08-21 + + New Policies: (funded by a Perl Foundation grant) + * BuiltinFunctions::ProhibitBooleanGrep + * BuiltinFunctions::ProhibitComplexMappings + * Documentation::PodSpelling + * InputOutput::ProhibitJoinedReadline + * Subroutines::ProhibitManyArgs + * Subroutines::RequireArgUnpacking + * ValuesAndExpressions::ProhibitImplicitNewlines + * Variables::RequireLocalizedPunctuationVars + + Other New Policies + * Subroutines::ProhibitNestedSubs + + New Features: + * The "perlcritic --profile-proto" output now includes the "add_themes" + parameter for each policy. + * The perlcritic "--strict-profile" option has been replaced with a + "--profile-strictness" option. This new option takes values of "warn" + (the default), "fatal", and "quiet", which controls what happens with + ignorable problems in a .perlcriticrc file. + + New Developer Features: + * Perl::Critic::Policy now has an overridable initialize_if_enabled() + method which allows a Policy to perform expensive initialization after + it has been determined whether the user has it enabled or not. Also, + this method allows a Policy to say that it should be disabled + regardless of what the user says. + + Actually, use of this method is now encouraged over using a + constructor. + + Other Stuff: + * Now requires the Readonly module in order to be more self-compliant. + +[1.061] Released on 2007-07-24 + + Bug Fixes: + * Fix P::C::Theme-- Exporter in Perl 5.6 does not export import(), so you + must subclass it. *sigh* + * Fix P::C::Config::_validate_and_save_theme()-- eval of an empty string + does not reset $@/$EVAL_ERROR in Perl 5.6. + + Big thanks to Anirvan Chatterjee for identifying and helping debug these + issues. + +[1.06] Released on 2007-06-27 + + New Features: + * perlcritic now emits errors for all the problems it can find for the + global options in the command-line parameters and .perlcriticrc file, + rather than bailing on the first one it encounters. + + * perlcritic now has a "--strict-profile" option which will make warnings + about problems in a profile fatal. + + * perlcritic now has a "--statistics-only" option which suppresses the + display of individual violations and only shows the additional output + produced by the "--statistics" option. + + Feature requests: + * A value for "color" can now be specified in a .perlcriticrc. + http://rt.cpan.org/Ticket/Display.html?id=24877 + + New Policies: + * ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters + As suggested in http://rt.cpan.org/Ticket/Display.html?id=23290. + * ValuesAndExpressions::ProhibitLongChainsOfMethodCalls + * Modules::ProhibitExcessMainComplexity + As suggested in http://rt.cpan.org/Ticket/Display.html?id=24699 + + Minor changes: + * The perlcritic "--profile-proto" option now emits the short names for + policies, rather than the full ones. + + * The "-profileproto" and "-singlepolicy" options have been renamed to + "-profile-proto" and "-single-policy" in order to make the growing + number of command-line options comprehensible. The change of + "singlepolicy" also affects your F<.perlcriticrc> file. + +[1.053] Released on 2007-06-02 + + *DEVELOPMENT RELEASE* + + Bug Fixes: + Fixed bug in 15_statustics.t test script, which caused the build + to fail on machines that don't have Perl::Tidy installed. + +[1.052] Released on 2007-06-01 + + *DEVELOPMENT RELEASE* + + New Features: + * perlcritic now emits a summary about the scanned code when enabled by + the "-statistics" option. + + Policy Enhancements: + * InputOutput::ProhibitBacktickOperators can now be configured to only + check in void contexts. + + Bug Fixes: + * 27073: False positive in RequireUpperCaseHeredocTerminator + * 27065: CodeLayout::ProhibitTrailingWhitespace breaks under Perl 5.6.1 + * 26462: ControlStructures::ProhibitCascadingIfElse pod typo + * ValuesAndExpressions::ProhibitCommaSeparatedStatements was complaining + about multiple values in the list to be iterated over by a foreach loop. + * Corrected PBP page numbers for some policies (Quinn Weaver). + +[1.051] Released on 2007-04-12 + + *DEVELOPMENT RELEASE* + + No new policies. + No particular bug fixes. + + Internals: + * Added several new utility functions to support the StricterSubs distro. + Also, some of the existing functions in Perl-Critic-Utils have + changed in ways that might break your custom policies. + + Miscellanea: + * Updated Emacs plugin (Courtesy Josh ben Jore). + See extras/perlcritic.el for details. + * Added copy of BBEdit plugin (Courtesy of Josh Clark). + See extras/perl_critic_for_bbedit-1_0.zip for details + +[1.05] Released on 2007-03-19 + + Bug Fixes: + * 25557: t/20_policy_prohibittrailingwhitespace.t fails on Perl 5.8.0 + +[1.04] Released on 2007-03-18 + + Bug Fixes: + * 25008: Subroutines::RequireFinalReturn should allow "throw" + * 25085: False Positive - Heredoc terminator must be quoted + * 18423: VERSION check does not notice Readonly::Scalar version + * 25449: Proposal of $VERSION declaration (DUPLICATE) + + New Policies: + * CodeLayout::ProhibitTrailingWhitespace + * ValuesAndExpressions::ProhibitCommaSeparatedStatements + * Variables::ProhibitPerl4PackageNames + + Policy Enhancements: + * Subroutines::RequireFinalReturn can now be configured to recognize + your custom functions that behave like "die" or "exit". + * Documentation::RequirePodSections can be configured to match + Module::Starter:PBP or to really match the PBP book. + +[1.03] Released on 2007-02-13 + + Bug Fixes: + * Fixed a few more problems with the %f, %F, and %r format escapes. + * I forgot to put Conway's perlcriticrc file in the MANIFEST. Sorry. + + Interface Changes: + * Perl::Critic::Utils automatically exports everything. However, + this is deprecated. In the future, you must request your exports. + + Policy Changes: + * Duplicate violations of RequireExcplicitPackage are now squelched, + in the same way as RequireUseStrict and RequireUseWarnings. + +[1.02] Released on 2007-02-11 + + Bug Fixes: + * "undef" incorrectly triggered ProhibitMutatingListFunctions. + * 24876: %f and %F escapes not working in custom "verbose" format strings. + * 24875: Documentation bug in TestingAndDebugging::ProhibitNoStrict + + New Policies: + * InputOutput::RequireCheckedOpen + * InputOutput::RequireCheckedClose + + Other Cool Stuff: + * Added Conway's own suggested Perl::Critic configuration as + examples/perlcriticrc-conway. + + * See the examples/ directory for some neat demonstrations of using + the Perl::Critic API. Contributed by Elliot Shank. + + Interface Changes: + * Perl::Critic::Utils no longer exports anything by default. Policies + outside the distribution will need to specify what exactly they need + from this module. There are a number of tags that can be used in + addition to individual imports. + +[1.01] Released on 2007-01-24 + + PRODUCTION RELEASE: You may now consider the public Perl::Critic + API as "stable." Future minor releases will focus on bug fixes, + new policies, and internal refactoring. + + Bug Fixes: + * Fixed memory leak. This was reported by the Parrot team at + http://rt.perl.org/rt3/Ticket/Display.html?id=41230 + +[0.23] Released on 2007-01-19 + + Bug Fixes: + * 23994: Test 56 in t/05_utils.t of Perl::Critic v0.22 fails + * 24005: test 95 in t/13_bundled_policies fails in 0.22 + + + Groovy New Features: + * Added '%F' to the Violation format specifications. This will + give you just the name of file where the violation occurred + (i.e. without the path). + + * Improved validation of .perlcriticrc file. An invalid + default setting will now cause a fatal exception. A + strange-looking policy name will cause a warning. + + + Interface Changes: + * The syntax for theme expressions has changed. Instead of using + mathematical operators qw(+ * -) you must now use the logical + operators qw(|| && !). See the Perl::Critic docs for more info. + + * The @GLOBALS and @BUILTINS variables are no longer exported by + Perl::Critic::Utils. Use the is_perl_global() and is_perl_builtin() + functions instead. + + * Perl::Critic::Policy::policy_parameters() has bee renamed to + Perl::Critic::Policy::supported_paramters(). This was an + undocumented feature anyway, so it shouldn't affect anyone. + + + Other Internal Changes: + * Perl::Critic now requires B::Keywords v1.05 or newer. + + * A few internal classes have been refactored. As a result, + Set::Scalar is no longer a required dependency. + + +[0.22] Released on 2006-12-15 + + New Features: + * Introduced named severity levels: gentle, stern, harsh, cruel, brutal + You can use these named levels instead of the numeric ones. + For example: "perlcritic --severity=cruel MyModule.pm" + Or just: "perlcritic --cruel MyModule.pm" + + * For perlcritic, the "-List" option has been renamed to + "-profileproto". The output now includes the names of the + parameters that each Policy supports, if any. + + * Improved validation of Policy parameters in your F<.perlcriticrc> + Any invalid parameter now causes a fatal exception. + + Major Changes: + * Reassigned themes for most policies. Now there are fewer + themes and they are organized around programming concepts + instead of severity levels. If you have assigned your own + themes to any Policies, they should still work as expected. + + Policy Changes: + * ErrorHandling::RequireCarping will not complain if it can figure + out that the die or warn message will always end in a newline + ("\n"). The idea is that, if you put the newline there, you + don't indend for there to be any file/line/stack information + emitted, in which case you really don't want carp/croak. + + You can restore the old strict behavior by giving the policy + a false value for "allow_messages_ending_with_newlines" in your + configuration. + + Misc Changes: + + Added single-letter uppercase alternatives for some perlcritic options. + +[0.21_01] Released on 2006-12-03 + + New Policies: + * TestingAndDebugging::ProhibitProlongedStrictureOverride + * ControlStructures::ProhibitMutatingListFunctions + + New Features: + * Say "perlcritic -List" to get an expanded listing of all Policies. + The format is suitable for use as your .perlcriticrc file. + * Say "perlcritic -doc PATTERN" to get the documentation for all + Policies that match m/PATTERN/imx. This is a little easier than + typing in the full name of the Policy module with "perldoc". + * Say "perlcritic --singlepolicy PATTERN" to use one and only one + policy. + * Can now specify exceptions to Variables::ProhibitPackageVars, + for packages like File::Find that only interface through + package variables. + + Bug Fixes: + * 21713 false positive for parens used with substr and unpack. + * 22890 allow Rcs keywords in POD. + + Internals: + * Testing system overhauled. Details on the Policy/subtest + framework is in t/run.t. + * Added Perl::Critic::Utils::words_from_string. This is safer + than plain old C. + +[0.21] Released on 2006-11-05 + + New Policies: + * BuiltinFunctions::ProhibitReverseSortBlock + * BuiltinFunctions::ProhibitVoidGrep + * BuiltinFunctions::ProhibitVoidMap + * CodeLayout::RequireConsistentNewlines + * Modules::RequireFilenameMatchesPackage + * TestingAndDebugging::RequireTestLabels + * ValuesAndExpressions::ProhibitMismatchedOperators + + New Features: + * Introduced policy "themes." Themes are arbitrary names that can + be used to identify a group of related Policies. You can select + your favorite policies by combining themes in a mathematic expression + such as "pbp * (danger + risky)". See POD for details. + * perlcritic output is colorized if you have Term::ANSIColor. This + only works on non-Win32 platforms. Use -nocolor switch to disable. + * Say "perlcritic -count" to get just the the total number of + violations per file. Use this feature to quickly identify hot-spots. + * Use the -only switch to choose only from policies mentioned in your + .perlcriticrc file. This is useful if you usually only want to + work with a small subset of the policies. + * Default values for most of the perlcritic and Perl::Critic options + can now be defined in your .perlcriticrc file. See POD for details. + + Bug Fixes: + * 21236: wrong page number for "printing to filehandles" + * 21916: File handle ... wrong page reference in PBP [DUPE] + * 21714: false positive for capture var used in ternary condition + * 21718: No skip for File::Slurp in includes.t + * ProhibitBarewordFilehandles doesn't complain if you open + STDIN, STDOUT or STDERR. + * Parrot 40564: Subroutines::RequireFinalReturn should allow die, + exit, etc. + * Each "for" and "foreach" loop now adds one point to the McCabe + complexity score. + + Other Stuff: + * The internals of Perl::Critic have been significantly refactored, + but should still be compatible with existing third-party Policies. + * Added author-only tests to the release, but disabled by default + * New Perl::Critic::Utils::shebang_line() method + * Support for filename-based policies + * Additional prerequisite: Set::Scalar + * Now requires PPI version 1.118 + +[0.20] Released on 2006-09-10 + + Perl::Critic now requires PPI version 1.117, which fixes + several bugs that were introduced in version 1.116. + + Bug Fixes: + * 21079: grep clears @SITE_POLICIES + * 21352: Test failures with PPI 1.117 + * 11365: sub DESTROY detected as a builtin homonym + +[0.19] Released on 2006-08-20 + + New Policies: + * BuiltinFunctions::ProhibitStringySplit + * ControlStructures::ProhibitDeepNests + * RegularExpressions::ProhibitCaptureWithoutTest + * Variables::RequireLexicalLoopIterator + + New Features: + * "perlcritic -quiet" suppresses the "source OK" message. + * Variables::ProhibitPunctuationVars is now configurable. + + Bug Fixes: + * 20965: "Hard tabs used at" shouldn't check __DATA__ + * 21070: ProhibitNoisyQuotes hates overload + * Punctuation variables are now exempt from ProhibitLocalVars + + Other Stuff: + * Test coverage is now over 95% + +[0.18_01] Released on 2006-08-06 + + New Policies: + * Variables::RequireNegativeIndices + * InputOutput::ProhibitInteractiveTest + * ErrorHandling::RequireCarping + + Bug Fixes: + * RequireTidyCode tests fail if user has custom .perltidyrc file + * 20612: RequirePerlTidy was ignoring HEREDOCs + * 20659: __END__ statement considered "unreachable" + * Fix for PPI::XS (no C support) + * Support for 'goto' in ProhibitAmpersandSigils and + Subroutines::RequireFinalReturn + + Performance Enhancements: + * Introduced Perl::Critic::Document class. This is a facade for + PPI::Document which internally caches search results. This + reduces the running time by about 35%. The facade should be + invisible, unless you are doing something really sneaky. + * Extraction of the 'diagnostics' information is postponed + until it is really needed. Speedup has not been measured. + * Calls to helper-subs have been reordered for maximum efficiency. + + Other Cool Stuff: + * Includes updated version of perlcritic mode for emacs. See + "extras/perlcritic.el" for details. + +[0.18] Released on 2006-07-16 + + Bug Fixes: + * 14855: Home discovery is dangerously naive. + * 20060: Incorrect page numbers in ProhibitLeadingZeros + and RequireNumberSeparator policies. + * 20068: .perlrc file - inconsistent documentation + * 20254: "use vars qw(@EXPORT_OK)" not recognized + * 20463: No-case heredoc terminator incorrectly detected as lower case. + * ProhibitOneArgBless doesn't understand "bless {} => $class;" + * ProhibitExcessComplexity doesn't count 'while' and 'until' stmnts + * ProhibitLeadingZeros was falsely hits '.0456' + + Enhancements: + * If File::HomeDir is available, we use it to locate the + .perlcriticrc file. This should help make Perl::Critic + more portable to Win32 platforms. If File::HomeDir is + not installed, we resort to looking at the usual + environment variables. + + Other Stuff: + * Added "perlcritic.el", which is a super-cool emacs minor-mode + that runs perl-critic on the current buffer and returns the + results in a sexy hot-linked "compiler" window. You can run + it on demand, or have it run automatically every time you + save the buffer. You can find this in the extras/ directory. + Thanks to Josh ben Jore for contributing this. + + * Moved "Perl::Critic::TestUtils" into the installed build. This + module is only used for unit-testing Perl::Critic, but we + are putting it in the installation so folks who want to + extend Perl::Critic can make use of it. + +[0.17] Released on 2006-06-13 + + Bug Fixes: + * 19836: Perl-Critic0.16 fails tests during install. This was + caused by a bug in version 3.01 of Module::Pluggable. See + http://rt.cpan.org/Ticket/Display.html?id=19857 for details. + * Fixed bug in no-critic pragma parser. + + New Policies: + * ValuesAndExpressions::ProhibitEscapedCharacters + * BuiltinFunctions::RequireSimpleSortBlock + + Enhancements: + * Perl::Critic can export critique() as a static function. This + may appeal to folks who dislike the object-oriented interface. + +[0.16] Released on 2006-05-14 + + Enhancements: + * Perl::Critic->critique() now accepts a PPI::Document as the + argument. This feature creates an additional dependency on + Scalar::Util, but that shouldn't be a problem because it is + included with List::Util, which we already use. + + Miscellanea: + * Increased PPI dependency from v1.110 to v1.112 + +[0.15_03] Released on 2006-05-07 + + Bug Fixes: + * The "## no critic" feature is now implemented without eval-ing + the code. This keeps Perl::Critic pure and safe :) + * 19082: Page number for AUTOLOAD is incorrect + + New Policies: + * ControlStructures::ProhibitUnreachableCode (by Peter Guzis) + * Modules::ProhibitAutomaticExportation + * ValuesAndExpressions::ProhibitVersionStrings + +[0.15_02] Released on 2006-04-26 + + Bug Fixes: + * Reimplemented the '##no critic' pragmas to have effect on the + line where the violation is reported, not on the line where + the candidate element lives. This is because some policies + may report violations that are nowhere near the element that + is being evaluated. + * RequireUseStrict, RequireUseWarnings, and RequireExplcitPackage + all emit violations for _every_ statement that violates the + Policy. This closes a loophole that allowed you to circumvent + the Policy by using '## no critic' on just the first statement + that violated the policy. + * Fixed the workaround for the magic shebang that is inserted + by EU::MM and M::B. This had stopped working around version 13. + * Fixed -noprofile option on 'perlcritic'. This also had stopped + working at some point. + +[0.15_01] Released on 2006-04-16 + + Enhancements: + * Added diagnostic messages if the .perlcriticrc contains entries + for Policy modules that don't seem to exist. + * Now you can specify which policies to disable with the + "## no critic" pseudo-pragmas. This feature is still + experimental. See docs for details. + * perlcritic's directory searching now skips backup files, such + as *.swp, *.bak and *~. It also ignores version control system + directories, and the blib directory in module build directories. + + Bug Fixes: + * 18386: Bad example in POD for Documentation::RequirePodSections + * 18670: Test failure if Perl::Tidy is not installed + * 18698: Policy idea ProhibitUniversalFunctions (see New Policies) + * RequireInterpolationOfMetachars falsely hit strings like 'foo=s@' + which are commonly used with Getopt::Long. + + New Policies: + * BuiltinFunctions::ProhibitUniversalCan (by Chris Dolan) + * BuiltinFunctions::ProhibitUniversalIsa (by Chris Dolan) + + Miscellanea: + * All spurrious options for `perlcritic` are now fatal. + * Changed several of the -verbose formats to be more readable. + * Explicit -severity option now overrides -[12345] shortcuts instead + of being the other way around. + + + +[0.15] Released on 2006-03-26 + + Bug Fixes: + * 17964: Insists my code is not tidy (may not be fixed for all cases) + +[0.14_02] Released on 2006-03-19 + + Bug Fixes: + * 15653: False positive in OneArgSelect (fixed for real this time) + + New Policies: + * ClassHierarchies::ProhibitAutoloading + * Documentation::RequirePodSections + * InputOutput::RequireBracedFileHandleWithPrint + * ValuesAndExpressions::ProhibitMixedBooleanOperators + * Variables::RequireInitializationForLocalVars + +[0.14_01] Released on 2006-03-05 + + Bug Fixes: + * 14731: False positive: Builtin function called with parens + * 17554: False positive in CodeLayout::RequireTrailingCommas + + New Policies: + * ClassHierarchies::ProhibitExplicitISA + * InputOutput::ProhibitReadlineInForLoop + * Miscellanea::ProhibitFormats + * Miscellanea::ProhibitTies + * Variables::ProhibitConditionalDeclarations + +[0.14] Released on 2006-01-29 + + More documentation edits. + + New Policies: + * Documentation::RequirePodAtEnd + * Subroutines::ProtectPrivateSubs + * Variables::ProhibitMatchVars + * Variables::ProtectPrivateVars + + Bug Fixes: + * 15295: "## no critic" pragmas too aggresive on compound statements. + * t/01_config.t failed in the presence of third-party policies + +[0.13_05] Not released + + More documentation edits. + + Implemented workaround for failing pod_coverage tests. + + Bug Fixes: + * 16906: tr/// created false-postives with RegularExpression polices. + +[0.13_04] Released on 2005-12-31 + + Moved DEVELOPER.pod file into the Perl/Critic dir. + + More documentation edits. + +[0.13_03] Released on 20051230 + + perlcritic now prints 'source OK' if it doesn't find any + violations. This gives folks a warm fuzzy feeling. + + Tweaked some test cases that were failing on my Solaris + environment at work. + +[0.13_02] Released on 2005-12-29 + + Fixed Config to recognize fully-qualified module names in the + .perlcriticrc file. + + Various documentation edits. + +[0.13_01] Released on 2005-12-28 + + Replaced 'priority' concept with 'severity'. Now each Policy module + has a predefined severity level ranging from 1 to 5. By default, + perlcritic only reports the most severe violations. You can adjust + the severity threshold at the command line, and you can change + the severity for any Policy using the config file. + + Chris implemented the applies_to() mechanism, which allows each Policy + class to declare the types of PPI elements that it wants to examine. + When traversing the document, Perl::Critic invokes the Policy only + for elements that are of the correct type. This improves performance + by about 33%. + + Perl::Critic now uses a Plugin architecture to automatically + discover Policy modules. So if you have custom Policies, all you + have to do is install them in the Perl::Critic::Policy namespace -- + no need to add anything to your .perlcriticrc file. If you write + policies in a different namespace, you can configure that too. See + the Perl::Critic::Config docs for details. + + New Policies: + * Modules::RequireEndWithOne + * NamingConventions::ProhibitAmbiguousNames + * References::ProhibitDoubleSigils + * Subroutines::RequireFinalReturn + * Subroutines::ProhibitAmpersandSigils + * Subroutines::ProhibitExcessComplexity + * TestingAndDebugging::ProhibitNoStrict + * TestingAndDebugging::ProhibitNoWarnings + + Bug Fixes: + * 15101: Plugin architecture improves support for 3rd-party code + * 16319: Fixed incorrect PBP page number in ProhibitBarwordFilehandle + * 16321: Lists of empty quotes are now allowed by ProhibitQuotedWordLists + * 16288: Empty lists caused a fatal error RequireTrailingCommas + * 15653: Fixed false positive in OneArgSelect. + +[0.13] Released on 2005-10-31 + + Official release of 0.12_03. No code major changes. + +[0.12_03] Not released + + Renamed -Policy option to -include. Added -exclude to give the + opposite effect. + + Refactored constructor of Perl::Critic. Now, most of the work + is delegated to Perl::Critic::Config. I'm not sure I like how + this turned out, but we'll see how it goes. + + Renamed some Policy modules to be a bit more comprehensible. Note + that you may need to change your .perlcriticrc file accordingly. + I also suggest removing your current Perl::Critic installation + before installing this one. + + Name Changes: + * ProhibitUnpackagedCode => RequireExplicitPackage + * RequireQuotedWords => ProhibitQuotedWordLists + + Improved error message when Perl::Critic dies because PPI can't + parsee the input code. + + Changed output of -help to be more terse. + + Edited POD. + +[0.12_02] Not released + + Added -Policy option to perlcritic. The idea is to provide a + compact interface for selecting Policy modules at the command-line. + This feature is experimental and subject to change. + + Added a warning message if -verbose value looks strange. In most + applications, the -verbose option does not require a value, so people + might be puzzled when they write 'perlcritic -verbose my_file.pm' and + nothing seems to happen. + + Command-line options to perlcritic are now case-sensitive. This + makes it easier to abbreviate options that start with the same letters + (e.g. 'Version' and 'verbose') + + Fixed the new Policy modules that were misnamed and misplaced in the + previous distribution. + +[0.12_01] Not released + + Rewrote some of the ControlStructures and BuiltinFunction + policies to be simpler (and probably a little faster). + + Edited POD. Fixed some typos. Added PREREQUISITES section + to Perl::Critic documentation. + + Fixed the -verbose FORMAT option so that you can put metachars + in the FORMAT specification. If using perlcritic, be careful to + protect them from getting munged by the shell first. + + Replaced ProhibitRequireStatements with RequireBarewordIncludes + module. Courtesy of Chris Dolan + + Added configuration to ProhibitInterpolationOfLiterals so that + certain flavors of quotes can be exempt. This is for folks who + have configured their editor to use special syntax highlighting + for certain kinds of strings (SQL, for example). + + perlcritic now accepts multiple file arguments, so now you can + critique your entire distribution in one shot. As a result, the + output-formats have changed slightly. + + New Policy modules: + * BuiltinFunctions::ProhibitLvalueSubstr + * BuiltinFunctions::ProhibitSleepViaSelect + * ClassHierarchies::ProhibitOneArgBless + * CodeLayout::RequireTrailingCommas + * CodeLayout::RequireQuotedWordLists + * InputOutput::ProhibitTwoArgOpen + * InputOutput::ProhibitOneArgSelect + * InputOutput::ProhibitBarewordFileHandles + * Miscellanea::RequireRcsKeywords + * Modules::RequireVersionVar + * RegularExpressions::RequireExtendedFormatting + * RegularExpressions::RequireLineBoundaryMatching + + + Bug fixes: + 14923: 'require' is now permitted. See RequireBarewordIncludes. + 15022: Fixed false-positives when keywords are used as hash keys. + 15023: Fixed spurious Violations by removing magic shebang. + 15031: Fixed spelling mistakes (and probably added some new ones). + 15233: Postfix 'if' is now allowed with 'die', 'croak', etc. + +[0.12] Released 2005-10-10 + + Redesigned the 'verbose' feature. Now the output format + can be user-defined using a sprintf-like specification. + perlciritc also has a predefined output format that is + compatible with grep mode in editors like vim and emacs. + + 'return' is now exempt from ProhibitParensWithBuiltins. I may + extend this exemption to all unary functions. + + Edited POD. Added a super brief description of each policy + in the main Perl::Critic documentation. Added details about + editor integration. + + Additional Prerequisites: + * String::Format + +[0.11] Not released + + The internal dynamics and API of Perl::Critic have changed + considerably. The result is a 300% increase in performance. + See the POD in Perl::Critic::Policy for details. + + New Features: + * Added -verbose option to put more stuff in the output. In the + extreme, you can get the POD from Policy attached to each + and every violation. + + Additional Prerequisites: + * IO::String + * Pod::PlainText + +[0.10] Released 2005-10-05 + + Fixed stupid bug in newest Policy modules. They were returning + PPI objects instead of Perl::Critic::Violation objects. Doh! + + Fixed test scripts to prevent failures if the user already has a + .perlcriticrc file. + + 'ProhibitHardTabs' now allows leading tabs by default. + + Put the Changes file in reverse-chronological order, so the most + recent stuff is easy to find at the top of the file + +[0.09] Released 2005-10-04 + + Fixed several bugs: + * 14810: Now you are allowed to create your own 'import' function, + since this is frequently done with fancy modules. + * 14817: Parens, brackets, and braces are now excluded from + 'ProhibitNoisyQuotes' since they look better in quotes anyway. + * 14787: $1..$9 and '_' are exempt from ProhibitPunctuationVars + * 14899: Object methods with the same name as a built-in can + be called with parens (ProhibitParensWithBuiltins). + * 14901: Normalized the exit status of perlcritic to 0, 1, or 2. + See documentation for explanation. + * 14855: Partially fixed home directory discovery. Still not + completely portable, but at least doesn't create warnings. + + New features: + * 14734: Limit for number separators is now configurable + + New Policy modules: + * CodeLayout::ProhibitHardTabs + * ControlStructures::ProhibitUnlessBlocks + * ControlStructures::ProhibitUntilBlocks + * ControlStructures::ProhibitCStyleForLoops + + Changed the syntax for the magic comments. Adam had the + idea of using a pragma-like notation. I liked it. + +[0.08_2] Released 2005-09-27 + + Fixed problems with Perl::Critic::Config that caused File::Spec + to emit 'uninitialized value' warnings during the build. + + Added 1 Policy module contributed by Graham TerMarsch + + Switched from File::Spec::Functions to plain File::Spec because + I think its usage is more common. + + Removed 'FindBin' from the test files so I can be sure that the + right libraries are getting loaded. This means I'll have to + use the -l option with C. + + Edited more POD. + +[0.08_01] Not released + + Fixed "ProhibitParensWithBuiltins" to allow parens to be used with + object method calls that have the same name as a builtin functions. + + Introduced magical comments that allow developers to configure + Perl::Critic on-the-fly from within their code. + + Added META.yml files and POD tests to the build. I did this + mostly just to boost the Kwalitee score on CPANTS. + + Switched from "Config::Std" to "Config::Tiny" because it doesn't + require those fancy Damian modules that don't seem to work on + some older versions of Perl. + +[0.07] Released on 2005-09-21 + + Fixed bugs in the ProhibitCascadingIfElse policy. + + Added ProhibitExplicitReturnUndef policy + + Made ProhibitUnpackagedCode configurable so you can exempt scripts, + which typically don't have an explicit 'package' statement. + + ProhibitPackageVars policy now exempts vars in ALL_CAPS. This + is to permit common package variables like @EXPORT and $VERSION. + + Renamed "ProhibitStringyGrep and "ProhibitStringyMap" because + the so-called string form doesn't really exist. Now called + "RequireBlockGrep" and "RequireBlockMap" + + Corrected documentation on defining Policy names within the + configuration file. This still isn't very clear and needs + to be rewritten. + + Perl::Critic now requires PPI version 1.003, which has a few bug + fixes of its own. + + Rewrite some code just to make Perl::Critic more self-compliant. + + Added test cases to verify the configuration functionality. These + are not completely thorough and need more work. + +[0.06] Released on 2005-09-17 + + Now called 'Perl::Critic'. + + Added 4 new policy modules. + + Fixed bugs in build process. + + Added support for Module::Build. + +[0.05] Released on 2005-09-17 + + End of 'Perl::Review' releases. I have changed the name to + 'Perl::Critic' to avoid possible confusion with "The Perl Review" + magazine. + +[0.04] Released on 2005-09-14 + + Version 0.03 was a bust because I uploaded the wrong tarball to PAUSE. + +[0.03] Released on 2005-09-13. + + Fixed some POD links. + + Removed test cases for missing policy module. + +[0.02] Released on 2005-09-13. + + Major overhaul based on feedback from Perl community. + + Factored coding standards into separate modules (known as + Policies). The idea here is to allow other developers to easily + contribute additional coding standards. + + Reworked Perl::Review into a simple engine for loading and running + Policy modules. + + Gave perlreview a command-line interface and configuration file + for selecting which Policy modules to use. + +[0.01] Released on 2005-08-16. + + Initial version. + +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/Changes $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +# ex: set ts=8 sts=4 sw=4 tw=78 ft= expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/INSTALL b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/INSTALL new file mode 100644 index 0000000..6c7d522 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/INSTALL @@ -0,0 +1,35 @@ +####################################################################### +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/INSTALL $ +# $Date: 2007-07-25 10:34:04 -0500 (Wed, 25 Jul 2007) $ +# $Author: clonezone $ +# $Revision: 1790 $ +######################################################################## + +NOTICE + + The Perl::Critic distribution contains a fairly large number + of modules. And since it is still developing rapidly, some + of those modules may disappear or be renamed fron one release + to the next. Therefore, I suggest removing any existing + installation of Perl::Critic before installing a new one. + +INSTALLATION + + To install Perl::Critic with C give the following + commands to your favorite shell: + + tar -zxf Perl-Critic-1.061.tar.gz + cd Perl-Critic-1.061 + perl Makefile.PL + make + make test + make install + + Or if you prefer C, try this: + + tar -zxf Perl-Critic-1.061.tar.gz + cd Perl-Critic-1.061 + perl Build.pl + ./Build + ./Build test + ./Build install diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/LICENSE b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/LICENSE new file mode 100644 index 0000000..691d481 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/LICENSE @@ -0,0 +1,377 @@ +Terms of Perl itself + +a) the GNU General Public License as published by the Free + Software Foundation; either version 1, or (at your option) any + later version, or +b) the "Artistic License" + +---------------------------------------------------------------------------- + +The General Public License (GPL) +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, +Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute +verbatim copies of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share +and change it. By contrast, the GNU General Public License is intended to +guarantee your freedom to share and change free software--to make sure the +software is free for all its users. This General Public License applies to most of +the Free Software Foundation's software and to any other program whose +authors commit to using it. (Some other Free Software Foundation software is +covered by the GNU Library General Public License instead.) You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom +to distribute copies of free software (and charge for this service if you wish), that +you receive source code or can get it if you want it, that you can change the +software or use pieces of it in new free programs; and that you know you can do +these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny +you these rights or to ask you to surrender the rights. These restrictions +translate to certain responsibilities for you if you distribute copies of the +software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a +fee, you must give the recipients all the rights that you have. You must make +sure that they, too, receive or can get the source code. And you must show +them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer +you this license which gives you legal permission to copy, distribute and/or +modify the software. + +Also, for each author's protection and ours, we want to make certain that +everyone understands that there is no warranty for this free software. If the +software is modified by someone else and passed on, we want its recipients to +know that what they have is not the original, so that any problems introduced by +others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish +to avoid the danger that redistributors of a free program will individually obtain +patent licenses, in effect making the program proprietary. To prevent this, we +have made it clear that any patent must be licensed for everyone's free use or +not licensed at all. + +The precise terms and conditions for copying, distribution and modification +follow. + +GNU GENERAL PUBLIC LICENSE +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND +MODIFICATION + +0. This License applies to any program or other work which contains a notice +placed by the copyright holder saying it may be distributed under the terms of +this General Public License. The "Program", below, refers to any such program +or work, and a "work based on the Program" means either the Program or any +derivative work under copyright law: that is to say, a work containing the +Program or a portion of it, either verbatim or with modifications and/or translated +into another language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered by +this License; they are outside its scope. The act of running the Program is not +restricted, and the output from the Program is covered only if its contents +constitute a work based on the Program (independent of having been made by +running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as +you receive it, in any medium, provided that you conspicuously and appropriately +publish on each copy an appropriate copyright notice and disclaimer of warranty; +keep intact all the notices that refer to this License and to the absence of any +warranty; and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may at +your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus +forming a work based on the Program, and copy and distribute such +modifications or work under the terms of Section 1 above, provided that you also +meet all of these conditions: + +a) You must cause the modified files to carry prominent notices stating that you +changed the files and the date of any change. + +b) You must cause any work that you distribute or publish, that in whole or in +part contains or is derived from the Program or any part thereof, to be licensed +as a whole at no charge to all third parties under the terms of this License. + +c) If the modified program normally reads commands interactively when run, you +must cause it, when started running for such interactive use in the most ordinary +way, to print or display an announcement including an appropriate copyright +notice and a notice that there is no warranty (or else, saying that you provide a +warranty) and that users may redistribute the program under these conditions, +and telling the user how to view a copy of this License. (Exception: if the +Program itself is interactive but does not normally print such an announcement, +your work based on the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Program, and can be reasonably +considered independent and separate works in themselves, then this License, +and its terms, do not apply to those sections when you distribute them as +separate works. But when you distribute the same sections as part of a whole +which is a work based on the Program, the distribution of the whole must be on +the terms of this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights to +work written entirely by you; rather, the intent is to exercise the right to control +the distribution of derivative or collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program with the +Program (or with a work based on the Program) on a volume of a storage or +distribution medium does not bring the other work under the scope of this +License. + +3. You may copy and distribute the Program (or a work based on it, under +Section 2) in object code or executable form under the terms of Sections 1 and 2 +above provided that you also do one of the following: + +a) Accompany it with the complete corresponding machine-readable source +code, which must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange; or, + +b) Accompany it with a written offer, valid for at least three years, to give any +third party, for a charge no more than your cost of physically performing source +distribution, a complete machine-readable copy of the corresponding source +code, to be distributed under the terms of Sections 1 and 2 above on a medium +customarily used for software interchange; or, + +c) Accompany it with the information you received as to the offer to distribute +corresponding source code. (This alternative is allowed only for noncommercial +distribution and only if you received the program in object code or executable +form with such an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for making +modifications to it. For an executable work, complete source code means all the +source code for all modules it contains, plus any associated interface definition +files, plus the scripts used to control compilation and installation of the +executable. However, as a special exception, the source code distributed need +not include anything that is normally distributed (in either source or binary form) +with the major components (compiler, kernel, and so on) of the operating system +on which the executable runs, unless that component itself accompanies the +executable. + +If distribution of executable or object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the source +code from the same place counts as distribution of the source code, even though +third parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as +expressly provided under this License. Any attempt otherwise to copy, modify, +sublicense or distribute the Program is void, and will automatically terminate +your rights under this License. However, parties who have received copies, or +rights, from you under this License will not have their licenses terminated so long +as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. +However, nothing else grants you permission to modify or distribute the Program +or its derivative works. These actions are prohibited by law if you do not accept +this License. Therefore, by modifying or distributing the Program (or any work +based on the Program), you indicate your acceptance of this License to do so, +and all its terms and conditions for copying, distributing or modifying the +Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), +the recipient automatically receives a license from the original licensor to copy, +distribute or modify the Program subject to these terms and conditions. You +may not impose any further restrictions on the recipients' exercise of the rights +granted herein. You are not responsible for enforcing compliance by third parties +to this License. + +7. If, as a consequence of a court judgment or allegation of patent infringement +or for any other reason (not limited to patent issues), conditions are imposed on +you (whether by court order, agreement or otherwise) that contradict the +conditions of this License, they do not excuse you from the conditions of this +License. If you cannot distribute so as to satisfy simultaneously your obligations +under this License and any other pertinent obligations, then as a consequence +you may not distribute the Program at all. For example, if a patent license would +not permit royalty-free redistribution of the Program by all those who receive +copies directly or indirectly through you, then the only way you could satisfy +both it and this License would be to refrain entirely from distribution of the +Program. + +If any portion of this section is held invalid or unenforceable under any particular +circumstance, the balance of the section is intended to apply and the section as +a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other +property right claims or to contest validity of any such claims; this section has +the sole purpose of protecting the integrity of the free software distribution +system, which is implemented by public license practices. Many people have +made generous contributions to the wide range of software distributed through +that system in reliance on consistent application of that system; it is up to the +author/donor to decide if he or she is willing to distribute software through any +other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a +consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain countries +either by patents or by copyrighted interfaces, the original copyright holder who +places the Program under this License may add an explicit geographical +distribution limitation excluding those countries, so that distribution is permitted +only in or among countries not thus excluded. In such case, this License +incorporates the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the +General Public License from time to time. Such new versions will be similar in +spirit to the present version, but may differ in detail to address new problems or +concerns. + +Each version is given a distinguishing version number. If the Program specifies a +version number of this License which applies to it and "any later version", you +have the option of following the terms and conditions either of that version or of +any later version published by the Free Software Foundation. If the Program does +not specify a version number of this License, you may choose any version ever +published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs +whose distribution conditions are different, write to the author to ask for +permission. For software which is copyrighted by the Free Software Foundation, +write to the Free Software Foundation; we sometimes make exceptions for this. +Our decision will be guided by the two goals of preserving the free status of all +derivatives of our free software and of promoting the sharing and reuse of +software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS +NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE +COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM +"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR +IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE +ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, +YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR +CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED +TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY +WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS +PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM +(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY +OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + + +---------------------------------------------------------------------------- + +The Artistic License + +Preamble + +The intent of this document is to state the conditions under which a Package +may be copied, such that the Copyright Holder maintains some semblance of +artistic control over the development of the package, while giving the users of the +package the right to use and distribute the Package in a more-or-less customary +fashion, plus the right to make reasonable modifications. + +Definitions: + +- "Package" refers to the collection of files distributed by the Copyright + Holder, and derivatives of that collection of files created through textual + modification. +- "Standard Version" refers to such a Package if it has not been modified, + or has been modified in accordance with the wishes of the Copyright + Holder. +- "Copyright Holder" is whoever is named in the copyright or copyrights for + the package. +- "You" is you, if you're thinking about copying or distributing this Package. +- "Reasonable copying fee" is whatever you can justify on the basis of + media cost, duplication charges, time of people involved, and so on. (You + will not be required to justify it to the Copyright Holder, but only to the + computing community at large as a market that must bear the fee.) +- "Freely Available" means that no fee is charged for the item itself, though + there may be fees involved in handling the item. It also means that + recipients of the item may redistribute it under the same conditions they + received it. + +1. You may make and give away verbatim copies of the source form of the +Standard Version of this Package without restriction, provided that you duplicate +all of the original copyright notices and associated disclaimers. + +2. You may apply bug fixes, portability fixes and other modifications derived from +the Public Domain or from the Copyright Holder. A Package modified in such a +way shall still be considered the Standard Version. + +3. You may otherwise modify your copy of this Package in any way, provided +that you insert a prominent notice in each changed file stating how and when +you changed that file, and provided that you do at least ONE of the following: + + a) place your modifications in the Public Domain or otherwise + make them Freely Available, such as by posting said modifications + to Usenet or an equivalent medium, or placing the modifications on + a major archive site such as ftp.uu.net, or by allowing the + Copyright Holder to include your modifications in the Standard + Version of the Package. + + b) use the modified Package only within your corporation or + organization. + + c) rename any non-standard executables so the names do not + conflict with standard executables, which must also be provided, + and provide a separate manual page for each non-standard + executable that clearly documents how it differs from the Standard + Version. + + d) make other distribution arrangements with the Copyright Holder. + +4. You may distribute the programs of this Package in object code or executable +form, provided that you do at least ONE of the following: + + a) distribute a Standard Version of the executables and library + files, together with instructions (in the manual page or equivalent) + on where to get the Standard Version. + + b) accompany the distribution with the machine-readable source of + the Package with your modifications. + + c) accompany any non-standard executables with their + corresponding Standard Version executables, giving the + non-standard executables non-standard names, and clearly + documenting the differences in manual pages (or equivalent), + together with instructions on where to get the Standard Version. + + d) make other distribution arrangements with the Copyright Holder. + +5. You may charge a reasonable copying fee for any distribution of this Package. +You may charge any fee you choose for support of this Package. You may not +charge a fee for this Package itself. However, you may distribute this Package in +aggregate with other (possibly commercial) programs as part of a larger +(possibly commercial) software distribution provided that you do not advertise +this Package as a product of your own. + +6. The scripts and library files supplied as input to or produced as output from +the programs of this Package do not automatically fall under the copyright of this +Package, but belong to whomever generated them, and may be sold +commercially, and may be aggregated with this Package. + +7. C or perl subroutines supplied by you and linked into this Package shall not +be considered part of this Package. + +8. The name of the Copyright Holder may not be used to endorse or promote +products derived from this software without specific prior written permission. + +9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR +PURPOSE. + +The End + + diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/MANIFEST b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/MANIFEST new file mode 100644 index 0000000..7e9bb46 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/MANIFEST @@ -0,0 +1,413 @@ +bin/perlcritic +Build.PL +Changes +examples/generatestats +examples/loadanalysisdb +examples/perlcriticrc +examples/perlcriticrc-conway +extras/KomodoIntegration.pod +extras/perlcritic.el +inc/Devel/AssertOS.pm +inc/Devel/AssertOS/AIX.pm +inc/Devel/AssertOS/Amiga.pm +inc/Devel/AssertOS/Apple.pm +inc/Devel/AssertOS/BeOS.pm +inc/Devel/AssertOS/BSDOS.pm +inc/Devel/AssertOS/Cygwin.pm +inc/Devel/AssertOS/DEC.pm +inc/Devel/AssertOS/DGUX.pm +inc/Devel/AssertOS/DragonflyBSD.pm +inc/Devel/AssertOS/Dynix.pm +inc/Devel/AssertOS/FreeBSD.pm +inc/Devel/AssertOS/HPUX.pm +inc/Devel/AssertOS/Interix.pm +inc/Devel/AssertOS/Irix.pm +inc/Devel/AssertOS/Linux.pm +inc/Devel/AssertOS/MachTen.pm +inc/Devel/AssertOS/MacOSclassic.pm +inc/Devel/AssertOS/MacOSX.pm +inc/Devel/AssertOS/MicrosoftWindows.pm +inc/Devel/AssertOS/MPEiX.pm +inc/Devel/AssertOS/MSDOS.pm +inc/Devel/AssertOS/MSWin32.pm +inc/Devel/AssertOS/NetBSD.pm +inc/Devel/AssertOS/Netware.pm +inc/Devel/AssertOS/NeXT.pm +inc/Devel/AssertOS/OpenBSD.pm +inc/Devel/AssertOS/OS2.pm +inc/Devel/AssertOS/OS390.pm +inc/Devel/AssertOS/OS400.pm +inc/Devel/AssertOS/OSF.pm +inc/Devel/AssertOS/POSIXBC.pm +inc/Devel/AssertOS/RISCOS.pm +inc/Devel/AssertOS/SCO.pm +inc/Devel/AssertOS/Solaris.pm +inc/Devel/AssertOS/Sun.pm +inc/Devel/AssertOS/SunOS.pm +inc/Devel/AssertOS/SysVr4.pm +inc/Devel/AssertOS/SysVr5.pm +inc/Devel/AssertOS/Unicos.pm +inc/Devel/AssertOS/Unix.pm +inc/Devel/AssertOS/VMESA.pm +inc/Devel/AssertOS/VMS.pm +inc/Devel/AssertOS/VOS.pm +inc/Devel/CheckOS.pm +inc/Perl/Critic/BuildUtilities.pm +INSTALL +lib/Perl/Critic.pm +lib/Perl/Critic/Config.pm +lib/Perl/Critic/DEVELOPER.pod +lib/Perl/Critic/Document.pm +lib/Perl/Critic/Exception.pm +lib/Perl/Critic/Exception/AggregateConfiguration.pm +lib/Perl/Critic/Exception/Configuration.pm +lib/Perl/Critic/Exception/Configuration/Generic.pm +lib/Perl/Critic/Exception/Configuration/Option.pm +lib/Perl/Critic/Exception/Configuration/Option/Global.pm +lib/Perl/Critic/Exception/Configuration/Option/Global/ExtraParameter.pm +lib/Perl/Critic/Exception/Configuration/Option/Global/ParameterValue.pm +lib/Perl/Critic/Exception/Configuration/Option/Policy.pm +lib/Perl/Critic/Exception/Configuration/Option/Policy/ExtraParameter.pm +lib/Perl/Critic/Exception/Configuration/Option/Policy/ParameterValue.pm +lib/Perl/Critic/Exception/Fatal.pm +lib/Perl/Critic/Exception/Fatal/Generic.pm +lib/Perl/Critic/Exception/Fatal/Internal.pm +lib/Perl/Critic/Exception/Fatal/PolicyDefinition.pm +lib/Perl/Critic/Exception/IO.pm +lib/Perl/Critic/Exception/Parse.pm +lib/Perl/Critic/OptionsProcessor.pm +lib/Perl/Critic/Policy.pm +lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitBooleanGrep.pm +lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitComplexMappings.pm +lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitLvalueSubstr.pm +lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitReverseSortBlock.pm +lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitSleepViaSelect.pm +lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitStringyEval.pm +lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitStringySplit.pm +lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitUniversalCan.pm +lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitUniversalIsa.pm +lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitVoidGrep.pm +lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitVoidMap.pm +lib/Perl/Critic/Policy/BuiltinFunctions/RequireBlockGrep.pm +lib/Perl/Critic/Policy/BuiltinFunctions/RequireBlockMap.pm +lib/Perl/Critic/Policy/BuiltinFunctions/RequireGlobFunction.pm +lib/Perl/Critic/Policy/BuiltinFunctions/RequireSimpleSortBlock.pm +lib/Perl/Critic/Policy/ClassHierarchies/ProhibitAutoloading.pm +lib/Perl/Critic/Policy/ClassHierarchies/ProhibitExplicitISA.pm +lib/Perl/Critic/Policy/ClassHierarchies/ProhibitOneArgBless.pm +lib/Perl/Critic/Policy/CodeLayout/ProhibitHardTabs.pm +lib/Perl/Critic/Policy/CodeLayout/ProhibitParensWithBuiltins.pm +lib/Perl/Critic/Policy/CodeLayout/ProhibitQuotedWordLists.pm +lib/Perl/Critic/Policy/CodeLayout/ProhibitTrailingWhitespace.pm +lib/Perl/Critic/Policy/CodeLayout/RequireConsistentNewlines.pm +lib/Perl/Critic/Policy/CodeLayout/RequireTidyCode.pm +lib/Perl/Critic/Policy/CodeLayout/RequireTrailingCommas.pm +lib/Perl/Critic/Policy/ControlStructures/ProhibitCascadingIfElse.pm +lib/Perl/Critic/Policy/ControlStructures/ProhibitCStyleForLoops.pm +lib/Perl/Critic/Policy/ControlStructures/ProhibitDeepNests.pm +lib/Perl/Critic/Policy/ControlStructures/ProhibitLabelsWithSpecialBlockNames.pm +lib/Perl/Critic/Policy/ControlStructures/ProhibitMutatingListFunctions.pm +lib/Perl/Critic/Policy/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.pm +lib/Perl/Critic/Policy/ControlStructures/ProhibitPostfixControls.pm +lib/Perl/Critic/Policy/ControlStructures/ProhibitUnlessBlocks.pm +lib/Perl/Critic/Policy/ControlStructures/ProhibitUnreachableCode.pm +lib/Perl/Critic/Policy/ControlStructures/ProhibitUntilBlocks.pm +lib/Perl/Critic/Policy/Documentation/PodSpelling.pm +lib/Perl/Critic/Policy/Documentation/RequirePackageMatchesPodName.pm +lib/Perl/Critic/Policy/Documentation/RequirePodAtEnd.pm +lib/Perl/Critic/Policy/Documentation/RequirePodSections.pm +lib/Perl/Critic/Policy/ErrorHandling/RequireCarping.pm +lib/Perl/Critic/Policy/ErrorHandling/RequireCheckingReturnValueOfEval.pm +lib/Perl/Critic/Policy/InputOutput/ProhibitBacktickOperators.pm +lib/Perl/Critic/Policy/InputOutput/ProhibitBarewordFileHandles.pm +lib/Perl/Critic/Policy/InputOutput/ProhibitExplicitStdin.pm +lib/Perl/Critic/Policy/InputOutput/ProhibitInteractiveTest.pm +lib/Perl/Critic/Policy/InputOutput/ProhibitJoinedReadline.pm +lib/Perl/Critic/Policy/InputOutput/ProhibitOneArgSelect.pm +lib/Perl/Critic/Policy/InputOutput/ProhibitReadlineInForLoop.pm +lib/Perl/Critic/Policy/InputOutput/ProhibitTwoArgOpen.pm +lib/Perl/Critic/Policy/InputOutput/RequireBracedFileHandleWithPrint.pm +lib/Perl/Critic/Policy/InputOutput/RequireBriefOpen.pm +lib/Perl/Critic/Policy/InputOutput/RequireCheckedClose.pm +lib/Perl/Critic/Policy/InputOutput/RequireCheckedOpen.pm +lib/Perl/Critic/Policy/InputOutput/RequireCheckedSyscalls.pm +lib/Perl/Critic/Policy/Miscellanea/ProhibitFormats.pm +lib/Perl/Critic/Policy/Miscellanea/ProhibitTies.pm +lib/Perl/Critic/Policy/Miscellanea/RequireRcsKeywords.pm +lib/Perl/Critic/Policy/Modules/ProhibitAutomaticExportation.pm +lib/Perl/Critic/Policy/Modules/ProhibitEvilModules.pm +lib/Perl/Critic/Policy/Modules/ProhibitExcessMainComplexity.pm +lib/Perl/Critic/Policy/Modules/ProhibitMultiplePackages.pm +lib/Perl/Critic/Policy/Modules/RequireBarewordIncludes.pm +lib/Perl/Critic/Policy/Modules/RequireEndWithOne.pm +lib/Perl/Critic/Policy/Modules/RequireExplicitPackage.pm +lib/Perl/Critic/Policy/Modules/RequireFilenameMatchesPackage.pm +lib/Perl/Critic/Policy/Modules/RequireNoMatchVarsWithUseEnglish.pm +lib/Perl/Critic/Policy/Modules/RequireVersionVar.pm +lib/Perl/Critic/Policy/NamingConventions/ProhibitAmbiguousNames.pm +lib/Perl/Critic/Policy/NamingConventions/ProhibitMixedCaseSubs.pm +lib/Perl/Critic/Policy/NamingConventions/ProhibitMixedCaseVars.pm +lib/Perl/Critic/Policy/References/ProhibitDoubleSigils.pm +lib/Perl/Critic/Policy/RegularExpressions/ProhibitCaptureWithoutTest.pm +lib/Perl/Critic/Policy/RegularExpressions/ProhibitComplexRegexes.pm +lib/Perl/Critic/Policy/RegularExpressions/ProhibitEnumeratedClasses.pm +lib/Perl/Critic/Policy/RegularExpressions/ProhibitEscapedMetacharacters.pm +lib/Perl/Critic/Policy/RegularExpressions/ProhibitFixedStringMatches.pm +lib/Perl/Critic/Policy/RegularExpressions/ProhibitSingleCharAlternation.pm +lib/Perl/Critic/Policy/RegularExpressions/ProhibitUnusedCapture.pm +lib/Perl/Critic/Policy/RegularExpressions/ProhibitUnusualDelimiters.pm +lib/Perl/Critic/Policy/RegularExpressions/RequireBracesForMultiline.pm +lib/Perl/Critic/Policy/RegularExpressions/RequireExtendedFormatting.pm +lib/Perl/Critic/Policy/RegularExpressions/RequireLineBoundaryMatching.pm +lib/Perl/Critic/Policy/Subroutines/ProhibitAmpersandSigils.pm +lib/Perl/Critic/Policy/Subroutines/ProhibitBuiltinHomonyms.pm +lib/Perl/Critic/Policy/Subroutines/ProhibitExcessComplexity.pm +lib/Perl/Critic/Policy/Subroutines/ProhibitExplicitReturnUndef.pm +lib/Perl/Critic/Policy/Subroutines/ProhibitManyArgs.pm +lib/Perl/Critic/Policy/Subroutines/ProhibitNestedSubs.pm +lib/Perl/Critic/Policy/Subroutines/ProhibitSubroutinePrototypes.pm +lib/Perl/Critic/Policy/Subroutines/ProtectPrivateSubs.pm +lib/Perl/Critic/Policy/Subroutines/RequireArgUnpacking.pm +lib/Perl/Critic/Policy/Subroutines/RequireFinalReturn.pm +lib/Perl/Critic/Policy/TestingAndDebugging/ProhibitNoStrict.pm +lib/Perl/Critic/Policy/TestingAndDebugging/ProhibitNoWarnings.pm +lib/Perl/Critic/Policy/TestingAndDebugging/ProhibitProlongedStrictureOverride.pm +lib/Perl/Critic/Policy/TestingAndDebugging/RequireTestLabels.pm +lib/Perl/Critic/Policy/TestingAndDebugging/RequireUseStrict.pm +lib/Perl/Critic/Policy/TestingAndDebugging/RequireUseWarnings.pm +lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitCommaSeparatedStatements.pm +lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitConstantPragma.pm +lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitEmptyQuotes.pm +lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitEscapedCharacters.pm +lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitImplicitNewlines.pm +lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitInterpolationOfLiterals.pm +lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitLeadingZeros.pm +lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitLongChainsOfMethodCalls.pm +lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitMagicNumbers.pm +lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitMismatchedOperators.pm +lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitMixedBooleanOperators.pm +lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitNoisyQuotes.pm +lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitQuotesAsQuotelikeOperatorDelimiters.pm +lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitVersionStrings.pm +lib/Perl/Critic/Policy/ValuesAndExpressions/RequireInterpolationOfMetachars.pm +lib/Perl/Critic/Policy/ValuesAndExpressions/RequireNumberSeparators.pm +lib/Perl/Critic/Policy/ValuesAndExpressions/RequireQuotedHeredocTerminator.pm +lib/Perl/Critic/Policy/ValuesAndExpressions/RequireUpperCaseHeredocTerminator.pm +lib/Perl/Critic/Policy/Variables/ProhibitConditionalDeclarations.pm +lib/Perl/Critic/Policy/Variables/ProhibitLocalVars.pm +lib/Perl/Critic/Policy/Variables/ProhibitMatchVars.pm +lib/Perl/Critic/Policy/Variables/ProhibitPackageVars.pm +lib/Perl/Critic/Policy/Variables/ProhibitPerl4PackageNames.pm +lib/Perl/Critic/Policy/Variables/ProhibitPunctuationVars.pm +lib/Perl/Critic/Policy/Variables/ProhibitUnusedVariables.pm +lib/Perl/Critic/Policy/Variables/ProtectPrivateVars.pm +lib/Perl/Critic/Policy/Variables/RequireInitializationForLocalVars.pm +lib/Perl/Critic/Policy/Variables/RequireLexicalLoopIterators.pm +lib/Perl/Critic/Policy/Variables/RequireLocalizedPunctuationVars.pm +lib/Perl/Critic/Policy/Variables/RequireNegativeIndices.pm +lib/Perl/Critic/PolicyConfig.pm +lib/Perl/Critic/PolicyFactory.pm +lib/Perl/Critic/PolicyListing.pm +lib/Perl/Critic/PolicyParameter.pm +lib/Perl/Critic/PolicyParameter/Behavior.pm +lib/Perl/Critic/PolicyParameter/Behavior/Boolean.pm +lib/Perl/Critic/PolicyParameter/Behavior/Enumeration.pm +lib/Perl/Critic/PolicyParameter/Behavior/Integer.pm +lib/Perl/Critic/PolicyParameter/Behavior/String.pm +lib/Perl/Critic/PolicyParameter/Behavior/StringList.pm +lib/Perl/Critic/PolicySummary.pod.PL +lib/Perl/Critic/ProfilePrototype.pm +lib/Perl/Critic/Statistics.pm +lib/Perl/Critic/TestUtils.pm +lib/Perl/Critic/Theme.pm +lib/Perl/Critic/ThemeListing.pm +lib/Perl/Critic/UserProfile.pm +lib/Perl/Critic/Utils.pm +lib/Perl/Critic/Utils/Constants.pm +lib/Perl/Critic/Utils/DataConversion.pm +lib/Perl/Critic/Utils/McCabe.pm +lib/Perl/Critic/Utils/POD.pm +lib/Perl/Critic/Utils/PPI.pm +lib/Perl/Critic/Utils/PPIRegexp.pm +lib/Perl/Critic/Violation.pm +LICENSE +Makefile.PL +MANIFEST This list of files +META.yml +README +t/00_modules.t +t/01_bad_perlcriticrc +t/01_config.t +t/01_config_bad_perlcriticrc.t +t/01_policy_config.t +t/02_policy.t +t/03_pragmas.t +t/04_optionsprocessor.t +t/05_utils.t +t/05_utils_pod.t +t/05_utils_ppi.t +t/06_violation.t +t/07_perlcritic.t +t/08_document.t +t/09_theme.t +t/10_userprofile.t +t/11_policyfactory.t +t/12_policylisting.t +t/12_themelisting.t +t/13_bundled_policies.t +t/14_policy_parameter_behavior_boolean.t +t/14_policy_parameter_behavior_enumeration.t +t/14_policy_parameter_behavior_integer.t +t/14_policy_parameter_behavior_list_string.t +t/14_policy_parameter_behavior_string.t +t/14_policy_parameters.t +t/15_statistics.t +t/16_roundtrip_defaults.t +t/20_policies.t +t/20_policy_podspelling.t +t/20_policy_prohibithardtabs.t +t/20_policy_prohibittrailingwhitespace.t +t/20_policy_requireconsistentnewlines.t +t/20_policy_requiretidycode.t +t/92_memory_leaks.t +t/98_pod_syntax.t +t/99_pod_coverage.t +t/BuiltinFunctions/ProhibitBooleanGrep.run +t/BuiltinFunctions/ProhibitComplexMappings.run +t/BuiltinFunctions/ProhibitLvalueSubstr.run +t/BuiltinFunctions/ProhibitReverseSortBlock.run +t/BuiltinFunctions/ProhibitSleepViaSelect.run +t/BuiltinFunctions/ProhibitStringyEval.run +t/BuiltinFunctions/ProhibitStringySplit.run +t/BuiltinFunctions/ProhibitUniversalCan.run +t/BuiltinFunctions/ProhibitUniversalIsa.run +t/BuiltinFunctions/ProhibitVoidGrep.run +t/BuiltinFunctions/ProhibitVoidMap.run +t/BuiltinFunctions/RequireBlockGrep.run +t/BuiltinFunctions/RequireBlockMap.run +t/BuiltinFunctions/RequireGlobFunction.run +t/BuiltinFunctions/RequireSimpleSortBlock.run +t/ClassHierarchies/ProhibitAutoloading.run +t/ClassHierarchies/ProhibitExplicitISA.run +t/ClassHierarchies/ProhibitOneArgBless.run +t/CodeLayout/ProhibitParensWithBuiltins.run +t/CodeLayout/ProhibitQuotedWordLists.run +t/CodeLayout/RequireTrailingCommas.run +t/ControlStructures/ProhibitCascadingIfElse.run +t/ControlStructures/ProhibitCStyleForLoops.run +t/ControlStructures/ProhibitDeepNests.run +t/ControlStructures/ProhibitLabelsWithSpecialBlockNames.run +t/ControlStructures/ProhibitMutatingListFunctions.run +t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run.PL +t/ControlStructures/ProhibitPostfixControls.run +t/ControlStructures/ProhibitUnlessBlocks.run +t/ControlStructures/ProhibitUnreachableCode.run +t/ControlStructures/ProhibitUntilBlocks.run +t/Documentation/RequirePackageMatchesPodName.run +t/Documentation/RequirePodAtEnd.run +t/Documentation/RequirePodSections.run +t/ErrorHandling/RequireCarping.run +t/ErrorHandling/RequireCheckingReturnValueOfEval.run +t/generate_without_optional_dependencies_wrappers.PL +t/InputOutput/ProhibitBacktickOperators.run +t/InputOutput/ProhibitBarewordFileHandles.run +t/InputOutput/ProhibitExplicitStdin.run +t/InputOutput/ProhibitInteractiveTest.run +t/InputOutput/ProhibitJoinedReadline.run +t/InputOutput/ProhibitOneArgSelect.run +t/InputOutput/ProhibitReadlineInForLoop.run +t/InputOutput/ProhibitTwoArgOpen.run +t/InputOutput/RequireBracedFileHandleWithPrint.run +t/InputOutput/RequireBriefOpen.run +t/InputOutput/RequireCheckedClose.run +t/InputOutput/RequireCheckedOpen.run +t/InputOutput/RequireCheckedSyscalls.run +t/Miscellanea/ProhibitFormats.run +t/Miscellanea/ProhibitTies.run +t/Miscellanea/RequireRcsKeywords.run +t/Modules/ProhibitAutomaticExportation.run +t/Modules/ProhibitEvilModules.run +t/Modules/ProhibitExcessMainComplexity.run +t/Modules/ProhibitMultiplePackages.run +t/Modules/RequireBarewordIncludes.run +t/Modules/RequireEndWithOne.run +t/Modules/RequireExplicitPackage.run +t/Modules/RequireFilenameMatchesPackage.run +t/Modules/RequireNoMatchVarsWithUseEnglish.run +t/Modules/RequireVersionVar.run +t/NamingConventions/ProhibitAmbiguousNames.run +t/NamingConventions/ProhibitMixedCaseSubs.run +t/NamingConventions/ProhibitMixedCaseVars.run +t/References/ProhibitDoubleSigils.run +t/RegularExpressions/ProhibitCaptureWithoutTest.run +t/RegularExpressions/ProhibitComplexRegexes.run +t/RegularExpressions/ProhibitEnumeratedClasses.run +t/RegularExpressions/ProhibitEscapedMetacharacters.run +t/RegularExpressions/ProhibitFixedStringMatches.run +t/RegularExpressions/ProhibitSingleCharAlternation.run +t/RegularExpressions/ProhibitUnusedCapture.run +t/RegularExpressions/ProhibitUnusualDelimiters.run +t/RegularExpressions/RequireBracesForMultiline.run +t/RegularExpressions/RequireExtendedFormatting.run +t/RegularExpressions/RequireLineBoundaryMatching.run +t/Subroutines/ProhibitAmpersandSigils.run +t/Subroutines/ProhibitBuiltinHomonyms.run +t/Subroutines/ProhibitExcessComplexity.run +t/Subroutines/ProhibitExplicitReturnUndef.run +t/Subroutines/ProhibitManyArgs.run +t/Subroutines/ProhibitNestedSubs.run +t/Subroutines/ProhibitSubroutinePrototypes.run +t/Subroutines/ProtectPrivateSubs.run +t/Subroutines/RequireArgUnpacking.run +t/Subroutines/RequireFinalReturn.run +t/TestingAndDebugging/ProhibitNoStrict.run +t/TestingAndDebugging/ProhibitNoWarnings.run +t/TestingAndDebugging/ProhibitProlongedStrictureOverride.run +t/TestingAndDebugging/RequireTestLabels.run +t/TestingAndDebugging/RequireUseStrict.run +t/TestingAndDebugging/RequireUseWarnings.run +t/tlib/Perl/Critic/Policy/Test.pm +t/tlib/Perl/Critic/TestUtilitiesWithMinimalDependencies.pm +t/tlib/ViolationTest.pm +t/tlib/ViolationTest2.pm +t/ValuesAndExpressions/ProhibitCommaSeparatedStatements.run +t/ValuesAndExpressions/ProhibitConstantPragma.run +t/ValuesAndExpressions/ProhibitEmptyQuotes.run +t/ValuesAndExpressions/ProhibitEscapedCharacters.run +t/ValuesAndExpressions/ProhibitImplicitNewlines.run +t/ValuesAndExpressions/ProhibitInterpolationOfLiterals.run +t/ValuesAndExpressions/ProhibitLeadingZeros.run +t/ValuesAndExpressions/ProhibitLongChainsOfMethodCalls.run +t/ValuesAndExpressions/ProhibitMagicNumbers.run +t/ValuesAndExpressions/ProhibitMismatchedOperators.run +t/ValuesAndExpressions/ProhibitMixedBooleanOperators.run +t/ValuesAndExpressions/ProhibitNoisyQuotes.run +t/ValuesAndExpressions/ProhibitQuotesAsQuotelikeOperatorDelimiters.run +t/ValuesAndExpressions/ProhibitVersionStrings.run +t/ValuesAndExpressions/RequireInterpolationOfMetachars.run +t/ValuesAndExpressions/RequireNumberSeparators.run +t/ValuesAndExpressions/RequireQuotedHeredocTerminator.run +t/ValuesAndExpressions/RequireUpperCaseHeredocTerminator.run +t/Variables/ProhibitConditionalDeclarations.run +t/Variables/ProhibitLocalVars.run +t/Variables/ProhibitMatchVars.run +t/Variables/ProhibitPackageVars.run +t/Variables/ProhibitPerl4PackageNames.run +t/Variables/ProhibitPunctuationVars.run +t/Variables/ProhibitUnusedVariables.run +t/Variables/ProtectPrivateVars.run +t/Variables/RequireInitializationForLocalVars.run +t/Variables/RequireLexicalLoopIterators.run +t/Variables/RequireLocalizedPunctuationVars.run.PL +t/Variables/RequireNegativeIndices.run +TODO.pod +tools/ppidump +tools/svnkeywords +xt/author/40_criticize-code.t +xt/author/40_perlcriticrc-code +xt/author/41_criticize-policies.t +xt/author/41_perlcriticrc-policies +xt/author/80_policysummary.t +xt/author/93_version.t +xt/author/94_includes.t +xt/author/95_kwalitee.t diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/META.yml b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/META.yml new file mode 100644 index 0000000..18a1735 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/META.yml @@ -0,0 +1,595 @@ +--- +name: Perl-Critic +version: 1.088 +author: + - 'Jeffrey Thalhammer ' +abstract: Critique Perl source code for best-practices. +license: perl +resources: + MailingList: http://perlcritic.tigris.org/servlets/SummarizeList?listName=users + Repository: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/ + homepage: http://perlcritic.com + license: http://dev.perl.org/licenses/ +requires: + B::Keywords: 1.05 + Carp: 0 + Config::Tiny: 2 + English: 0 + Exception::Class: 1.23 + Exporter: 0 + File::Basename: 0 + File::Find: 0 + File::Path: 0 + File::Spec: 0 + File::Spec::Unix: 0 + File::Temp: 0 + Getopt::Long: 0 + IO::String: 0 + List::MoreUtils: 0 + List::Util: 0 + Module::Pluggable: 3.1 + PPI: 1.203 + PPI::Document: 1.203 + PPI::Document::File: 1.203 + PPI::Node: 1.203 + PPI::Token::Quote::Single: 1.203 + PPI::Token::Whitespace: 1.203 + Pod::PlainText: 0 + Pod::Select: 0 + Pod::Usage: 0 + Readonly: 1.03 + Scalar::Util: 0 + String::Format: 1.13 + base: 0 + charnames: 0 + overload: 0 + strict: 0 + version: 0 + warnings: 0 +build_requires: + Test::More: 0 + lib: 0 +recommends: + File::HomeDir: 0 + File::Which: 0 + IPC::Open2: 1 + Perl::Tidy: 0 + Pod::Spell: 1 + Readonly::XS: 0 + Regexp::Parser: 0.20 + Term::ANSIColor: 0 + Text::ParseWords: 3 +dynamic_config: 1 +provides: + Perl::Critic: + file: lib/Perl/Critic.pm + version: 1.088 + Perl::Critic::Config: + file: lib/Perl/Critic/Config.pm + version: 1.088 + Perl::Critic::Document: + file: lib/Perl/Critic/Document.pm + version: 1.088 + Perl::Critic::Exception: + file: lib/Perl/Critic/Exception.pm + version: 1.088 + Perl::Critic::Exception::AggregateConfiguration: + file: lib/Perl/Critic/Exception/AggregateConfiguration.pm + version: 1.088 + Perl::Critic::Exception::Configuration: + file: lib/Perl/Critic/Exception/Configuration.pm + version: 1.088 + Perl::Critic::Exception::Configuration::Generic: + file: lib/Perl/Critic/Exception/Configuration/Generic.pm + version: 1.088 + Perl::Critic::Exception::Configuration::Option: + file: lib/Perl/Critic/Exception/Configuration/Option.pm + version: 1.088 + Perl::Critic::Exception::Configuration::Option::Global: + file: lib/Perl/Critic/Exception/Configuration/Option/Global.pm + version: 1.088 + Perl::Critic::Exception::Configuration::Option::Global::ExtraParameter: + file: lib/Perl/Critic/Exception/Configuration/Option/Global/ExtraParameter.pm + version: 1.088 + Perl::Critic::Exception::Configuration::Option::Global::ParameterValue: + file: lib/Perl/Critic/Exception/Configuration/Option/Global/ParameterValue.pm + version: 1.088 + Perl::Critic::Exception::Configuration::Option::Policy: + file: lib/Perl/Critic/Exception/Configuration/Option/Policy.pm + version: 1.088 + Perl::Critic::Exception::Configuration::Option::Policy::ExtraParameter: + file: lib/Perl/Critic/Exception/Configuration/Option/Policy/ExtraParameter.pm + version: 1.088 + Perl::Critic::Exception::Configuration::Option::Policy::ParameterValue: + file: lib/Perl/Critic/Exception/Configuration/Option/Policy/ParameterValue.pm + version: 1.088 + Perl::Critic::Exception::Fatal: + file: lib/Perl/Critic/Exception/Fatal.pm + version: 1.088 + Perl::Critic::Exception::Fatal::Generic: + file: lib/Perl/Critic/Exception/Fatal/Generic.pm + version: 1.088 + Perl::Critic::Exception::Fatal::Internal: + file: lib/Perl/Critic/Exception/Fatal/Internal.pm + version: 1.088 + Perl::Critic::Exception::Fatal::PolicyDefinition: + file: lib/Perl/Critic/Exception/Fatal/PolicyDefinition.pm + version: 1.088 + Perl::Critic::Exception::IO: + file: lib/Perl/Critic/Exception/IO.pm + version: 1.088 + Perl::Critic::Exception::Parse: + file: lib/Perl/Critic/Exception/Parse.pm + version: 1.088 + Perl::Critic::OptionsProcessor: + file: lib/Perl/Critic/OptionsProcessor.pm + version: 1.088 + Perl::Critic::Policy: + file: lib/Perl/Critic/Policy.pm + version: 1.088 + Perl::Critic::Policy::BuiltinFunctions::ProhibitBooleanGrep: + file: lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitBooleanGrep.pm + version: 1.088 + Perl::Critic::Policy::BuiltinFunctions::ProhibitComplexMappings: + file: lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitComplexMappings.pm + version: 1.088 + Perl::Critic::Policy::BuiltinFunctions::ProhibitLvalueSubstr: + file: lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitLvalueSubstr.pm + version: 1.088 + Perl::Critic::Policy::BuiltinFunctions::ProhibitReverseSortBlock: + file: lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitReverseSortBlock.pm + version: 1.088 + Perl::Critic::Policy::BuiltinFunctions::ProhibitSleepViaSelect: + file: lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitSleepViaSelect.pm + version: 1.088 + Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval: + file: lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitStringyEval.pm + version: 1.088 + Perl::Critic::Policy::BuiltinFunctions::ProhibitStringySplit: + file: lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitStringySplit.pm + version: 1.088 + Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalCan: + file: lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitUniversalCan.pm + version: 1.088 + Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalIsa: + file: lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitUniversalIsa.pm + version: 1.088 + Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidGrep: + file: lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitVoidGrep.pm + version: 1.088 + Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidMap: + file: lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitVoidMap.pm + version: 1.088 + Perl::Critic::Policy::BuiltinFunctions::RequireBlockGrep: + file: lib/Perl/Critic/Policy/BuiltinFunctions/RequireBlockGrep.pm + version: 1.088 + Perl::Critic::Policy::BuiltinFunctions::RequireBlockMap: + file: lib/Perl/Critic/Policy/BuiltinFunctions/RequireBlockMap.pm + version: 1.088 + Perl::Critic::Policy::BuiltinFunctions::RequireGlobFunction: + file: lib/Perl/Critic/Policy/BuiltinFunctions/RequireGlobFunction.pm + version: 1.088 + Perl::Critic::Policy::BuiltinFunctions::RequireSimpleSortBlock: + file: lib/Perl/Critic/Policy/BuiltinFunctions/RequireSimpleSortBlock.pm + version: 1.088 + Perl::Critic::Policy::ClassHierarchies::ProhibitAutoloading: + file: lib/Perl/Critic/Policy/ClassHierarchies/ProhibitAutoloading.pm + version: 1.088 + Perl::Critic::Policy::ClassHierarchies::ProhibitExplicitISA: + file: lib/Perl/Critic/Policy/ClassHierarchies/ProhibitExplicitISA.pm + version: 1.088 + Perl::Critic::Policy::ClassHierarchies::ProhibitOneArgBless: + file: lib/Perl/Critic/Policy/ClassHierarchies/ProhibitOneArgBless.pm + version: 1.088 + Perl::Critic::Policy::CodeLayout::ProhibitHardTabs: + file: lib/Perl/Critic/Policy/CodeLayout/ProhibitHardTabs.pm + version: 1.088 + Perl::Critic::Policy::CodeLayout::ProhibitParensWithBuiltins: + file: lib/Perl/Critic/Policy/CodeLayout/ProhibitParensWithBuiltins.pm + version: 1.088 + Perl::Critic::Policy::CodeLayout::ProhibitQuotedWordLists: + file: lib/Perl/Critic/Policy/CodeLayout/ProhibitQuotedWordLists.pm + version: 1.088 + Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace: + file: lib/Perl/Critic/Policy/CodeLayout/ProhibitTrailingWhitespace.pm + version: 1.088 + Perl::Critic::Policy::CodeLayout::RequireConsistentNewlines: + file: lib/Perl/Critic/Policy/CodeLayout/RequireConsistentNewlines.pm + version: 1.088 + Perl::Critic::Policy::CodeLayout::RequireTidyCode: + file: lib/Perl/Critic/Policy/CodeLayout/RequireTidyCode.pm + version: 1.088 + Perl::Critic::Policy::CodeLayout::RequireTrailingCommas: + file: lib/Perl/Critic/Policy/CodeLayout/RequireTrailingCommas.pm + version: 1.088 + Perl::Critic::Policy::ControlStructures::ProhibitCStyleForLoops: + file: lib/Perl/Critic/Policy/ControlStructures/ProhibitCStyleForLoops.pm + version: 1.088 + Perl::Critic::Policy::ControlStructures::ProhibitCascadingIfElse: + file: lib/Perl/Critic/Policy/ControlStructures/ProhibitCascadingIfElse.pm + version: 1.088 + Perl::Critic::Policy::ControlStructures::ProhibitDeepNests: + file: lib/Perl/Critic/Policy/ControlStructures/ProhibitDeepNests.pm + version: 1.088 + Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames: + file: lib/Perl/Critic/Policy/ControlStructures/ProhibitLabelsWithSpecialBlockNames.pm + version: 1.088 + Perl::Critic::Policy::ControlStructures::ProhibitMutatingListFunctions: + file: lib/Perl/Critic/Policy/ControlStructures/ProhibitMutatingListFunctions.pm + version: 1.088 + Perl::Critic::Policy::ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions: + file: lib/Perl/Critic/Policy/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.pm + version: 1.088 + Perl::Critic::Policy::ControlStructures::ProhibitPostfixControls: + file: lib/Perl/Critic/Policy/ControlStructures/ProhibitPostfixControls.pm + version: 1.088 + Perl::Critic::Policy::ControlStructures::ProhibitUnlessBlocks: + file: lib/Perl/Critic/Policy/ControlStructures/ProhibitUnlessBlocks.pm + version: 1.088 + Perl::Critic::Policy::ControlStructures::ProhibitUnreachableCode: + file: lib/Perl/Critic/Policy/ControlStructures/ProhibitUnreachableCode.pm + version: 1.088 + Perl::Critic::Policy::ControlStructures::ProhibitUntilBlocks: + file: lib/Perl/Critic/Policy/ControlStructures/ProhibitUntilBlocks.pm + version: 1.088 + Perl::Critic::Policy::Documentation::PodSpelling: + file: lib/Perl/Critic/Policy/Documentation/PodSpelling.pm + version: 1.088 + Perl::Critic::Policy::Documentation::RequirePackageMatchesPodName: + file: lib/Perl/Critic/Policy/Documentation/RequirePackageMatchesPodName.pm + version: 1.088 + Perl::Critic::Policy::Documentation::RequirePodAtEnd: + file: lib/Perl/Critic/Policy/Documentation/RequirePodAtEnd.pm + version: 1.088 + Perl::Critic::Policy::Documentation::RequirePodSections: + file: lib/Perl/Critic/Policy/Documentation/RequirePodSections.pm + version: 1.088 + Perl::Critic::Policy::ErrorHandling::RequireCarping: + file: lib/Perl/Critic/Policy/ErrorHandling/RequireCarping.pm + version: 1.088 + Perl::Critic::Policy::ErrorHandling::RequireCheckingReturnValueOfEval: + file: lib/Perl/Critic/Policy/ErrorHandling/RequireCheckingReturnValueOfEval.pm + version: 1.088 + Perl::Critic::Policy::InputOutput::ProhibitBacktickOperators: + file: lib/Perl/Critic/Policy/InputOutput/ProhibitBacktickOperators.pm + version: 1.088 + Perl::Critic::Policy::InputOutput::ProhibitBarewordFileHandles: + file: lib/Perl/Critic/Policy/InputOutput/ProhibitBarewordFileHandles.pm + version: 1.088 + Perl::Critic::Policy::InputOutput::ProhibitExplicitStdin: + file: lib/Perl/Critic/Policy/InputOutput/ProhibitExplicitStdin.pm + version: 1.088 + Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest: + file: lib/Perl/Critic/Policy/InputOutput/ProhibitInteractiveTest.pm + version: 1.088 + Perl::Critic::Policy::InputOutput::ProhibitJoinedReadline: + file: lib/Perl/Critic/Policy/InputOutput/ProhibitJoinedReadline.pm + version: 1.088 + Perl::Critic::Policy::InputOutput::ProhibitOneArgSelect: + file: lib/Perl/Critic/Policy/InputOutput/ProhibitOneArgSelect.pm + version: 1.088 + Perl::Critic::Policy::InputOutput::ProhibitReadlineInForLoop: + file: lib/Perl/Critic/Policy/InputOutput/ProhibitReadlineInForLoop.pm + version: 1.088 + Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen: + file: lib/Perl/Critic/Policy/InputOutput/ProhibitTwoArgOpen.pm + version: 1.088 + Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint: + file: lib/Perl/Critic/Policy/InputOutput/RequireBracedFileHandleWithPrint.pm + version: 1.088 + Perl::Critic::Policy::InputOutput::RequireBriefOpen: + file: lib/Perl/Critic/Policy/InputOutput/RequireBriefOpen.pm + version: 1.088 + Perl::Critic::Policy::InputOutput::RequireCheckedClose: + file: lib/Perl/Critic/Policy/InputOutput/RequireCheckedClose.pm + version: 1.088 + Perl::Critic::Policy::InputOutput::RequireCheckedOpen: + file: lib/Perl/Critic/Policy/InputOutput/RequireCheckedOpen.pm + version: 1.088 + Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls: + file: lib/Perl/Critic/Policy/InputOutput/RequireCheckedSyscalls.pm + version: 1.088 + Perl::Critic::Policy::Miscellanea::ProhibitFormats: + file: lib/Perl/Critic/Policy/Miscellanea/ProhibitFormats.pm + version: 1.088 + Perl::Critic::Policy::Miscellanea::ProhibitTies: + file: lib/Perl/Critic/Policy/Miscellanea/ProhibitTies.pm + version: 1.088 + Perl::Critic::Policy::Miscellanea::RequireRcsKeywords: + file: lib/Perl/Critic/Policy/Miscellanea/RequireRcsKeywords.pm + version: 1.088 + Perl::Critic::Policy::Modules::ProhibitAutomaticExportation: + file: lib/Perl/Critic/Policy/Modules/ProhibitAutomaticExportation.pm + version: 1.088 + Perl::Critic::Policy::Modules::ProhibitEvilModules: + file: lib/Perl/Critic/Policy/Modules/ProhibitEvilModules.pm + version: 1.088 + Perl::Critic::Policy::Modules::ProhibitExcessMainComplexity: + file: lib/Perl/Critic/Policy/Modules/ProhibitExcessMainComplexity.pm + version: 1.088 + Perl::Critic::Policy::Modules::ProhibitMultiplePackages: + file: lib/Perl/Critic/Policy/Modules/ProhibitMultiplePackages.pm + version: 1.088 + Perl::Critic::Policy::Modules::RequireBarewordIncludes: + file: lib/Perl/Critic/Policy/Modules/RequireBarewordIncludes.pm + version: 1.088 + Perl::Critic::Policy::Modules::RequireEndWithOne: + file: lib/Perl/Critic/Policy/Modules/RequireEndWithOne.pm + version: 1.088 + Perl::Critic::Policy::Modules::RequireExplicitPackage: + file: lib/Perl/Critic/Policy/Modules/RequireExplicitPackage.pm + version: 1.088 + Perl::Critic::Policy::Modules::RequireFilenameMatchesPackage: + file: lib/Perl/Critic/Policy/Modules/RequireFilenameMatchesPackage.pm + version: 1.088 + Perl::Critic::Policy::Modules::RequireNoMatchVarsWithUseEnglish: + file: lib/Perl/Critic/Policy/Modules/RequireNoMatchVarsWithUseEnglish.pm + version: 1.088 + Perl::Critic::Policy::Modules::RequireVersionVar: + file: lib/Perl/Critic/Policy/Modules/RequireVersionVar.pm + version: 1.088 + Perl::Critic::Policy::NamingConventions::ProhibitAmbiguousNames: + file: lib/Perl/Critic/Policy/NamingConventions/ProhibitAmbiguousNames.pm + version: 1.088 + Perl::Critic::Policy::NamingConventions::ProhibitMixedCaseSubs: + file: lib/Perl/Critic/Policy/NamingConventions/ProhibitMixedCaseSubs.pm + version: 1.088 + Perl::Critic::Policy::NamingConventions::ProhibitMixedCaseVars: + file: lib/Perl/Critic/Policy/NamingConventions/ProhibitMixedCaseVars.pm + version: 1.088 + Perl::Critic::Policy::References::ProhibitDoubleSigils: + file: lib/Perl/Critic/Policy/References/ProhibitDoubleSigils.pm + version: 1.088 + Perl::Critic::Policy::RegularExpressions::ProhibitCaptureWithoutTest: + file: lib/Perl/Critic/Policy/RegularExpressions/ProhibitCaptureWithoutTest.pm + version: 1.088 + Perl::Critic::Policy::RegularExpressions::ProhibitComplexRegexes: + file: lib/Perl/Critic/Policy/RegularExpressions/ProhibitComplexRegexes.pm + version: 1.088 + Perl::Critic::Policy::RegularExpressions::ProhibitEnumeratedClasses: + file: lib/Perl/Critic/Policy/RegularExpressions/ProhibitEnumeratedClasses.pm + version: 1.088 + Perl::Critic::Policy::RegularExpressions::ProhibitEscapedMetacharacters: + file: lib/Perl/Critic/Policy/RegularExpressions/ProhibitEscapedMetacharacters.pm + version: 1.088 + Perl::Critic::Policy::RegularExpressions::ProhibitFixedStringMatches: + file: lib/Perl/Critic/Policy/RegularExpressions/ProhibitFixedStringMatches.pm + version: 1.088 + Perl::Critic::Policy::RegularExpressions::ProhibitSingleCharAlternation: + file: lib/Perl/Critic/Policy/RegularExpressions/ProhibitSingleCharAlternation.pm + version: 1.088 + Perl::Critic::Policy::RegularExpressions::ProhibitUnusedCapture: + file: lib/Perl/Critic/Policy/RegularExpressions/ProhibitUnusedCapture.pm + version: 1.088 + Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters: + file: lib/Perl/Critic/Policy/RegularExpressions/ProhibitUnusualDelimiters.pm + version: 1.088 + Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline: + file: lib/Perl/Critic/Policy/RegularExpressions/RequireBracesForMultiline.pm + version: 1.088 + Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting: + file: lib/Perl/Critic/Policy/RegularExpressions/RequireExtendedFormatting.pm + version: 1.088 + Perl::Critic::Policy::RegularExpressions::RequireLineBoundaryMatching: + file: lib/Perl/Critic/Policy/RegularExpressions/RequireLineBoundaryMatching.pm + version: 1.088 + Perl::Critic::Policy::Subroutines::ProhibitAmpersandSigils: + file: lib/Perl/Critic/Policy/Subroutines/ProhibitAmpersandSigils.pm + version: 1.088 + Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms: + file: lib/Perl/Critic/Policy/Subroutines/ProhibitBuiltinHomonyms.pm + version: 1.088 + Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity: + file: lib/Perl/Critic/Policy/Subroutines/ProhibitExcessComplexity.pm + version: 1.088 + Perl::Critic::Policy::Subroutines::ProhibitExplicitReturnUndef: + file: lib/Perl/Critic/Policy/Subroutines/ProhibitExplicitReturnUndef.pm + version: 1.088 + Perl::Critic::Policy::Subroutines::ProhibitManyArgs: + file: lib/Perl/Critic/Policy/Subroutines/ProhibitManyArgs.pm + version: 1.088 + Perl::Critic::Policy::Subroutines::ProhibitNestedSubs: + file: lib/Perl/Critic/Policy/Subroutines/ProhibitNestedSubs.pm + version: 1.088 + Perl::Critic::Policy::Subroutines::ProhibitSubroutinePrototypes: + file: lib/Perl/Critic/Policy/Subroutines/ProhibitSubroutinePrototypes.pm + version: 1.088 + Perl::Critic::Policy::Subroutines::ProtectPrivateSubs: + file: lib/Perl/Critic/Policy/Subroutines/ProtectPrivateSubs.pm + version: 1.088 + Perl::Critic::Policy::Subroutines::RequireArgUnpacking: + file: lib/Perl/Critic/Policy/Subroutines/RequireArgUnpacking.pm + version: 1.088 + Perl::Critic::Policy::Subroutines::RequireFinalReturn: + file: lib/Perl/Critic/Policy/Subroutines/RequireFinalReturn.pm + version: 1.088 + Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict: + file: lib/Perl/Critic/Policy/TestingAndDebugging/ProhibitNoStrict.pm + version: 1.088 + Perl::Critic::Policy::TestingAndDebugging::ProhibitNoWarnings: + file: lib/Perl/Critic/Policy/TestingAndDebugging/ProhibitNoWarnings.pm + version: 1.088 + Perl::Critic::Policy::TestingAndDebugging::ProhibitProlongedStrictureOverride: + file: lib/Perl/Critic/Policy/TestingAndDebugging/ProhibitProlongedStrictureOverride.pm + version: 1.088 + Perl::Critic::Policy::TestingAndDebugging::RequireTestLabels: + file: lib/Perl/Critic/Policy/TestingAndDebugging/RequireTestLabels.pm + version: 1.088 + Perl::Critic::Policy::TestingAndDebugging::RequireUseStrict: + file: lib/Perl/Critic/Policy/TestingAndDebugging/RequireUseStrict.pm + version: 1.088 + Perl::Critic::Policy::TestingAndDebugging::RequireUseWarnings: + file: lib/Perl/Critic/Policy/TestingAndDebugging/RequireUseWarnings.pm + version: 1.088 + Perl::Critic::Policy::ValuesAndExpressions::ProhibitCommaSeparatedStatements: + file: lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitCommaSeparatedStatements.pm + version: 1.088 + Perl::Critic::Policy::ValuesAndExpressions::ProhibitConstantPragma: + file: lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitConstantPragma.pm + version: 1.088 + Perl::Critic::Policy::ValuesAndExpressions::ProhibitEmptyQuotes: + file: lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitEmptyQuotes.pm + version: 1.088 + Perl::Critic::Policy::ValuesAndExpressions::ProhibitEscapedCharacters: + file: lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitEscapedCharacters.pm + version: 1.088 + Perl::Critic::Policy::ValuesAndExpressions::ProhibitImplicitNewlines: + file: lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitImplicitNewlines.pm + version: 1.088 + Perl::Critic::Policy::ValuesAndExpressions::ProhibitInterpolationOfLiterals: + file: lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitInterpolationOfLiterals.pm + version: 1.088 + Perl::Critic::Policy::ValuesAndExpressions::ProhibitLeadingZeros: + file: lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitLeadingZeros.pm + version: 1.088 + Perl::Critic::Policy::ValuesAndExpressions::ProhibitLongChainsOfMethodCalls: + file: lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitLongChainsOfMethodCalls.pm + version: 1.088 + Perl::Critic::Policy::ValuesAndExpressions::ProhibitMagicNumbers: + file: lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitMagicNumbers.pm + version: 1.088 + Perl::Critic::Policy::ValuesAndExpressions::ProhibitMismatchedOperators: + file: lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitMismatchedOperators.pm + version: 1.088 + Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators: + file: lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitMixedBooleanOperators.pm + version: 1.088 + Perl::Critic::Policy::ValuesAndExpressions::ProhibitNoisyQuotes: + file: lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitNoisyQuotes.pm + version: 1.088 + Perl::Critic::Policy::ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters: + file: lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitQuotesAsQuotelikeOperatorDelimiters.pm + version: 1.088 + Perl::Critic::Policy::ValuesAndExpressions::ProhibitVersionStrings: + file: lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitVersionStrings.pm + version: 1.088 + Perl::Critic::Policy::ValuesAndExpressions::RequireInterpolationOfMetachars: + file: lib/Perl/Critic/Policy/ValuesAndExpressions/RequireInterpolationOfMetachars.pm + version: 1.088 + Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators: + file: lib/Perl/Critic/Policy/ValuesAndExpressions/RequireNumberSeparators.pm + version: 1.088 + Perl::Critic::Policy::ValuesAndExpressions::RequireQuotedHeredocTerminator: + file: lib/Perl/Critic/Policy/ValuesAndExpressions/RequireQuotedHeredocTerminator.pm + version: 1.088 + Perl::Critic::Policy::ValuesAndExpressions::RequireUpperCaseHeredocTerminator: + file: lib/Perl/Critic/Policy/ValuesAndExpressions/RequireUpperCaseHeredocTerminator.pm + version: 1.088 + Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations: + file: lib/Perl/Critic/Policy/Variables/ProhibitConditionalDeclarations.pm + version: 1.088 + Perl::Critic::Policy::Variables::ProhibitLocalVars: + file: lib/Perl/Critic/Policy/Variables/ProhibitLocalVars.pm + version: 1.088 + Perl::Critic::Policy::Variables::ProhibitMatchVars: + file: lib/Perl/Critic/Policy/Variables/ProhibitMatchVars.pm + version: 1.088 + Perl::Critic::Policy::Variables::ProhibitPackageVars: + file: lib/Perl/Critic/Policy/Variables/ProhibitPackageVars.pm + version: 1.088 + Perl::Critic::Policy::Variables::ProhibitPerl4PackageNames: + file: lib/Perl/Critic/Policy/Variables/ProhibitPerl4PackageNames.pm + version: 1.088 + Perl::Critic::Policy::Variables::ProhibitPunctuationVars: + file: lib/Perl/Critic/Policy/Variables/ProhibitPunctuationVars.pm + version: 1.088 + Perl::Critic::Policy::Variables::ProhibitUnusedVariables: + file: lib/Perl/Critic/Policy/Variables/ProhibitUnusedVariables.pm + version: 1.088 + Perl::Critic::Policy::Variables::ProtectPrivateVars: + file: lib/Perl/Critic/Policy/Variables/ProtectPrivateVars.pm + version: 1.088 + Perl::Critic::Policy::Variables::RequireInitializationForLocalVars: + file: lib/Perl/Critic/Policy/Variables/RequireInitializationForLocalVars.pm + version: 1.088 + Perl::Critic::Policy::Variables::RequireLexicalLoopIterators: + file: lib/Perl/Critic/Policy/Variables/RequireLexicalLoopIterators.pm + version: 1.088 + Perl::Critic::Policy::Variables::RequireLocalizedPunctuationVars: + file: lib/Perl/Critic/Policy/Variables/RequireLocalizedPunctuationVars.pm + version: 1.088 + Perl::Critic::Policy::Variables::RequireNegativeIndices: + file: lib/Perl/Critic/Policy/Variables/RequireNegativeIndices.pm + version: 1.088 + Perl::Critic::PolicyConfig: + file: lib/Perl/Critic/PolicyConfig.pm + version: 1.088 + Perl::Critic::PolicyFactory: + file: lib/Perl/Critic/PolicyFactory.pm + version: 1.088 + Perl::Critic::PolicyListing: + file: lib/Perl/Critic/PolicyListing.pm + version: 1.088 + Perl::Critic::PolicyParameter: + file: lib/Perl/Critic/PolicyParameter.pm + version: 1.088 + Perl::Critic::PolicyParameter::Behavior: + file: lib/Perl/Critic/PolicyParameter/Behavior.pm + version: 1.088 + Perl::Critic::PolicyParameter::Behavior::Boolean: + file: lib/Perl/Critic/PolicyParameter/Behavior/Boolean.pm + version: 1.088 + Perl::Critic::PolicyParameter::Behavior::Enumeration: + file: lib/Perl/Critic/PolicyParameter/Behavior/Enumeration.pm + version: 1.088 + Perl::Critic::PolicyParameter::Behavior::Integer: + file: lib/Perl/Critic/PolicyParameter/Behavior/Integer.pm + version: 1.088 + Perl::Critic::PolicyParameter::Behavior::String: + file: lib/Perl/Critic/PolicyParameter/Behavior/String.pm + version: 1.088 + Perl::Critic::PolicyParameter::Behavior::StringList: + file: lib/Perl/Critic/PolicyParameter/Behavior/StringList.pm + version: 1.088 + Perl::Critic::ProfilePrototype: + file: lib/Perl/Critic/ProfilePrototype.pm + version: 1.088 + Perl::Critic::Statistics: + file: lib/Perl/Critic/Statistics.pm + version: 1.088 + Perl::Critic::TestUtils: + file: lib/Perl/Critic/TestUtils.pm + version: 1.088 + Perl::Critic::Theme: + file: lib/Perl/Critic/Theme.pm + version: 1.088 + Perl::Critic::ThemeListing: + file: lib/Perl/Critic/ThemeListing.pm + version: 1.088 + Perl::Critic::UserProfile: + file: lib/Perl/Critic/UserProfile.pm + version: 1.088 + Perl::Critic::Utils: + file: lib/Perl/Critic/Utils.pm + version: 1.088 + Perl::Critic::Utils::Constants: + file: lib/Perl/Critic/Utils/Constants.pm + version: 1.088 + Perl::Critic::Utils::DataConversion: + file: lib/Perl/Critic/Utils/DataConversion.pm + version: 1.088 + Perl::Critic::Utils::McCabe: + file: lib/Perl/Critic/Utils/McCabe.pm + version: 1.088 + Perl::Critic::Utils::POD: + file: lib/Perl/Critic/Utils/POD.pm + version: 1.088 + Perl::Critic::Utils::PPI: + file: lib/Perl/Critic/Utils/PPI.pm + version: 1.088 + Perl::Critic::Utils::PPIRegexp: + file: lib/Perl/Critic/Utils/PPIRegexp.pm + version: 1.088 + Perl::Critic::Violation: + file: lib/Perl/Critic/Violation.pm + version: 1.088 +generated_by: Module::Build version 0.280801 +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.2.html + version: 1.2 +no_index: + directory: + - doc + file: + - TODO.pod + - lib/Perl/Critic/PolicySummary.pod.PL diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/Makefile.PL b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/Makefile.PL new file mode 100644 index 0000000..58ca83a --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/Makefile.PL @@ -0,0 +1,124 @@ +####################################################################### +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/Makefile.PL $ +# $Date: 2008-06-17 14:27:21 -0500 (Tue, 17 Jun 2008) $ +# $Author: clonezone $ +# $Revision: 2450 $ +######################################################################## + +use 5.006001; + +use strict; +use warnings; + +use lib 'inc'; +use lib 'lib'; + +use ExtUtils::MakeMaker; + +use Perl::Critic::BuildUtilities qw< + test_wrappers_to_generate + get_PL_files + dump_unlisted_or_optional_module_versions + emit_tar_warning_if_necessary +>; + + +emit_tar_warning_if_necessary(); + + +# An attempt was made by Elliot to get the "resources" META.yml entry going +# here, but he failed. The version in Build.PL works. See the Makefile.PL +# in the ack distribution for an example. + +WriteMakefile( + NAME => 'Perl::Critic', + AUTHOR => 'Jeffrey Thalhammer ', + ABSTRACT_FROM => 'lib/Perl/Critic.pm', + VERSION_FROM => 'lib/Perl/Critic.pm', + EXE_FILES => ['bin/perlcritic'], + PL_FILES => get_PL_files(), + PREREQ_PM => { + 'B::Keywords' => 1.05, + 'Carp' => 0, + 'Config::Tiny' => 2, + 'English' => 0, + 'Exception::Class' => 1.23, + 'Exporter' => 0, + 'File::Basename' => 0, + 'File::Find' => 0, + 'File::Path' => 0, + 'File::Spec' => 0, + 'File::Spec::Unix' => 0, + 'File::Temp' => 0, + 'Getopt::Long' => 0, + 'IO::String' => 0, + 'List::MoreUtils' => 0, + 'List::Util' => 0, + 'Module::Pluggable' => 3.1, + 'PPI' => 1.203, + 'PPI::Document' => 1.203, + 'PPI::Document::File' => 1.203, + 'PPI::Node' => 1.203, + 'PPI::Token::Quote::Single' => 1.203, + 'PPI::Token::Whitespace' => 1.203, + 'Pod::PlainText' => 0, + 'Pod::Select' => 0, + 'Pod::Usage' => 0, + 'Readonly' => 1.03, + 'Scalar::Util' => 0, + 'String::Format' => 1.13, + 'base' => 0, + 'charnames' => 0, + 'overload' => 0, + 'strict' => 0, + 'version' => 0, + 'warnings' => 0, + 'overload' => 0, + 'strict' => 0, + 'version' => 0, + 'warnings' => 0, + + 'lib' => 0, + 'Test::More' => 0, + }, + realclean => { + FILES => + join + q< >, + 'lib/Perl/Critic/PolicySummary.pod', + test_wrappers_to_generate(), + 't/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run', + 't/Variables/RequireLocalizedPunctuationVars.run', + }, +); + +sub MY::postamble { + return <<"MAKE_FRAG"; +.PHONY: tags + +tags: +\tctags -f tags \\ +\t\t--recurse \\ +\t\t--totals \\ +\t\t\\ +\t\t--exclude=blib/ \\ +\t\t--exclude=t/lib \\ +\t\t--exclude=.svn \\ +\t\t--exclude='*~' \\ +\t\t\\ +\t\t--languages=Perl \\ +\t\t--langmap=Perl:+.t +MAKE_FRAG +} + +dump_unlisted_or_optional_module_versions(); + +############################################################################## +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/README b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/README new file mode 100644 index 0000000..f8d5aeb --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/README @@ -0,0 +1,704 @@ +NAME + Perl::Critic - Critique Perl source code for best-practices. + +SYNOPSIS + use Perl::Critic; + my $file = shift; + my $critic = Perl::Critic->new(); + my @violations = $critic->critique($file); + print @violations; + +DESCRIPTION + Perl::Critic is an extensible framework for creating and applying coding + standards to Perl source code. Essentially, it is a static source code + analysis engine. Perl::Critic is distributed with a number of + Perl::Critic::Policy modules that attempt to enforce various coding + guidelines. Most Policy modules are based on Damian Conway's book Perl + Best Practices. However, Perl::Critic is not limited to PBP and will + even support Policies that contradict Conway. You can enable, disable, + and customize those Polices through the Perl::Critic interface. You can + also create new Policy modules that suit your own tastes. + + For a command-line interface to Perl::Critic, see the documentation for + perlcritic. If you want to integrate Perl::Critic with your build + process, Test::Perl::Critic provides an interface that is suitable for + test scripts. Also, Test::Perl::Critic::Progressive is useful for + gradually applying coding standards to legacy code. For the ultimate + convenience (at the expense of some flexibility) see the criticism + pragma. + + Win32 and ActivePerl users can find PPM distributions of Perl::Critic at + . + + If you'd like to try Perl::Critic without installing anything, there is + a web-service available at . The web-service does + not yet support all the configuration features that are available in the + native Perl::Critic API, but it should give you a good idea of what it + does. You can also invoke the perlcritic web-service from the + command-line by doing an HTTP-post, such as one of these: + + $> POST http://perlcritic.com/perl/critic.pl < MyModule.pm + $> lwp-request -m POST http://perlcritic.com/perl/critic.pl < MyModule.pm + $> wget -q -O - --post-file=MyModule.pm http://perlcritic.com/perl/critic.pl + + Please note that the perlcritic web-service is still alpha code. The URL + and interface to the service are subject to change. + +CONSTRUCTOR + "new( [ -profile => $FILE, -severity => $N, -theme => $string, -include + => \@PATTERNS, -exclude => \@PATTERNS, -top => $N, -only => $B, + -profile-strictness => $PROFILE_STRICTNESS_{WARN|FATAL|QUIET}, -force => + $B, -verbose => $N ], -color => $B, -criticism-fatal => $B)" + "new( -config => Perl::Critic::Config->new() )" + "new()" + Returns a reference to a new Perl::Critic object. Most arguments are + just passed directly into Perl::Critic::Config, but I have described + them here as well. The default value for all arguments can be + defined in your .perlcriticrc file. See the "CONFIGURATION" section + for more information about that. All arguments are optional + key-value pairs as follows: + + -profile is a path to a configuration file. If $FILE is not defined, + Perl::Critic::Config attempts to find a .perlcriticrc configuration + file in the current directory, and then in your home directory. + Alternatively, you can set the "PERLCRITIC" environment variable to + point to a file in another location. If a configuration file can't + be found, or if $FILE is an empty string, then all Policies will be + loaded with their default configuration. See "CONFIGURATION" for + more information. + + -severity is the minimum severity level. Only Policy modules that + have a severity greater than $N will be applied. Severity values are + integers ranging from 1 (least severe) to 5 (most severe). The + default is 5. For a given "-profile", decreasing the "-severity" + will usually reveal more Policy violations. You can set the default + value for this option in your .perlcriticrc file. Users can redefine + the severity level for any Policy in their .perlcriticrc file. See + "CONFIGURATION" for more information. + + If it is difficult for you to remember whether severity "5" is the + most or least restrictive level, then you can use one of these named + values: + + SEVERITY NAME ...is equivalent to... SEVERITY NUMBER + -------------------------------------------------------- + -severity => 'gentle' -severity => 5 + -severity => 'stern' -severity => 4 + -severity => 'harsh' -severity => 3 + -severity => 'cruel' -severity => 2 + -severity => 'brutal' -severity => 1 + + -theme is special expression that determines which Policies to apply + based on their respective themes. For example, the following would + load only Policies that have a 'bugs' AND 'pbp' theme: + + my $critic = Perl::Critic->new( -theme => 'bugs && pbp' ); + + Unless the "-severity" option is explicitly given, setting "-theme" + silently causes the "-severity" to be set to 1. You can set the + default value for this option in your .perlcriticrc file. See the + "POLICY THEMES" section for more information about themes. + + -include is a reference to a list of string @PATTERNS. Policy + modules that match at least one "m/$PATTERN/imx" will always be + loaded, irrespective of all other settings. For example: + + my $critic = Perl::Critic->new(-include => ['layout'] -severity => 4); + + This would cause Perl::Critic to apply all the "CodeLayout::*" + Policy modules even though they have a severity level that is less + than 4. You can set the default value for this option in your + .perlcriticrc file. You can also use "-include" in conjunction with + the "-exclude" option. Note that "-exclude" takes precedence over + "-include" when a Policy matches both patterns. + + -exclude is a reference to a list of string @PATTERNS. Policy + modules that match at least one "m/$PATTERN/imx" will not be loaded, + irrespective of all other settings. For example: + + my $critic = Perl::Critic->new(-exclude => ['strict'] -severity => 1); + + This would cause Perl::Critic to not apply the "RequireUseStrict" + and "ProhibitNoStrict" Policy modules even though they have a + severity level that is greater than 1. You can set the default value + for this option in your .perlcriticrc file. You can also use + "-exclude" in conjunction with the "-include" option. Note that + "-exclude" takes precedence over "-include" when a Policy matches + both patterns. + + -single-policy is a string "PATTERN". Only one policy that matches + "m/$PATTERN/imx" will be used. Policies that do not match will be + excluded. This option has precedence over the "-severity", "-theme", + "-include", "-exclude", and "-only" options. You can set the default + value for this option in your .perlcriticrc file. + + -top is the maximum number of Violations to return when ranked by + their severity levels. This must be a positive integer. Violations + are still returned in the order that they occur within the file. + Unless the "-severity" option is explicitly given, setting "-top" + silently causes the "-severity" to be set to 1. You can set the + default value for this option in your .perlcriticrc file. + + -only is a boolean value. If set to a true value, Perl::Critic will + only choose from Policies that are mentioned in the user's profile. + If set to a false value (which is the default), then Perl::Critic + chooses from all the Policies that it finds at your site. You can + set the default value for this option in your .perlcriticrc file. + + -profile-strictness is an enumerated value, one of + "$PROFILE_STRICTNESS_WARN" in Perl::Critic::Utils::Constants (the + default), "$PROFILE_STRICTNESS_FATAL" in + Perl::Critic::Utils::Constants, and "$PROFILE_STRICTNESS_QUIET" in + Perl::Critic::Utils::Constants. If set to + "$PROFILE_STRICTNESS_FATAL" in Perl::Critic::Utils::Constants, + Perl::Critic will make certain warnings about problems found in a + .perlcriticrc or file specified via the -profile option fatal. For + example, Perl::Critic normally only "warn"s about profiles referring + to non-existent Policies, but this value makes this situation fatal. + Correspondingly, "$PROFILE_STRICTNESS_QUIET" in + Perl::Critic::Utils::Constants makes Perl::Critic shut up about + these things. + + -force is a boolean value that controls whether Perl::Critic + observes the magical "## no critic" pseudo-pragmas in your code. If + set to a true value, Perl::Critic will analyze all code. If set to a + false value (which is the default) Perl::Critic will ignore code + that is tagged with these comments. See "BENDING THE RULES" for more + information. You can set the default value for this option in your + .perlcriticrc file. + + -verbose can be a positive integer (from 1 to 11), or a literal + format specification. See Perl::Critic::Violation for an explanation + of format specifications. You can set the default value for this + option in your .perlcriticrc file. + + -color is not used by Perl::Critic but is provided for the benefit + of perlcritic. + + -criticism-fatal is not used by Perl::Critic but is provided for the + benefit of criticism. + + -config is a reference to a Perl::Critic::Config object. If you have + created your own Config object for some reason, you can pass it in + here instead of having Perl::Critic create one for you. Using the + "-config" option causes all the other options to be silently + ignored. + +METHODS + "critique( $source_code )" + Runs the $source_code through the Perl::Critic engine using all the + Policies that have been loaded into this engine. If $source_code is + a scalar reference, then it is treated as a string of actual Perl + code. If $source_code is a reference to an instance of + PPI::Document, then that instance is used directly. Otherwise, it is + treated as a path to a local file containing Perl code. This method + returns a list of Perl::Critic::Violation objects for each violation + of the loaded Policies. The list is sorted in the order that the + Violations appear in the code. If there are no violations, this + method returns an empty list. + + "add_policy( -policy => $policy_name, -params => \%param_hash )" + Creates a Policy object and loads it into this Critic. If the object + cannot be instantiated, it will throw a fatal exception. Otherwise, + it returns a reference to this Critic. + + -policy is the name of a Perl::Critic::Policy subclass module. The + 'Perl::Critic::Policy' portion of the name can be omitted for + brevity. This argument is required. + + -params is an optional reference to a hash of Policy parameters. The + contents of this hash reference will be passed into to the + constructor of the Policy module. See the documentation in the + relevant Policy module for a description of the arguments it + supports. + + " policies() " + Returns a list containing references to all the Policy objects that + have been loaded into this engine. Objects will be in the order that + they were loaded. + + " config() " + Returns the Perl::Critic::Config object that was created for or + given to this Critic. + + " statistics() " + Returns the Perl::Critic::Statistics object that was created for + this Critic. The Statistics object accumulates data for all files + that are analyzed by this Critic. + +FUNCTIONAL INTERFACE + For those folks who prefer to have a functional interface, The + "critique" method can be exported on request and called as a static + function. If the first argument is a hashref, its contents are used to + construct a new Perl::Critic object internally. The keys of that hash + should be the same as those supported by the "Perl::Critic::new" method. + Here are some examples: + + use Perl::Critic qw(critique); + + # Use default parameters... + @violations = critique( $some_file ); + + # Use custom parameters... + @violations = critique( {-severity => 2}, $some_file ); + + # As a one-liner + %> perl -MPerl::Critic=critique -e 'print critique(shift)' some_file.pm + + None of the other object-methods are currently supported as static + functions. Sorry. + +CONFIGURATION + Most of the settings for Perl::Critic and each of the Policy modules can + be controlled by a configuration file. The default configuration file is + called .perlcriticrc. Perl::Critic will look for this file in the + current directory first, and then in your home directory. Alternatively, + you can set the "PERLCRITIC" environment variable to explicitly point to + a different file in another location. If none of these files exist, and + the "-profile" option is not given to the constructor, then all the + modules that are found in the Perl::Critic::Policy namespace will be + loaded with their default configuration. + + The format of the configuration file is a series of INI-style blocks + that contain key-value pairs separated by '='. Comments should start + with '#' and can be placed on a separate line or after the name-value + pairs if you desire. + + Default settings for Perl::Critic itself can be set before the first + named block. For example, putting any or all of these at the top of your + configuration file will set the default value for the corresponding + constructor argument. + + severity = 3 #Integer or named level + only = 1 #Zero or One + force = 0 #Zero or One + verbose = 4 #Integer or format spec + top = 50 #A positive integer + theme = (pbp || security) && bugs #A theme expression + include = NamingConventions ClassHierarchies #Space-delimited list + exclude = Variables Modules::RequirePackage #Space-delimited list + criticism-fatal = 1 #Zero or One + color = 1 #Zero or One + + The remainder of the configuration file is a series of blocks like this: + + [Perl::Critic::Policy::Category::PolicyName] + severity = 1 + set_themes = foo bar + add_themes = baz + maximum_violations_per_document = 57 + arg1 = value1 + arg2 = value2 + + "Perl::Critic::Policy::Category::PolicyName" is the full name of a + module that implements the policy. The Policy modules distributed with + Perl::Critic have been grouped into categories according to the table of + contents in Damian Conway's book Perl Best Practices. For brevity, you + can omit the 'Perl::Critic::Policy' part of the module name. + + "severity" is the level of importance you wish to assign to the Policy. + All Policy modules are defined with a default severity value ranging + from 1 (least severe) to 5 (most severe). However, you may disagree with + the default severity and choose to give it a higher or lower severity, + based on your own coding philosophy. You can set the "severity" to an + integer from 1 to 5, or use one of the equivalent names: + + SEVERITY NAME ...is equivalent to... SEVERITY NUMBER + ---------------------------------------------------- + gentle 5 + stern 4 + harsh 3 + cruel 2 + brutal 1 + + "set_themes" sets the theme for the Policy and overrides its default + theme. The argument is a string of one or more whitespace-delimited + alphanumeric words. Themes are case-insensitive. See "POLICY THEMES" for + more information. + + "add_themes" appends to the default themes for this Policy. The argument + is a string of one or more whitespace-delimited words. Themes are + case-insensitive. See "POLICY THEMES" for more information. + + "maximum_violations_per_document" limits the number of Violations the + Policy will return for a given document. Some Policies have a default + limit; see the documentation for the individual Policies to see whether + there is one. To force a Policy to not have a limit, specify "no_limit" + or the empty string for the value of this parameter. + + The remaining key-value pairs are configuration parameters that will be + passed into the constructor for that Policy. The constructors for most + Policy objects do not support arguments, and those that do should have + reasonable defaults. See the documentation on the appropriate Policy + module for more details. + + Instead of redefining the severity for a given Policy, you can + completely disable a Policy by prepending a '-' to the name of the + module in your configuration file. In this manner, the Policy will never + be loaded, regardless of the "-severity" given to the Perl::Critic + constructor. + + A simple configuration might look like this: + + #-------------------------------------------------------------- + # I think these are really important, so always load them + + [TestingAndDebugging::RequireUseStrict] + severity = 5 + + [TestingAndDebugging::RequireUseWarnings] + severity = 5 + + #-------------------------------------------------------------- + # I think these are less important, so only load when asked + + [Variables::ProhibitPackageVars] + severity = 2 + + [ControlStructures::ProhibitPostfixControls] + allow = if unless # My custom configuration + severity = cruel # Same as "severity = 2" + + #-------------------------------------------------------------- + # Give these policies a custom theme. I can activate just + # these policies by saying `perlcritic -theme larry` + + [Modules::RequireFilenameMatchesPackage] + add_themes = larry + + [TestingAndDebugging::RequireTestLables] + add_themes = larry curly moe + + #-------------------------------------------------------------- + # I do not agree with these at all, so never load them + + [-NamingConventions::ProhibitMixedCaseVars] + [-NamingConventions::ProhibitMixedCaseSubs] + + #-------------------------------------------------------------- + # For all other Policies, I accept the default severity, + # so no additional configuration is required for them. + + For additional configuration examples, see the perlcriticrc file that is + included in this examples directory of this distribution. + + Damian Conway's own Perl::Critic configuration is also included in this + distribution as examples/perlcriticrc-conway. + +THE POLICIES + A large number of Policy modules are distributed with Perl::Critic. They + are described briefly in the companion document + Perl::Critic::PolicySummary and in more detail in the individual modules + themselves. Say ""perlcritic -doc PATTERN"" to see the perldoc for all + Policy modules that match the regex "m/PATTERN/imx" + + There are a number of distributions of additional policies on CPAN. If + Perl::Critic doesn't contain a policy that you want, some one may have + already written it. See the "SEE ALSO" section below for a list of some + of these distributions. + +POLICY THEMES + Each Policy is defined with one or more "themes". Themes can be used to + create arbitrary groups of Policies. They are intended to provide an + alternative mechanism for selecting your preferred set of Policies. For + example, you may wish disable a certain subset of Policies when + analyzing test scripts. Conversely, you may wish to enable only a + specific subset of Policies when analyzing modules. + + The Policies that ship with Perl::Critic are have been broken into the + following themes. This is just our attempt to provide some basic logical + groupings. You are free to invent new themes that suit your needs. + + THEME DESCRIPTION + -------------------------------------------------------------------------- + core All policies that ship with Perl::Critic + pbp Policies that come directly from "Perl Best Practices" + bugs Policies that that prevent or reveal bugs + maintenance Policies that affect the long-term health of the code + cosmetic Policies that only have a superficial effect + complexity Policies that specificaly relate to code complexity + security Policies that relate to security issues + tests Policies that are specific to test scripts + + Any Policy may fit into multiple themes. Say "perlcritic -list" to get a + listing of all available Policies and the themes that are associated + with each one. You can also change the theme for any Policy in your + .perlcriticrc file. See the "CONFIGURATION" section for more information + about that. + + Using the "-theme" option, you can create an arbitrarily complex rule + that determines which Policies will be loaded. Precedence is the same as + regular Perl code, and you can use parentheses to enforce precedence as + well. Supported operators are: + + Operator Altertative Example + ---------------------------------------------------------------------------- + && and 'pbp && core' + || or 'pbp || (bugs && security)' + ! not 'pbp && ! (portability || complexity)' + + Theme names are case-insensitive. If the "-theme" is set to an empty + string, then it evaluates as true all Policies. + +BENDING THE RULES + Perl::Critic takes a hard-line approach to your code: either you comply + or you don't. In the real world, it is not always practical (nor even + possible) to fully comply with coding standards. In such cases, it is + wise to show that you are knowingly violating the standards and that you + have a Damn Good Reason (DGR) for doing so. + + To help with those situations, you can direct Perl::Critic to ignore + certain lines or blocks of code by using pseudo-pragmas: + + require 'LegacyLibaray1.pl'; ## no critic + require 'LegacyLibrary2.pl'; ## no critic + + for my $element (@list) { + + ## no critic + + $foo = ""; #Violates 'ProhibitEmptyQuotes' + $barf = bar() if $foo; #Violates 'ProhibitPostfixControls' + #Some more evil code... + + ## use critic + + #Some good code... + do_something($_); + } + + The "## no critic" comments direct Perl::Critic to ignore the remaining + lines of code until the end of the current block, or until a ""## use + critic"" comment is found (whichever comes first). If the "## no critic" + comment is on the same line as a code statement, then only that line of + code is overlooked. To direct perlcritic to ignore the "## no critic" + comments, use the "-force" option. + + A bare "## no critic" comment disables all the active Policies. If you + wish to disable only specific Policies, add a list of Policy names as + arguments, just as you would for the "no strict" or "no warnings" + pragmas. For example, this would disable the "ProhibitEmptyQuotes" and + "ProhibitPostfixControls" policies until the end of the block or until + the next "## use critic" comment (whichever comes first): + + ## no critic (EmptyQuotes, PostfixControls) + + # Now exempt from ValuesAndExpressions::ProhibitEmptyQuotes + $foo = ""; + + # Now exempt ControlStructures::ProhibitPostfixControls + $barf = bar() if $foo; + + # Still subjected to ValuesAndExpression::RequireNumberSeparators + $long_int = 10000000000; + + Since the Policy names are matched against the "## no critic" arguments + as regular expressions, you can abbreviate the Policy names or disable + an entire family of Policies in one shot like this: + + ## no critic (NamingConventions) + + # Now exempt from NamingConventions::ProhibitMixedCaseVars + my $camelHumpVar = 'foo'; + + # Now exempt from NamingConventions::ProhibitMixedCaseSubs + sub camelHumpSub {} + + The argument list must be enclosed in parentheses and must contain one + or more comma-separated barewords (e.g. don't use quotes). The "## no + critic" pragmas can be nested, and Policies named by an inner pragma + will be disabled along with those already disabled an outer pragma. + + Some Policies like "Subroutines::ProhibitExcessComplexity" apply to an + entire block of code. In those cases, "## no critic" must appear on the + line where the violation is reported. For example: + + sub complicated_function { ## no critic (ProhibitExcessComplexity) + # Your code here... + } + + Policies such as "Documentation::RequirePodSections" apply to the entire + document, in which case violations are reported at line 1. But if the + file requires a shebang line, it is impossible to put "## no critic" on + the first line of the file. This is a known limitation and it will be + addressed in a future release. As a workaround, you can disable the + affected policies at the command-line or in your .perlcriticrc file. But + beware that this will affect the analysis of all files. + + Use this feature wisely. "## no critic" should be used in the smallest + possible scope, or only on individual lines of code. And you should + always be as specific as possible about which policies you want to + disable (i.e. never use a bare "## no critic"). If Perl::Critic + complains about your code, try and find a compliant solution before + resorting to this feature. + +THE Perl::Critic PHILOSOPHY + Coding standards are deeply personal and highly subjective. The goal of + Perl::Critic is to help you write code that conforms with a set of best + practices. Our primary goal is not to dictate what those practices are, + but rather, to implement the practices discovered by others. Ultimately, + you make the rules -- Perl::Critic is merely a tool for encouraging + consistency. If there is a policy that you think is important or that we + have overlooked, we would be very grateful for contributions, or you can + simply load your own private set of policies into Perl::Critic. + +EXTENDING THE CRITIC + The modular design of Perl::Critic is intended to facilitate the + addition of new Policies. You'll need to have some understanding of PPI, + but most Policy modules are pretty straightforward and only require + about 20 lines of code. Please see the Perl::Critic::DEVELOPER file + included in this distribution for a step-by-step demonstration of how to + create new Policy modules. + + If you develop any new Policy modules, feel free to send them to + "" and I'll be happy to put them into the Perl::Critic + distribution. Or if you would like to work on the Perl::Critic project + directly, check out our repository at . To + subscribe to our mailing list, send a message to + "". + + The Perl::Critic team is also available for hire. If your organization + has its own coding standards, we can create custom Policies to enforce + your local guidelines. Or if your code base is prone to a particular + defect pattern, we can design Policies that will help you catch those + costly defects before they go into production. To discuss your needs + with the Perl::Critic team, just contact "". + +PREREQUISITES + Perl::Critic requires the following modules: + + B::Keywords + + Config::Tiny + + Exception::Class + + File::Spec + + File::Spec::Unix + + IO::String + + List::MoreUtils + + List::Util + + Module::Pluggable + + PPI + + Pod::PlainText + + Pod::Usage + + Readonly + + Scalar::Util + + String::Format + + version + + The following modules are optional, but recommended for complete + testing: + + File::HomeDir + + File::Which + + IO::String + + IPC::Open2 + + Perl::Tidy + + Pod::Spell + + Test::Pod + + Test::Pod::Coverage + + Text::ParseWords + +CONTACTING THE DEVELOPMENT TEAM + You are encouraged to subscribe to the mailing list; send a message to + "". See also the archives. You + can also contact the author at "". + + At least one member of the development team has started hanging around + in . + +SEE ALSO + There are a number of distributions of additional Policies available. A + few are listed here: + + Perl::Critic::More + + Perl::Critic::Bangs + + Perl::Critic::Lax + + Perl::Critic::StricterSubs + + Perl::Critic::Swift + + Perl::Critic::Tics + + These distributions enable you to use Perl::Critic in your unit tests: + + Test::Perl::Critic + + Test::Perl::Critic::Progressive + + There are also a couple of distributions that will install all the + Perl::Critic related modules known to the development team: + + Bundle::Perl::Critic + + Task::Perl::Critic + + If you want to make sure you have absolutely everything, you can use + these: + + Bundle::Perl::Critic::IncludingOptionalDependencies + + Task::Perl::Critic::IncludingOptionalDependencies + +BUGS + Scrutinizing Perl code is hard for humans, let alone machines. If you + find any bugs, particularly false-positives or false-negatives from a + Perl::Critic::Policy, please submit them to + . Thanks. + + Most policies will produce false-negatives if they cannot understand a + particular block of code. + +CREDITS + Adam Kennedy - For creating PPI, the heart and soul of Perl::Critic. + + Damian Conway - For writing Perl Best Practices, finally :) + + Chris Dolan - For contributing the best features and Policy modules. + + Andy Lester - Wise sage and master of all-things-testing. + + Elliot Shank - The self-proclaimed quality freak. + + Giuseppe Maxia - For all the great ideas and positive encouragement. + + and Sharon, my wife - For putting up with my all-night code sessions. + + Thanks also to the Perl Foundation for providing a grant to support + Chris Dolan's project to implement twenty PBP policies. + + +AUTHOR + Jeffrey Ryan Thalhammer + +COPYRIGHT + Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/TODO.pod b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/TODO.pod new file mode 100644 index 0000000..69dab1f --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/TODO.pod @@ -0,0 +1,574 @@ +# best viewed via "perldoc TODO.pod" + +=pod + +=for stopwords LHS RHS REFACTORINGS FH SVN stopwords + +=head1 NAME + +Perl::Critic::TODO - Things for Perl::Critic developers to do + + +=head1 SOURCE + + ####################################################################### + # $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/TODO.pod $ + # $Date: 2008-07-03 09:36:05 -0500 (Thu, 03 Jul 2008) $ + # $Author: clonezone $ + # $Revision: 2487 $ + ####################################################################### + + +=head1 SEE ALSO + +Perl-Critic-More is a separate distribution for less-widely-accepted +policies. It contains its own TODO.pod. + + +=head1 NEW FEATURES + +=over + +=item * Report Safari sections in addition to book page numbers. + + +=item * Add --files-with-violations/-l and --files-without-violations/-L options to F. + +Just print out file names. I could have used this at work when combined with +C<--single-policy>. + + gvim `perlcritic --single-policy QuotedWordLists -l` + + +=item * Add a file Behavior. + + +=item * Allow values of (at least) string-list Parameters to be specified in a file. + +For the benefit of PodSpelling, etc. + + +=item * Enhance string-list Behavior to allow specification of delimiters. + +For things like RequirePodSections. + + +=item * Add queries to --list option to F. + +List Policies based upon severity, theme, and (what I want this second) +applies_to. + +=item * Add --prohibit-unrestricted-no-critic option to F. + +Requires C<## no critic> to take an argument: + + ## no critic (SomePolicyPattern) # ok + ## no critic # not ok + +Can't be done as a regular Policy because any line that violated it would disable it. + + +=item * Support for C<#line 123 "filename"> directives. + +For code generators and template languages that allow inline Perl code. + +Yes, somebody has an in-house templating system where they've written a custom +test module that extracts the perl code from a template and critiques it. + +Actually, this would be useful for programs: Module::Build "fixes" shebang +lines so that there's the bit about invoking perl if the program is attempted +to be run by a Bourne shell, which throws the line numbers off when using +Test::P::C on the contents of a C directory. + + +=item * Enhance statistics. + +- Blank line count + +- POD line count + +- Comment line count + +- Data section count + + +=item * Detect 5.10 source and enable stuff for that. + +For example, treat C as equivalent to C. + + +=item * Support a means of failing if a Policy isn't installed. + +For example, the self compliance test now depends upon a Policy in the More +distribution. + +Something like using a "+" sign in front of the Policy name in its +configuration block, analogous to the "-" sign used for disabling a policy, +e.g. "C<[+Example::Policy]>". + + +=back + + +=head1 BUGS/LIMITATIONS + +=over + +=item * NamingConventions::ProhibitAmbiguousNames + +Don't allow compound names with forbidden words, like "last_record". +Allow forbidden words in RHS of variable declarations + +Also, we should make it easeir to add (or delete) words from the +forbbiden list. + + +=item * Subroutines::ProtectPrivateSubs + +Doesn't forbid C<< $pkg->_foo() >> because it can't tell the +difference between that and C<< $self->_foo() >> + + +=item * ErrorHandling::RequireCarping + +This should not complain about using C or C if it's not in a +function, or if it's in main::. + +Also, should allow C when it is obvious that the "message" is a reference. + + +=item * RegularExpressions::ProhibitCaptureWithoutTest + +Allow this construct: + + for ( ... ) { + next unless /(....)/; + if ( $1 ) { + .... + } + } + +Right now, P::C thinks that the C<$1> isn't legal to use because it's +"outside" of the match. The thing is, we can only get to the C +if the regex matched. + while ( $str =~ /(expression)/ ) + + +=item * CodeLayout::ProhibitParensWithBuiltins + +Some builtin functions (particularly those that take a variable number of +scalar arguments) should probably get parentheses. This policy should be +enhanced to allow the user to specify a list of builtins that are expempt +from the policy. + + +=item * ValuesAndExpressions::ProhibitCommaSeparatedStatements + +Needs to check for C. + + +=item * Variables::ProhibitPunctuationVars + +Needs to look inside strings. RT #35970. + + +=item * TestingAndDebugging::RequireUseWarnings + +Check for -w on the shbang line. + + +=item * Change formatting in Violation to eliminate double periods. + + +=back + + +=head1 OTHER PBP POLICIES THAT SEEM FEASIBLE TO IMPLEMENT + +=over + +=item * Modules::RequireUseVersion [405-406] + +=item * Modules::RequireThreePartVersion [405-406] + +=item * RegularExpressions::RequireDotMatchAnything [240-241] + +=back + + +=head1 NON-PBP POLICIES WANTED + +=over + +=item * Documentation::RequireModuleAbstract + +Require a C<=head1 NAME> POD section with content that matches +C<\A \s* [\w:]+ \s+ - \s+ \S>. The single hyphen is the important bit. Also, +must be a single line. + +=item * Expressions::RequireFatCommasInHashConstructors + +=item * ErrorHandling::RequireLocalizingEvalErrorInDESTROY + +Prevent C<$@> from being cleared unexpectedly by DESTROY methods. + + package Foo; + + sub DESTROY { + die "Died in Foo::DESTROY()"; + } + + package main; + + eval { + my $foo = Foo->new(); + + die "Died in eval." + } + print $@; # "Died in Foo::DESTROY()", not "Died in eval.". + +See L. + +=item * Expressions::ProhibitDecimalWithBitwiseOperator + +=item * Expressions::ProhibitStringsWithBitwiseOperator + + +=item * InputOutput::ProhibitMagicDiamond + +Steal the idea from L. + + +=item * TBD::AllProgramsNeedShebangs + +Anything that is a program should have a shebang line. This includes .t files. + + +=item * BuiltInFunctions::RequireConstantSprintfFormat + + +=item * BuiltInFunctions::RequireConstantUnpackFormat + +L + + +=item * Miscellanea::ProhibitObnoxiousComments + +Forbid excessive hash marks e.g. "#### This is a loud comment ####". +Make the obnoxious pattern configurable + + +=item * ValuesAndExpressions::RequireNotOperator + +Require the use of "not" instead of "!", except when this would contradict +ProhibitMixedBooleanOperators. This may be better suited for +Perl::Critic::More. + + +=item * Modules::RequireExplicitImporting + +Require every C statement to have an explicit import list. You could +still get around this by calling C directly. + + +=item * Modules::ForbidImporting + +Require every C to have an explicitly empty import list. This is for +folks who like to see fully-qualified function names. Should probably provide +a list of exempt modules (like FindBin); + + +=item * ControlStructures::ProhibitIncludeViaDo + +Forbid C. Not sure about this policy name. + + +=item * Variables::ProhibitUseVars + +Disallow C and require C instead. This +contradicts Miscellanea::Prohibit5006isms. Maybe verify C +before applying this policy. Low severity. + + +=item * VariablesAndExpressions::ProhibitQuotedHashKeys + +Forbid quotes around hash keys, unless they are really needed. This +is against what Damian says. Suggested by Adam Kennedy. Low +severity. + + +=item * CodeLayout::ProhibitFunctionalNew + +Good: C<< Foo::Bar->new >>, Bad: C<< new Foo::Bar >> + + +=item * RegularExpressions::ProhibitSWSWSW + +Require C instead of C. From MJD's Red Flags. + + +=item * VariablesAndExpressions::RequireConstantVersion (low severity) + + +=item * VariablesAndExpressions::ProhibitComplexVersion (medium severity) + +L + + +=item * Documentation::RequireSynopsis + + +=item * Documentation::RequireLicense + +These are simplified versions of Documentation::RequirePodSections. + + +=item * Documentation::RequireValidSynopsis + +The Synopsis section must be all indented and must be syntactically valid Perl +(as validated by PPI). + + +=item * Documentation::ProhibitEmptySections + +Any C<=headN> and C<=over> sections must not be empty. This helps catch +boilerplate (althought Test::Pod should catch empty C<=over> blocks). + +On the other hand, C<=item ...> sections can be empty, since the item label is +content. + + +=item * Miscellaneous::ProhibitBoilerplate + +Complain about copy-and-paste code or docs from h2xs, Module::Starter::*, +etc. + +Here's a non-PPI implementation: +L + + +=item * BuiltinFunctions::ProhibitExtraneousScalarCall + +Recommend that C be rewritten as C. + + +=item * RegularExpressions::ProhibitMixedDelimiters + +Ban s{foo}(bar) + + +=item * RegularExpressions::ProhibitScalarAsRegexp + +Ban naked srtings as regexps, like: + + print 1 if $str =~ $regexp; + +Instead, it should be: + + print 1 if $str =~ m/$regexp/; + +or + + print 1 if $str =~ m/$regexp/xms; + + +=item * ValuesAndExpressions::RequireInterpolatedStringyEval + +Ensure that the argument to a stringy eval is not a constant string. That's +just wasteful. Real world examples include: + + eval 'use Optional::Module'; + +which is better written as + + eval { require Optional::Module; Optional::Module->import }; + +for performance gains and compile-time syntax checking. + + +=item * RegularExpressions::ProhibitUnnecessaryEscapes + +Complain if user puts a backslash escape in front of non-special characters. For example: + + m/\!/; + +Make exceptions for C<\">, C<\'> and C<\`> since those are often inserted to +workaround bugs in syntax highlighting. + +Note that this is different inside character classes, where only C<^>, C<]> +and C<-> need to be escaped, I think. Caret only needs to be escaped at the +beginning, and dash does NOT need to be escaped at the beginning and end. See +L. + + +=item * Steal ideas from L. + +Can someone expand this entry, please? + +=item * ControlStructures::ProhibitAssigmentInConditional + +=item * ValuesAndExpressions::RequireConstantBeforeEquals + +=item * ValuesAndExpressions::RequireConstantBeforeOperator + +L + +Just about everyone has been bitten by C when they meant +to use C<==>. A safer style is C<10 == $x> because omitting the second C<=> +yields a noisy compile-time failure instead of silent runtime error. + +ProhibitAssigmentInConditional complains if the condition of a while, until, +if or unless is solely an assignment. If it's anything more complex (like +C or C), there is no warning. + +RequireConstantBeforeEquals complains if the left side of an C<==> is a +variable while the right side is a constant. + +RequireConstantBeforeOperator complains if the left side of any comparison +operator (C<==>, C, C<<>, etc) is a variable while the right side is a +constant. + + +=item * InputOutput::ProhibitUTF8IOLayer + +http://www.perlfoundation.org/perl5/index.cgi?the_utf8_perlio_layer + +=item * BuiltinFunctions::ProhibitExit(?:InModules)? + +Forbid C in files that lack a shebang. Inspired by +L and an analgous checker in +FindBugs. + +=back + + +=head1 REFACTORINGS and ENHANCEMENTS + +=over + +=item * Create constants for the PPI location array elements. + + +=item * MOVE THE LINE-DISABLING INTO P::C::Document + +All the code that deals with finding all the '##no critic' comments and noting +which policies are disabled at each line seems like it would be better placed +in Perl::Critic::Document. P::C::Document could then provide methods to +indicate if a policy is disabled at a particular line. So the basic algorithm +in Perl::Critic might look something like this: + + foreach $element (@PPI_ELEMENTS) { + foreach $policy (@POLICIES) { + $line = $element->location->[0]; + next if $doc->policy_is_disabled_at_line( $policy, $line ); + push @violations, $policy->violates( $elem, $doc ); + } + } + + +=item * Some means of detecting "runnaway" C<##no critic> + +Elliot was talking to a couple of users at ETech and one of their major +concerns was that they were using C<##no critic> and forgetting to do a +C<##use critic> after the problematic section. Perhaps an option to +F to scan for such things is in order. + + +=item * Change API to use named parameters + +Most of the methods on the public classes use named parameters for passing +arguments. I'd like to extend that pattern to include all object-methods. +Static methods can still use positional parameters. + + +=item * Enhance P::C::critique() to accept files, directories, or code strings + +Just like F does now. + + +=item * Add C<-cache> flag to F + +If enabled, this turns on L: + + require PPI::Cache; + my $cache_path = "/tmp/test-perl-critic-cache-$ENV{USER}"; + mkdir $cache_path, oct 700 if (! -d $cache_path); + PPI::Cache->import(path => $cache_path); + +This cachedir should perhaps include the PPI version number! At least +until PPI incorporates its own version number in the cache. + +(see F for a more robust implementation) + + +=item * Use hash-lookup instead of C function. + +In several places, Perl::Critic uses C to see if +a string is a member of a list. Instead, I suggest using a named +subroutine that does a hash-lookup like this: + + my %logical_ops = hashify( qw( ! || && ||= &&= and or not ) ); + sub is_logical_op { return exists $logical_ops{ $_[0] }; } + +Why? + + +=item * Allow color output to work through a pipe. + +http://rt.cpan.org/Ticket/Display.html?id=30140 + +F now supports this. + + +=back + +=head1 PPI BUGS + +We're waiting on the following bugs to get fixed in a CPAN release of PPI: + + +=over + +=item PPI::Token::descendant_of() + +Exists in svn. Replace _descendant_of() in RequireCheckingReturnValueOfEval +with that, once it is released, because it's faster and native. + +=item Newlines + +PPI does not preserve newlines. That makes +CodeLayout::RequireConsistentNewlines impossible to implement under PPI. For +now, it's implemented by pulling the source out of the file and skipping PPI. + +It's unlikely that PPI will support mixde newlines anytime soon. + + +=item Operators + +ValuesAndExpressions::ProhibitMismatchedOperators has two workarounds +for PPI bugs with parsing operators. Many of these bugs have been +fixed in PPI, so it would be good to check if those workarounds are +still needed. + + +=item Regexp methods + +Not strictly a bug -- the PPI Regexp classes have a dearth of accessor methods +as of v1.118, meaning that we have to do messy digging into internals. I +wrote Perl::Critic:Utils::PPIRegexp to encapsulate this messiness, but it +would be nicer to have an official interface in PPI. + + +=back + +=cut + +############################################################################## +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=pod expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/bin/perlcritic b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/bin/perlcritic new file mode 100755 index 0000000..213d75e --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/bin/perlcritic @@ -0,0 +1,1387 @@ +#!/usr/bin/perl + +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/bin/perlcritic $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +## no critic (ErrorHandling::RequireUseOfExceptions) +package main; + +use 5.006001; +use strict; +use warnings; + +use English qw< -no_match_vars >; +use Readonly; + +use Getopt::Long qw< GetOptions >; +use List::Util qw< first >; +use Pod::Usage qw< pod2usage >; + +use Perl::Critic::Exception::Parse (); +use Perl::Critic::Utils qw< + :characters :severities policy_short_name + $DEFAULT_VERBOSITY $DEFAULT_VERBOSITY_WITH_FILE_NAME +>; +use Perl::Critic::Violation qw<>; + +#----------------------------------------------------------------------------- + +our $VERSION = '1.088'; + +Readonly::Scalar my $DEFAULT_VIOLATIONS_FOR_TOP => 20; + +Readonly::Scalar my $EXIT_SUCCESS => 0; +Readonly::Scalar my $EXIT_NO_FILES => 1; +Readonly::Scalar my $EXIT_HAD_VIOLATIONS => 2; +Readonly::Scalar my $EXIT_HAD_FILE_PROBLEMS => 3; + +#----------------------------------------------------------------------------- +# Begin script. Don't run when loaded as a library + +my @FILES = (); +my $CRITIC = undef; +exit run() if not caller; + +#----------------------------------------------------------------------------- +# Begin subroutines + +sub run { + my %options = get_options(); + @FILES = get_input(@ARGV); + + my ($violations, $had_error_in_file) = critique(\%options, @FILES); + + return $EXIT_HAD_FILE_PROBLEMS if $had_error_in_file; + return $EXIT_NO_FILES if not defined $violations; + return $EXIT_HAD_VIOLATIONS if $violations; + + return $EXIT_SUCCESS; +} + +#----------------------------------------------------------------------------- + +sub get_options { + + my %opts = _parse_command_line(); + _dispatch_special_requests( %opts ); + _validate_options( %opts ); + + # Convert severity shortcut options. If multiple shortcuts + # are given, the lowest one wins. If an explicit --severity + # option has been given, then the shortcuts are ignored. The + # @SEVERITY_NAMES variable is exported by Perl::Critic::Utils. + $opts{severity} ||= first { exists $opts{$_} } @SEVERITY_NAMES; + $opts{severity} ||= + first { exists $opts{$_} } ($SEVERITY_LOWEST .. $SEVERITY_HIGHEST); + + + # If --top is specified, default the severity level to 1, unless an + # explicit severity is defined. This provides us flexibility to + # report top-offenders across just some or all of the severity levels. + # We also default the --top count to twenty if none is given + if ( exists $opts{top} ) { + $opts{severity} ||= 1; + $opts{top} ||= $DEFAULT_VIOLATIONS_FOR_TOP; + } + + #Override profile, if --noprofile is specified + if ( exists $opts{noprofile} ) { + $opts{profile} = q{}; + } + + # I've adopted the convention of using key-value pairs for + # arguments to most functions. And to increase legibility, + # I have also adopted the familiar command-line practice + # of denoting argument names with a leading dash (-). + my %dashed_opts = map { ( "-$_" => $opts{$_} ) } keys %opts; + return %dashed_opts; +} + +#----------------------------------------------------------------------------- + +sub _parse_command_line { + my %opts = ( -color => 1 ); + my @opt_specs = _get_option_specification(); + Getopt::Long::Configure('no_ignore_case'); + GetOptions( \%opts, @opt_specs ) || pod2usage(); #Exits + return %opts; +} + +#----------------------------------------------------------------------------- + +sub _dispatch_special_requests { + my (%opts) = @_; + if ( $opts{help} ) { pod2usage( -verbose => 0 ) } #Exits + if ( $opts{options} ) { pod2usage( -verbose => 1 ) } #Exits + if ( $opts{man} ) { pod2usage( -verbose => 2 ) } #Exits + if ( $opts{version} ) { print "$VERSION\n"; exit 0; } #Exits + if ( $opts{list} ) { render_policy_listing(); } #Exits + if ( $opts{'list-themes'} ) { render_theme_listing(); } #Exits + if ( $opts{'profile-proto'} ) { render_profile_prototype(); } #Exits + if ( $opts{doc} ) { policy_docs( $opts{doc} ); } #Exits + return 1; +} + +#----------------------------------------------------------------------------- + +sub _validate_options { + my (%opts) = @_; + my $msg = q{}; + + + if ( $opts{noprofile} && $opts{profile} ) { + $msg .= qq{Warning: Cannot use -noprofile with -profile option.\n}; + } + + if ( $opts{verbose} && $opts{verbose} !~ m{(?: \d+ | %[mfFlcedrpPs] )}mx) { + $msg .= qq; + $msg .= qq; + } + + if ( exists $opts{top} && $opts{top} < 0 ) { + $msg .= qq; + $msg .= qq; + } + + if ( + exists $opts{severity} + && ( + $opts{severity} < $SEVERITY_LOWEST + || $opts{severity} > $SEVERITY_HIGHEST + ) + ) { + $msg .= qq; + $msg .= qq; + $msg .= qq<"$SEVERITY_HIGHEST" (highest).\n>; + } + + + if ( $msg ) { + pod2usage( -exitstatus => 1, -message => $msg, -verbose => 0); #Exits + } + + + return 1; +} + +#----------------------------------------------------------------------------- + +sub get_input { + + my @args = @_; + + if ( !@args || (@args == 1 && $args[0] eq q{-}) ) { + + # Reading code from STDIN. All the code is slurped into + # a string. PPI will barf if the string is just whitespace. + my $code_string = do { local $RS = undef; }; + + # Notice if STDIN was closed (pipe error, etc) + if ( ! defined $code_string ) { + $code_string = q{}; + } + + $code_string =~ m{ \S+ }mx || die qq{Nothing to critique.\n}; + return \$code_string; #Convert to SCALAR ref for PPI + } + else { + + # Test to make sure all the specified files or directories + # actually exist. If any one of them is bogus, then die. + if ( my $nonexistant = first { ! -e $_ } @args ) { + my $msg = qq{No such file or directory: '$nonexistant'}; + pod2usage( -exitstatus => 1, -message => $msg, -verbose => 0); + } + + # Reading code from files or dirs. If argument is a file, + # then we process it as-is (even though it may not actually + # be Perl code). If argument is a directory, recursively + # search the directory for files that look like Perl code. + return map { -d $_ ? Perl::Critic::Utils::all_perl_files($_) : $_ } @args; + } +} + +#------------------------------------------------------------------------------ + +sub critique { + + my ( $opts_ref, @files ) = @_; + @files || die "No perl files were found.\n"; + + # Perl::Critic has lots of dependencies, so loading is delayed + # until it is really needed. This hack reduces startup time for + # doing other things like getting the version number or dumping + # the man page. Arguably, those things are pretty rare, but hey, + # why not save a few seconds if you can. + + require Perl::Critic; + $CRITIC = Perl::Critic->new( %{$opts_ref} ); + $CRITIC->policies() || die "No policies selected.\n"; + + my $number_of_violations = undef; + my $had_error_in_file = 0; + + for my $file (@files) { + + eval { + my @violations = $CRITIC->critique($file); + $number_of_violations += scalar @violations; + + if (not $opts_ref->{'-statistics-only'}) { + render_report( $file, $opts_ref, @violations ) + } + 1; + } + or do { + if ( my $exception = Perl::Critic::Exception::Parse->caught() ) { + $had_error_in_file = 1; + warn qq; + } + elsif ($EVAL_ERROR) { + # P::C::Exception::Fatal includes the stack trace in its + # stringification. + die qq; + } + else { + die qq, + q<$@/$EVAL_ERROR >, ## no critic (RequireInterpolationOfMetachars) + qq; + } + } + } + + if ( $opts_ref->{-statistics} or $opts_ref->{'-statistics-only'} ) { + my $stats = $CRITIC->statistics(); + report_statistics( $opts_ref, $stats ); + } + + return $number_of_violations, $had_error_in_file; +} + +#------------------------------------------------------------------------------ + +sub render_report { + + my ( $file, $opts_ref, @violations ) = @_; + + # Only report the number of violations, if asked. + my $number_of_violations = scalar @violations; + if( $opts_ref->{-count} ){ + ref $file || print "$file: "; + print "$number_of_violations\n"; + return $number_of_violations; + } + + # Hail all-clear unless we should shut up. + if( !@violations && !$opts_ref->{-quiet} ) { + ref $file || print "$file "; + print "source OK\n"; + return 0; + } + + # Otherwise, format and print violations + my $verbosity = $CRITIC->config->verbose(); + # $verbosity can be numeric or string, so use "eq" for comparison; + $verbosity = + ($verbosity eq $DEFAULT_VERBOSITY && @FILES > 1) + ? $DEFAULT_VERBOSITY_WITH_FILE_NAME + : $verbosity; + my $fmt = Perl::Critic::Utils::verbosity_to_format( $verbosity ); + if (not -f $file) { $fmt =~ s{\%[fF]}{STDIN}mx; } #HACK! + Perl::Critic::Violation::set_format( $fmt ); + + my $color = $CRITIC->config->color(); + print $color ? _colorize_by_severity(@violations) : @violations; + + return $number_of_violations; +} + +#----------------------------------------------------------------------------- + +sub report_statistics { + my ($opts_ref, $statistics) = @_; + + if ( + not $opts_ref->{'-statistics-only'} + and ( + $statistics->total_violations() + or not $opts_ref->{-quiet} and $statistics->modules() + ) + ) { + print "\n"; # There's prior output that we want to separate from. + } + + print _commaify($statistics->modules()), " files.\n"; + print _commaify($statistics->subs()), " subroutines/methods.\n"; + print _commaify($statistics->statements_other_than_subs()), " statements.\n"; + print _commaify($statistics->lines()), " lines.\n"; + + my $average_sub_mccabe = $statistics->average_sub_mccabe(); + if (defined $average_sub_mccabe) { + printf + "\nAverage McCabe score of subroutines was %.2f.\n", + $average_sub_mccabe; + } + + print "\n"; + + print _commaify($statistics->total_violations()), " violations.\n"; + + my $violations_per_file = $statistics->violations_per_file(); + if (defined $violations_per_file) { + printf + "Violations per file was %.3f.\n", + $violations_per_file; + } + my $violations_per_statement = $statistics->violations_per_statement(); + if (defined $violations_per_statement) { + printf + "Violations per statement was %.3f.\n", + $violations_per_statement; + } + my $violations_per_line = $statistics->violations_per_line_of_code(); + if (defined $violations_per_line) { + printf + "Violations per line of code was %.3f.\n", + $violations_per_line; + } + + if ( $statistics->total_violations() ) { + print "\n"; + + my %severity_violations = %{ $statistics->violations_by_severity() }; + foreach my $severity ( reverse sort keys %severity_violations ) { + print + _commaify($severity_violations{$severity}), + " severity $severity violations.\n"; + } + + print "\n"; + + my %policy_violations = %{ $statistics->violations_by_policy() }; + foreach my $policy ( sort keys %policy_violations ) { + print + _commaify($policy_violations{$policy}), + ' violations of ', + policy_short_name($policy), + ".\n"; + } + } + + return; +} + +#----------------------------------------------------------------------------- + +# Only works for integers. +sub _commaify { + my ( $number ) = @_; + + while ($number =~ s/ \A ( [-+]? \d+ ) ( \d{3} ) /$1,$2/xms) { + # nothing + } + + return $number; +} + +#----------------------------------------------------------------------------- + +sub _get_option_specification { + + return qw( + 5 4 3 2 1 + Safari + version + brutal + count|C + cruel + doc=s + exclude=s@ + force! + gentle + harsh + help|?|H + include=s@ + list + list-themes + man + color|colour! + noprofile + only! + options + profile=s + profile-proto + quiet + severity=i + single-policy=s + stern + statistics! + statistics-only! + profile-strictness=s + theme=s + top:i + verbose=s + ); +} + +#----------------------------------------------------------------------------- + +sub _colorize_by_severity { + my (@violations) = @_; + return @violations if not _at_tty(); + return @violations if _this_is_windows(); + return @violations if not eval { require Term::ANSIColor }; + + my %color_of = ( + $SEVERITY_HIGHEST => 'bold red', + $SEVERITY_HIGH => 'yellow', + ); + return map { _colorize( "$_", $color_of{$_->severity()} ) } @violations; + +} + +#----------------------------------------------------------------------------- + +sub _colorize { + my ($string, $color) = @_; + return $string if not defined $color; + return Term::ANSIColor::colored( $string, $color ); +} + +#----------------------------------------------------------------------------- + +sub _this_is_windows { + return 1 if $OSNAME =~ m/MSWin32/mx; + return 0; +} + +#----------------------------------------------------------------------------- + +sub _at_tty { + return -t STDOUT; ##no critic 'InteractiveTest'; +} + +#----------------------------------------------------------------------------- + +sub render_policy_listing { + + require Perl::Critic::PolicyListing; + require Perl::Critic; + + my %pc_params = (-profile => $EMPTY, -severity => $SEVERITY_LOWEST); + my @policies = Perl::Critic->new( %pc_params )->policies(); + my $listing = Perl::Critic::PolicyListing->new( -policies => \@policies ); + print $listing; + exit 0; +} + +#----------------------------------------------------------------------------- + +sub render_theme_listing { + require Perl::Critic::ThemeListing; + require Perl::Critic; + + my %pc_params = (-profile => $EMPTY, -severity => $SEVERITY_LOWEST); + my @policies = Perl::Critic->new( %pc_params )->policies(); + my $listing = Perl::Critic::ThemeListing->new( -policies => \@policies ); + print $listing; + exit 0; +} + +#----------------------------------------------------------------------------- + +sub render_profile_prototype { + + require Perl::Critic::ProfilePrototype; + require Perl::Critic; + + my %pc_params = (-profile => $EMPTY, -severity => $SEVERITY_LOWEST); + my @policies = Perl::Critic->new( %pc_params )->policies(); + my $prototype = Perl::Critic::ProfilePrototype->new( -policies => \@policies ); + print $prototype; + exit 0; +} + +#----------------------------------------------------------------------------- + +sub policy_docs { + + my $pattern = shift; + require Perl::Critic; + + my %pc_params = (-profile => $EMPTY, -severity => $SEVERITY_LOWEST); + my @policies = Perl::Critic::Config->new( %pc_params )->policies(); + my @matches = grep { $_ =~ m/$pattern/imx } @policies; + + for my $matching_policy ( @matches ) { + my @perldoc_cmd = qw(perldoc -T); #-T means don't send to pager + system @perldoc_cmd, ref $matching_policy; + } + exit 0; +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords DGR INI-style vim-fu minibuffer -noprofile API -singlepolicy +singlepolicy -profileproto -profile-proto ben Jore formatter Peshak pbp Komodo +screenshots tty emacs gVIM plugin Perlish templating ActiveState + +=head1 NAME + +C - Command-line interface to critique Perl source. + +=head1 SYNOPSIS + + perlcritic [-12345 | --brutal | --cruel | --harsh | --stern | --gentle] + [--severity number | name] [--profile file | --noprofile] + [--top [ number ]] [--theme expression] [--include pattern] + [--exclude pattern] [--single-policy pattern] [--only | --noonly] + [--profile-strictness {warn|fatal|quiet}] [--force | --noforce] + [--statistics] [--statistics-only] [--verbose {number | format}] + [--color | --nocolor] [--quiet] {FILE | DIRECTORY | STDIN} + + perlcritic --profile-proto + + perlcritic { --list | --list-themes | --doc pattern [...] } + + perlcritic { --help | --options | --man | --version } + +=head1 DESCRIPTION + +C is a Perl source code analyzer. It is the executable +front-end to the L engine, which attempts to identify +awkward, hard to read, error-prone, or unconventional constructs in +your code. Most of the rules are based on Damian Conway's book B. However, C is B limited to +enforcing PBP, and it will even support rules that contradict Conway. +All rules can easily be configured or disabled to your liking. + +This documentation only covers how to drive this command. For all +other information, including how to persistently configure this +command so that you don't have to say so much on the command-line, +see the documentation for L itself. + + +=head1 USAGE EXAMPLES + +Before getting into all the gory details, here are some basic usage +examples to help get you started. + + # Report only most severe violations (severity = 5) + perlcritic YourModule.pm + + # Same as above, but read input from STDIN + perlcritic + + # Recursively process all Perl files beneath directory + perlcritic /some/directory + + # Report slightly less severe violations too (severity >= 4) + perlcritic -4 YourModule.pm + + # Same as above, but using named severity level + perlcritic --stern YourModule.pm + + # Report all violations, regardless of severity (severity >= 1) + perlcritic -1 YourModule.pm + + # Same as above, but using named severity level + perlcritic --brutal YourModule.pm + + # Report only violations of things from "Perl Best Practices" + perlcritic --theme pbp YourModule.pm + + # Report top 20 most severe violations (severity >= 1) + perlcritic --top YourModule.pm + + # Report additional violations of Policies that match m/variables/ix + perlcritic --include variables YourModule.pm + + # Use defaults from somewhere other than ~/.perlcriticrc + perlcriticrc --profile project/specific/perlcriticrc YourModule.pm + +=head1 ARGUMENTS + +The arguments are paths to the files you wish to analyze. You may +specify multiple files. If an argument is a directory, C +will analyze all Perl files below the directory. If no arguments +are specified, then input is read from STDIN. + +=head1 OPTIONS + +Option names can be abbreviated to uniqueness and can be stated with +singe or double dashes, and option values can be separated from the +option name by a space or '=' (as with L). Option names +are also case-sensitive. + +=over 8 + +=item C<--profile FILE> + +Directs C to use a profile named by FILE rather than looking +for the default F<.perlcriticrc> file in the current directory or your +home directory. See L for more information. + +=item C<--noprofile> + +Directs C not to load any configuration file, thus reverting +to the default configuration for all Policies. + +=item C<--severity N> + +Directs C to only apply Policies with a severity greater than +C. Severity values are integers ranging from 1 (least severe) to 5 (most +severe). The default is 5. For a given C<--profile>, decreasing the +C<--severity> will usually produce more violations. You can set the default +value for this option in your F<.perlcriticrc> file. You can also redefine +the C for any Policy in your F<.perlcriticrc> file. See +L<"CONFIGURATION"> for more information. + +=item C<-5 | -4 | -3 | -2 | -1> + +These are numeric shortcuts for setting the C<--severity> option. For example, +C<"-4"> is equivalent to C<"--severity 4">. If multiple shortcuts are +specified, then the most restrictive one wins. If an explicit C<--severity> +option is also given, then all shortcut options are silently ignored. NOTE: +Be careful not to put one of the number severity shortcut options immediately +after the C<--top> flag or C will interpret it as the number of +violations to report. + +=item C<--severity NAME> + +If it is difficult for you to remember whether severity "5" is the most +or least restrictive level, then you can use one of these named values: + + SEVERITY NAME ...is equivalent to... SEVERITY NUMBER + -------------------------------------------------------- + --severity gentle --severity 5 + --severity stern --severity 4 + --severity harsh --severity 3 + --severity cruel --severity 2 + --severity brutal --severity 1 + +=item C<--gentle | --stern | --harsh | --cruel | --brutal> + +These are named shortcuts for setting the C<--severity> option. For example, +C<"--cruel"> is equivalent to C<"--severity 2">. If multiple shortcuts are +specified, then the most restrictive one wins. If an explicit C<--severity> +option is also given, then all shortcut options are silently ignored. + +=item C<--theme RULE> + +Directs C to apply only Policies with themes that satisfy the +C. Themes are arbitrary names for groups of related policies. You can +combine theme names with boolean operators to create an arbitrarily complex +C. For example, the following would apply only Policies that have a +'bugs' AND 'pbp' theme: + + $> perlcritic --theme='bugs && pbp' MyModule.pm + +Unless the C<--severity> option is explicitly given, setting C<--theme> silently +causes the C<--severity> to be set to 1. You can set the default value for +this option in your F<.perlcriticrc> file. See L +for more information about themes. + +=item C<--include PATTERN> + +Directs C to apply additional Policies that match the regex +C. Use this option to temporarily override your profile and/or +the severity settings at the command-line. For example: + + perlcritic --include=layout my_file.pl + +This would cause C to apply all the C policies even +if they have a severity level that is less than the default level of 5, or +have been disabled in your F<.perlcriticrc> file. You can specify multiple +C<--include> options and you can use it in conjunction with the C<--exclude> +option. Note that C<--exclude> takes precedence over C<--include> when a Policy +matches both patterns. You can set the default value for this option in your +F<.perlcriticrc> file. + +=item C<--exclude PATTERN> + +Directs C to not apply any Policy that matches the regex +C. Use this option to temporarily override your profile and/or +the severity settings at the command-line. For example: + + perlcritic --exclude=strict my_file.pl + +This would cause C to not apply the C and +C Policies even though they have the highest severity level. +You can specify multiple C<--exclude> options and you can use it in conjunction +with the C<--include> option. Note that C<--exclude> takes precedence over +C<--include> when a Policy matches both patterns. You can set the default +value for this option in your F<.perlcriticrc> file. + +=item C<--single-policy PATTERN> + +Directs C to apply just one Policy module matching the regex +C, and exclude all other Policies. This option has precedence +over the C<--severity>, C<--theme>, C<--include>, C<--exclude>, and C<--only> +options. For example: + + perlcritic --single-policy=nowarnings my_file.pl + +This would cause C to apply just the C Policy, +regardless of the severity level setting. No other Policies would be applied. + +This is equivalent to what one might intend by... + + perlcritic --exclude=. --include=nowarnings my_file.pl + +... but this won't work because the C<--exclude> option overrides the +C<--include> option. + +The equivalent of this option can be accomplished by creating a custom profile +containing only the desired policy and then running... + + perlcritic --profile=customprofile --only my_file.pl + +=item C<--top [ N ]> + +Directs C to report only the top C Policy violations in each +file, ranked by their severity. If C is not specified, it defaults to 20. +If the C<--severity> option (or one of the shortcuts) is not explicitly given, +the C<--top> option implies that the minimum severity level is "1" +(i.e. "brutal"). Users can redefine the severity for any Policy in their +F<.perlcriticrc> file. See L<"CONFIGURATION"> for more information. You can +set the default value for this option in your F<.perlcriticrc> file. NOTE: Be +careful not to put one of the severity shortcut options immediately after the +C<--top> flag or C will interpret it as the number of violations to +report. + +=item C<--force> + +Directs C to ignore the magical C<"## no critic"> pseudo-pragmas +in the source code. See L<"BENDING THE RULES"> for more information. You can +set the default value for this option in your F<.perlcriticrc> file. + +=item C<--statistics> + +Causes several statistics about the code being scanned and the violations +found to be reported after any other output. + +=item C<--statistics-only> + +Like the C<--statistics> option, but suppresses normal output and only shows +the statistics. + +=item C<--verbose N | FORMAT> + +Sets the verbosity level or format for reporting violations. If given a +number (C), C reports violations using one of the predefined +formats described below. If given a string (C), it is interpreted to +be an actual format specification. If the C<--verbose> option is not +specified, it defaults to either 4 or 5, depending on whether multiple files +were given as arguments to C. You can set the default value for +this option in your F<.perlcriticrc> file. + + Verbosity Format Specification + ----------- ------------------------------------------------------------- + 1 "%f:%l:%c:%m\n", + 2 "%f: (%l:%c) %m\n", + 3 "%m at %f line %l\n", + 4 "%m at line %l, column %c. %e. (Severity: %s)\n", + 5 "%f: %m at line %l, column %c. %e. (Severity: %s)\n", + 6 "%m at line %l, near '%r'. (Severity: %s)\n", + 7 "%f: %m at line %l near '%r'. (Severity: %s)\n", + 8 "[%p] %m at line %l, column %c. (Severity: %s)\n", + 9 "[%p] %m at line %l, near '%r'. (Severity: %s)\n", + 10 "%m at line %l, column %c.\n %p (Severity: %s)\n%d\n", + 11 "%m at line %l, near '%r'.\n %p (Severity: %s)\n%d\n" + +Formats are a combination of literal and escape characters similar to the way +C works. See L for a full explanation of the +formatting capabilities. Valid escape characters are: + + Escape Meaning + ------- ---------------------------------------------------------------- + %c Column number where the violation occurred + %d Full diagnostic discussion of the violation + %e Explanation of violation or page numbers in PBP + %F Just the name of the file where the violation occurred. + %f Path to the file where the violation occurred. + %l Line number where the violation occurred + %m Brief description of the violation + %P Full name of the Policy module that created the violation + %p Name of the Policy without the Perl::Critic::Policy:: prefix + %r The string of source code that caused the violation + %s The severity level of the violation + +The purpose of these formats is to provide some compatibility with text +editors that have an interface for parsing certain kinds of input. See +L<"EDITOR INTEGRATION"> for more information about that. + +=item C<--list> + +Displays a condensed listing of all the L modules that +are found on this machine. For each Policy, the name, default severity and +default themes are shown. + +=item C<--list-themes> + +Displays a list of all the themes of the L modules that +are found on this machine. + +=item C<--profile-proto> + +Displays an expanded listing of all the L modules that +are found on this machine. For each Policy, the name, default severity and +default themes are shown, as well as the name of any additional parameters +that the Policy supports. The format is suitable as a prototype for your +F<.perlcriticrc> file. + +=item C<--only> + +Directs perlcritic to apply only Policies that are explicitly mentioned in +your F<.perlcriticrc> file. This is useful if you want to use just a small +subset of Policies without having to disable all the others. You can set the +default value for this option in your F<.perlcriticrc> file. + +=item C<--profile-strictness {warn|fatal|quiet}> + +Directs perlcritic how to treat certain recoverable problems found in a +F<.perlcriticrc> or file specified via the C<--profile> option. Valid values +are C (the default), C, and C. For example, perlcritic +normally only warns about profiles referring to non-existent Policies, but +this option can make this situation fatal. You can set the default value for +this option in your F<.perlcriticrc> file. + +=item C<--count> + +=item C<-C> + +Display only the number of violations for each file. Use this feature to get +a quick handle on where a large pile of code might need the most attention. + +=item C<--Safari> + +Report "Perl Best Practice" citations as section numbers from +L instead of page numbers from the actual book. +NOTE: This feature is not implemented yet. + +=item C<--color> + +This option is on by default. When set, Severity 5 and 4 are colored red and +yellow, respectively. Colorization only happens if STDOUT is a tty and +L is installed. And it only works on non-Windows +environments. Negate this switch to disable color. You can set the default +value for this option in your F<.perlcriticrc> file. + +Can also be specified as C<--colour>. + +=item C<--doc PATTERN> + +Displays the perldoc for all L modules that match +C. Since Policy modules tend to have rather long names, this +just provides a more convenient way to say something like: C<"perldoc +Perl::Critic::Policy::ValuesAndExpressions::RequireUpperCaseHeredocTerminator"> +at the command prompt. + +=item C<--quiet> + +Suppress the "source OK" message when no violations are found. + +=item C<--help> + +=item C<-?> + +=item C<-H> + +Displays a brief summary of options and exits. + +=item C<--options> + +Displays the descriptions of the options and exits. While this output is +long, it it nowhere near the length of the output of C<--man>. + +=item C<--man> + +Displays the complete C manual and exits. + +=item C<--version> + +=item C<-V> + +Displays the version number of C and exits. + +=back + +=head1 CONFIGURATION + +Most of the settings for Perl::Critic and each of the Policy modules can be +controlled by a configuration file. The default configuration file is called +F<.perlcriticrc>. C will look for this file in the current +directory first, and then in your home directory. Alternatively, you can set +the C environment variable to explicitly point to a different file +in another location. If none of these files exist, and the C<--profile> option +is not given on the command-line, then all Policies will be loaded with their +default configuration. + +The format of the configuration file is a series of INI-style blocks that +contain key-value pairs separated by "=". Comments should start with "#" and +can be placed on a separate line or after the name-value pairs if you desire. + +Default settings for perlcritic itself can be set B For example, putting any or all of these at the top of your +F<.perlcriticrc> file will set the default value for the corresponding +command-line argument. + + severity = 3 #Integer or named level + only = 1 #Zero or One + force = 0 #Zero or One + verbose = 4 #Integer or format spec + top = 50 #A positive integer + theme = (pbp + security) * bugs #A theme expression + include = NamingConventions ClassHierarchies #Space-delimited list + exclude = Variables Modules::RequirePackage #Space-delimited list + +The remainder of the configuration file is a series of blocks like this: + + [Perl::Critic::Policy::Category::PolicyName] + severity = 1 + set_themes = foo bar + add_themes = baz + arg1 = value1 + arg2 = value2 + +C is the full name of a module +that implements the policy. The Policy modules distributed with Perl::Critic +have been grouped into categories according to the table of contents in Damian +Conway's book B. For brevity, you can omit the +C<'Perl::Critic::Policy'> part of the module name. + +C is the level of importance you wish to assign to the Policy. All +Policy modules are defined with a default severity value ranging from 1 (least +severe) to 5 (most severe). However, you may disagree with the default +severity and choose to give it a higher or lower severity, based on your own +coding philosophy. You can set the C to an integer from 1 to 5, or +use one of the equivalent names: + + SEVERITY NAME ...is equivalent to... SEVERITY NUMBER + ---------------------------------------------------- + gentle 5 + stern 4 + harsh 3 + cruel 2 + brutal 1 + +C sets the theme for the Policy and overrides its default theme. +The argument is a string of one or more whitespace-delimited alphanumeric +words. Themes are case-insensitive. See L<"POLICY THEMES"> for more +information. + +C appends to the default themes for this Policy. The argument is +a string of one or more whitespace-delimited words. Themes are +case-insensitive. See L<"POLICY THEMES"> for more information. + +The remaining key-value pairs are configuration parameters that will be passed +into the constructor of that Policy. The constructors for most Policy modules +do not support arguments, and those that do should have reasonable defaults. +See the documentation on the appropriate Policy module for more details. + +Instead of redefining the severity for a given Policy, you can completely +disable a Policy by prepending a '-' to the name of the module in your +configuration file. In this manner, the Policy will never be loaded, +regardless of the C<--severity> given on the command line. + +A simple configuration might look like this: + + #-------------------------------------------------------------- + # I think these are really important, so always load them + + [TestingAndDebugging::RequireUseStrict] + severity = 5 + + [TestingAndDebugging::RequireUseWarnings] + severity = 5 + + #-------------------------------------------------------------- + # I think these are less important, so only load when asked + + [Variables::ProhibitPackageVars] + severity = 2 + + [ControlStructures::ProhibitPostfixControls] + allow = if unless # My custom configuration + severity = cruel # Same as "severity = 2" + + #-------------------------------------------------------------- + # Give these policies a custom theme. I can activate just + # these policies by saying "perlcritic --theme 'larry || curly'" + + [Modules::RequireFilenameMatchesPackage] + add_themes = larry + + [TestingAndDebugging::RequireTestLabels] + add_themes = curly moe + + #-------------------------------------------------------------- + # I do not agree with these at all, so never load them + + [-NamingConventions::ProhibitMixedCaseVars] + [-NamingConventions::ProhibitMixedCaseSubs] + + #-------------------------------------------------------------- + # For all other Policies, I accept the default severity, + # so no additional configuration is required for them. + +Note that all policies included with the Perl::Critic distribution that have +integer parameters accept underscores ("_") in their values, as with Perl +numeric literals. For example, + + [ValuesAndExpressions::RequireNumberSeparators] + min_value = 1_000 + +For additional configuration examples, see the F file that is +included in this F directory of this distribution. + +Damian Conway's own Perl::Critic configuration is also included in this +distribution as F. + +=head1 THE POLICIES + +A large number of Policy modules are distributed with Perl::Critic. They are +described briefly in the companion document L and +in more detail in the individual modules themselves. Say C<"perlcritic --doc +PATTERN"> to see the perldoc for all Policy modules that match the regex +C + +There are a number of distributions of additional policies on CPAN. If +L doesn't contain a policy that you want, some one may have +already written it. See L for a list of some of +these distributions. + +=head1 POLICY THEMES + +Each Policy is defined with one or more "themes". Themes can be used to +create arbitrary groups of Policies. They are intended to provide an +alternative mechanism for selecting your preferred set of Policies. For +example, you may wish disable a certain set of Policies when analyzing test +scripts. Conversely, you may wish to enable only a specific subset of +Policies when analyzing modules. + +The Policies that ship with Perl::Critic are have been divided into the +following themes. This is just our attempt to provide some basic logical +groupings. You are free to invent new themes that suit your needs. + + THEME DESCRIPTION + -------------------------------------------------------------------------- + core All policies that ship with Perl::Critic + pbp Policies that come directly from "Perl Best Practices" + bugs Policies that that prevent or reveal bugs + maintenance Policies that affect the long-term health of the code + cosmetic Policies that only have a superficial effect + complexity Policies that specificaly relate to code complexity + security Policies that relate to security issues + tests Policies that are specific to test scripts + +Say C<"perlcritic --list"> to get a listing of all available policies and the +themes that are associated with each one. You can also change the theme for +any Policy in your F<.perlcriticrc> file. See the L<"CONFIGURATION"> section +for more information about that. + +Using the C<--theme> command-line option, you can create an arbitrarily complex +rule that determines which Policies to apply. Precedence is the same as +regular Perl code, and you can use parentheses to enforce precedence as well. +Supported operators are: + + Operator Altertative Example + ---------------------------------------------------------------------------- + && and 'pbp && core' + || or 'pbp || (bugs && security)' + ! not 'pbp && ! (portability || complexity)' + +Theme names are case-insensitive. If the C<--theme> is set to an empty string, +then it evaluates as true all Policies. + +=head1 BENDING THE RULES + +Perl::Critic takes a hard-line approach to your code: either you +comply or you don't. In the real world, it is not always practical +(or even possible) to fully comply with coding standards. In such +cases, it is wise to show that you are knowingly violating the +standards and that you have a Damn Good Reason (DGR) for doing so. + +To help with those situations, you can direct Perl::Critic to ignore +certain lines or blocks of code by using pseudo-pragmas: + + require 'LegacyLibaray1.pl'; ## no critic + require 'LegacyLibrary2.pl'; ## no critic + + for my $element (@list) { + + ## no critic + + $foo = ""; #Violates 'ProhibitEmptyQuotes' + $barf = bar() if $foo; #Violates 'ProhibitPostfixControls' + #Some more evil code... + + ## use critic + + #Some good code... + do_something($_); + } + +The C<"## no critic"> comments direct Perl::Critic to ignore the remaining +lines of code until the end of the current block, or until a C<"## use +critic"> comment is found (whichever comes first). If the C<"## no critic"> +comment is on the same line as a code statement, then only that line of code +is overlooked. To direct perlcritic to ignore the C<"## no critic"> comments, +use the C<--force> option. + +A bare C<"## no critic"> comment disables all the active Policies. If you +wish to disable only specific Policies, add a list of Policy names as +arguments just as you would for the C<"no strict"> or C<"no warnings"> pragma. +For example, this would disable the C and +C policies until the end of the block or until the +next C<"## use critic"> comment (whichever comes first): + + ## no critic (EmptyQuotes, PostfixControls); + + # Now exempt from ValuesAndExpressions::ProhibitEmptyQuotes + $foo = ""; + + # Now exempt ControlStructures::ProhibitPostfixControls + $barf = bar() if $foo; + + # Still subject to ValuesAndExpression::RequireNumberSeparators + $long_int = 10000000000; + +Since the Policy names are matched against the C<"## no critic"> arguments as +regular expressions, you can abbreviate the Policy names or disable an entire +family of Policies in one shot like this: + + ## no critic (NamingConventions) + + # Now exempt from NamingConventions::ProhibitMixedCaseVars + my $camelHumpVar = 'foo'; + + # Now exempt from NamingConventions::ProhibitMixedCaseSubs + sub camelHumpSub {} + +The argument list must be enclosed in parentheses and must contain one or more +comma-separated barewords (i.e. don't use quotes). The C<"## no critic"> +pragmas can be nested, and Policies named by an inner pragma will be disabled +along with those already disabled an outer pragma. + +Some Policies like C apply to an entire +block of code. In those cases, C<"## no critic"> must appear on the line +where the violation is reported. For example: + + sub complicated_function { ## no critic (ProhibitExcessComplexity) + # Your code here... + } + +Some Policies like C apply to the entire +document, in which case violations are reported at line 1. But if the file +requires a shebang line, it is impossible to put C<"## no critic"> on the +first line of the file. This is a known limitation and it will be addressed +in a future release. As a workaround, you can disable the affected policies +at the command-line or in your F<.perlcriticrc> file. But beware that this +will affect the analysis of B files. + +Use this feature wisely. C<"## no critic"> should be used in the smallest +possible scope, or only on individual lines of code. And you should always be +as specific as possible about which policies you want to disable (i.e. never +use a bare C<"## no critic">). If Perl::Critic complains about your code, try +and find a compliant solution before resorting to this feature. + +=head1 EDITOR INTEGRATION + +For ease-of-use, C can be integrated with your favorite text +editor. The output-formatting capabilities of C are specifically +intended for use with the "grep" or "compile" modes available in editors like +C and C. In these modes, you can run an arbitrary command and the +editor will parse the output into an interactive buffer that you can click on +and jump to the relevant line of code. + +The Perl::Critic team thanks everyone who has helped integrate Perl-Critic +with their favorite editor. Your contributions in particular have made +Perl-Critic a convenient and user-friendly tool for Perl developers of all +stripes. We sincerely appreciate your hard work. + +=head2 EMACS + +Joshua ben Jore has authored a minor-mode for emacs that allows you to run +perlcritic on the current region or buffer. You can run it on demand, or +configure it to run automatically when you save the buffer. The output +appears in a hot-linked compiler buffer. The code and installation +instructions can be found in the F directory inside this distribution. + +=head2 VIM + +Scott Peshak has published F, which is available at +L. + +=head2 gVIM + +Fritz Mehner recently added support for C to his fantastic gVIM +plugin. In addition to providing a very Perlish IDE, Fritz's plugin enables +one-click access to C and many other very useful utilities. And +all is seamlessly integrated into the editor. See +L for complete details. + +=head2 EPIC + +EPIC is an open source Perl IDE based on the Eclipse platform. Features +supported are syntax highlighting, on-the-fly syntax check, content assist, +perldoc support, source formatter, templating support and a Perl debugger. Go +to L for more information about EPIC. + +The EPIC team is currently working on integration with Perl::Critic. In the +meantime, you can use the L pragma and EPIC will highlight +violations whenever it does a syntax check on your code. I haven't tried this +myself, but other folks say it works. + +=head2 BBEdit + +Josh Clark has produced an excellent Perl-Critic plugin for BBEdit. A copy is +included in this distribution at F. See +L for +screenshots and additional installation info. Apple users rejoice! + +=head2 Komodo + +Komodo is a proprietary IDE for Perl and several other dynamic languages. +Free trial copies of Komodo can be obtained from the ActiveState website at +L. For instructions on integrating F +with Komodo, see F in this distribution. + +=head1 EXIT STATUS + +If C has any errors itself, exits with status == 1. If there are +no errors, but C finds Policy violations in your source code, +exits with status == 2. If there were no errors and no violations were found, +exits with status == 0. + +=head1 THE L PHILOSOPHY + +=over + +Coding standards are deeply personal and highly subjective. The goal of +Perl::Critic is to help you write code that conforms with a set of best +practices. Our primary goal is not to dictate what those practices are, but +rather, to implement the practices discovered by others. Ultimately, you make +the rules -- Perl::Critic is merely a tool for encouraging consistency. If +there is a policy that you think is important or that we have overlooked, we +would be very grateful for contributions, or you can simply load your own +private set of policies into Perl::Critic. + +=back + +=head1 EXTENDING THE CRITIC + +The modular design of Perl::Critic is intended to facilitate the addition of +new Policies. You'll need to have some understanding of L, but most +Policy modules are pretty straightforward and only require about 20 lines of +code, and half of those lines are simple use statements and simple +declarations.. Please see the L file included in +this distribution for a step-by-step demonstration of how to create new Policy +modules. + +If you develop any new Policy modules, feel free to send them to +C<< >> and I'll be happy to put them into the Perl::Critic +distribution. Or if you would like to work on the Perl::Critic project +directly, check out our repository at L. To +subscribe to our mailing list, send a message to +C<< >>. + +The Perl::Critic team is also available for hire. If your organization has +its own coding standards, we can create custom Policies to enforce your local +guidelines. Or if your code base is prone to a particular defect pattern, we +can design Policies that will help you catch those costly defects B +they go into production. To discuss your needs with the Perl::Critic team, +just contact C<< >>. + +=head1 CONTACTING THE DEVELOPMENT TEAM + +You are encouraged to subscribe to the mailing list; send a message to +C<< >>. See also +L. +You can also contact the author at C<< >>. + +At least one member of the development team has started hanging around in +L. + +=head1 SEE ALSO + +There are a number of distributions of additional Policies available. A few +are listed here: + +L +L +L +L +L + +These distributions enable you to use Perl::Critic in your unit tests: + +L +L + +There are also a couple of distributions that will install all the +Perl::Critic related modules known to the development team: + +L +L + +=head1 BUGS + +Scrutinizing Perl code is hard for humans, let alone machines. If you find +any bugs, particularly false-positives or false-negatives from a +Perl::Critic::Policy, please submit them to +L. Thanks. + +Most policies will produce false-negatives if they cannot understand a +particular block of code. + +=head1 CREDITS + +Adam Kennedy - For creating L, the heart and soul of L. + +Damian Conway - For writing B, finally :) + +Chris Dolan - For contributing the best features and Policy modules. + +Andy Lester - Wise sage and master of all-things-testing. + +Elliot Shank - The self-proclaimed quality freak. + +Giuseppe Maxia - For all the great ideas and positive encouragement. + +and Sharon, my wife - For putting up with my all-night code sessions. + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +############################################################################## +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/changelog b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/changelog new file mode 100644 index 0000000..c98ab05 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/changelog @@ -0,0 +1,77 @@ +libperl-critic-perl (1.088-1) unstable; urgency=low + + * New upstream release + + Adjust (build-)dependencies: + - add perl-modules + - bump libppi-perl's version to 1.203 + - add perl-modules (>= 5.10) | libversion-perl + * add libtest-deep-perl to B-D-I for additional tests + * remove manpages-whatis.patch; fixed upstream + + drop quilt from B-D and rules + * minimize debian/rules with debhelper 7 + * Standards-Version: 3.8.0 (no changes needed) + + -- Damyan Ivanov Mon, 07 Jul 2008 13:25:48 +0300 + +libperl-critic-perl (1.082-1) unstable; urgency=low + + * New upstream release. + * debian/copyright: update years of copyright. + * debian/control: use a versioned dependency on quilt because we use + quilt.make in debian/rules. + * Refresh and extend manpages-whatis.patch. + + -- gregor herrmann Sun, 16 Mar 2008 03:32:47 +0100 + +libperl-critic-perl (1.080-2) unstable; urgency=low + + * debian/rules: delete /usr/lib/perl5 only if it exists (closes: #468002). + * debian/watch: adapt regexp for matching upstream releases. + * debian/rules: + - create install-stamp target + - introduce PERL and TMP variables + - use $@ for touching stamp-files + - use dh_clean for removing them + - use DESTDIR and PREFIX for make install + - don't create usr/lib directory, which we delete afterwards anyway + * Set Standards-Version to 3.7.3 (no changes). + * Set debhelper compatibility level to 6. + + -- gregor herrmann Sun, 02 Mar 2008 01:35:54 +0100 + +libperl-critic-perl (1.080-1) unstable; urgency=low + + [ gregor herrmann ] + * debian/control: Added: Vcs-Svn field (source stanza); Vcs-Browser + field (source stanza); Homepage field (source stanza). Removed: XS- + Vcs-Svn fields. + * Remove empty /usr/lib/perl5 directory. + * Move dh_clean before make distclean. + * Add libreadonly-perl to (build-)dependecies (only recommended, not + depended upon by libreadonly-xs-perl). + + [ Damyan Ivanov ] + * New upstream release + * Fixed debian/watch to use search.cpan.org/dist/-based URL + * Remove unused dh_link from debian/rules + * Wrap long fields in debian/control + * Add libfile-homedir-perl, libfile-which-perl, perltidy, + libpod-spell-perl, libexception-class-perl and libreadonly-xs-perl to + (build-)dependencies + * Bump libppi-perl (build-)dependency to 1.201 + * Add manpages-whatis.patch fixing whatis lintian warnings of 120 modules + Add quilt as a build-dependency + * debian/copyright: + + refreshed info, added two more copyright holders + + use direct search.cpan.org/dist/ URL as download location + * Add myself to Uploaders + * Add libtest-pod-perl and libtest-pod-coverage-perl to B-D-I + + -- Damyan Ivanov Thu, 15 Nov 2007 21:30:16 +0200 + +libperl-critic-perl (1.061-1) unstable; urgency=low + + * First release. + * Depend on libppi-perl 1.116, for PPI::Document::File. + + -- Joey Hess Tue, 14 Aug 2007 20:44:42 -0400 diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/compat b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/compat @@ -0,0 +1 @@ +7 diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/control b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/control new file mode 100644 index 0000000..60e2a01 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/control @@ -0,0 +1,47 @@ +Source: libperl-critic-perl +Section: perl +Priority: optional +Build-Depends-Indep: perl (>= 5.8), libb-keywords-perl, libconfig-tiny-perl, + libfile-spec-perl, libio-string-perl, liblist-moreutils-perl, + libmodule-pluggable-perl, libppi-perl (>= 1.203), libstring-format-perl, + libfile-homedir-perl, libfile-which-perl, perltidy, + libpod-spell-perl, libreadonly-xs-perl, libreadonly-perl, + libexception-class-perl, libtest-pod-perl, libtest-pod-coverage-perl, + libtest-deep-perl +Build-Depends: debhelper7 +Maintainer: Debian Perl Group +Uploaders: gregor herrmann , + Damyan Ivanov +Standards-Version: 3.8.0 +Homepage: http://search.cpan.org/dist/Perl-Critic/ +Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libperl-critic-perl/ +Vcs-Browser: http://svn.debian.org/wsvn/pkg-perl/trunk/libperl-critic-perl/ + +Package: libperl-critic-perl +Architecture: all +Depends: ${perl:Depends}, ${misc:Depends}, perl-modules, libb-keywords-perl, + libconfig-tiny-perl, libfile-spec-perl, libio-string-perl, + liblist-moreutils-perl, libmodule-pluggable-perl, libppi-perl (>= 1.203), + libstring-format-perl, libfile-homedir-perl, libfile-which-perl, + perltidy, libpod-spell-perl, libreadonly-xs-perl, libreadonly-perl, + libexception-class-perl, perl-modules (>= 5.10) | libversion-perl +Description: Critique Perl source code for best-practices + Perl::Critic is an extensible framework for creating and applying + coding standards to Perl source code. Essentially, it is a static source code + analysis engine. Perl::Critic is distributed with a number of + Perl::Critic::Policy modules that attempt to enforce various coding + guidelines. Most Policy modules are based on Damian Conway's book Perl + Best Practices. However, Perl::Critic is not limited to PBP and will + even support Policies that contradict Conway. You can enable, disable, + and customize those Polices through the Perl::Critic interface. You can + also create new Policy modules that suit your own tastes. + . + A command-line interface to Perl::Critic is included in the perlcritic + program. + . + Coding standards are deeply personal and highly subjective. The + goal of Perl::Critic is to help you write code that conforms with a + set of best practices. Its primary goal is not to dictate what + those practices are, but rather, to implement the practices + discovered by others. Ultimately, you make the rules -- + Perl::Critic is merely a tool for encouraging consistency. diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/control~ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/control~ new file mode 100644 index 0000000..2750b05 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/control~ @@ -0,0 +1,47 @@ +Source: libperl-critic-perl +Section: perl +Priority: optional +Build-Depends-Indep: perl (>= 5.8), perl-modules, libb-keywords-perl, libconfig-tiny-perl, + libfile-spec-perl, libio-string-perl, liblist-moreutils-perl, + libmodule-pluggable-perl, libppi-perl (>= 1.203), libstring-format-perl, + libfile-homedir-perl, libfile-which-perl, perltidy, + libpod-spell-perl, libreadonly-xs-perl, libreadonly-perl, + libexception-class-perl, libtest-pod-perl, libtest-pod-coverage-perl, + perl-modules (>= 5.10) | libversion-perl, libtest-deep-perl +Build-Depends: debhelper (>= 7) +Maintainer: Debian Perl Group +Uploaders: gregor herrmann , + Damyan Ivanov +Standards-Version: 3.8.0 +Homepage: http://search.cpan.org/dist/Perl-Critic/ +Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libperl-critic-perl/ +Vcs-Browser: http://svn.debian.org/wsvn/pkg-perl/trunk/libperl-critic-perl/ + +Package: libperl-critic-perl +Architecture: all +Depends: ${perl:Depends}, ${misc:Depends}, perl-modules, libb-keywords-perl, + libconfig-tiny-perl, libfile-spec-perl, libio-string-perl, + liblist-moreutils-perl, libmodule-pluggable-perl, libppi-perl (>= 1.203), + libstring-format-perl, libfile-homedir-perl, libfile-which-perl, + perltidy, libpod-spell-perl, libreadonly-xs-perl, libreadonly-perl, + libexception-class-perl, perl-modules (>= 5.10) | libversion-perl +Description: Critique Perl source code for best-practices + Perl::Critic is an extensible framework for creating and applying + coding standards to Perl source code. Essentially, it is a static source code + analysis engine. Perl::Critic is distributed with a number of + Perl::Critic::Policy modules that attempt to enforce various coding + guidelines. Most Policy modules are based on Damian Conway's book Perl + Best Practices. However, Perl::Critic is not limited to PBP and will + even support Policies that contradict Conway. You can enable, disable, + and customize those Polices through the Perl::Critic interface. You can + also create new Policy modules that suit your own tastes. + . + A command-line interface to Perl::Critic is included in the perlcritic + program. + . + Coding standards are deeply personal and highly subjective. The + goal of Perl::Critic is to help you write code that conforms with a + set of best practices. Its primary goal is not to dictate what + those practices are, but rather, to implement the practices + discovered by others. Ultimately, you make the rules -- + Perl::Critic is merely a tool for encouraging consistency. diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/copyright b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/copyright new file mode 100644 index 0000000..cb55bcc --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/copyright @@ -0,0 +1,30 @@ +This is a Debian prepackaged version of the perl critic. + +This package was put together by Joey Hess , using +sources from CPAN, http://search.cpan.org/dist/Perl-Critic/ + +The following copyright applies to this package: + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. All rights reserved. + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +Some individual modules are individually copyright by other authors/years: + +Copyright (C) 2006 Jeffrey Ryan Thalhammer. All rights reserved. +Copyright (C) 2005-2007 Graham TerMarsch. All rights reserved. +Copyright (c) 2005-2007 Chris Dolan and Jeffrey Ryan Thalhammer. All rights reserved. +Copyright (c) 2005-2007 Chris Dolan. All rights reserved. +Copyright (c) 2006 Chris Dolan. All rights reserved. +Copyright (c) 2007 Chris Dolan. Many rights reserved. +Copyright (c) 2006 Peter Guzis. All rights reserved. +Copyright (c) 2007 Andrew Moore. All rights reserved. +Copyright (c) 2007 Elliot Shank. All rights reserved. +Copyright (C) 2005-2007 Graham TerMarsch. All rights reserved. +Copyright (c) 2007 Ricardo SIGNES. + +Each of these modules are also licensed under the same terms as Perl itself. + +(Those terms are either of the Artistic license or the GPL; both licenses +can be found in full in /usr/share/common-licenses/) diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/docs b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/docs new file mode 100644 index 0000000..8949c75 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/docs @@ -0,0 +1 @@ +TODO.pod extras/* diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/examples b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/examples new file mode 100644 index 0000000..e39721e --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/examples @@ -0,0 +1 @@ +examples/* diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/rules b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/rules new file mode 100755 index 0000000..cbe925d --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/rules @@ -0,0 +1,3 @@ +#!/usr/bin/make -f +%: + dh $@ diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/watch b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/watch new file mode 100644 index 0000000..bd7363e --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/debian/watch @@ -0,0 +1,3 @@ +version=3 +# no developer versions +http://search.cpan.org/dist/Perl-Critic/ .*/Perl-Critic-v?(\d[\d.]+)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip) diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/examples/generatestats b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/examples/generatestats new file mode 100755 index 0000000..a6f232a --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/examples/generatestats @@ -0,0 +1,309 @@ +#!/usr/bin/perl + +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/examples/generatestats $ +# $Date: 2008-05-18 23:24:38 -0500 (Sun, 18 May 2008) $ +# $Author: clonezone $ +# $Revision: 2376 $ +############################################################################## + +## no critic (ErrorHandling::RequireUseOfExceptions) +use 5.008001; +use strict; +use warnings; + +use version; our $VERSION = qv('1.002'); + +use Carp qw{ croak }; +use English qw{ -no_match_vars }; +use Readonly; + +use File::Spec qw{ }; +use Perl6::Say; + +use Perl::Critic::Utils qw{ all_perl_files }; +use Perl::Critic; + + +if ( ! @ARGV ) { + die qq{usage: generatestats path [...]\n}; +} + +main(); + +exit 0; + + +sub main { + foreach my $path ( @ARGV ) { + say "Looking at $path."; + + my @files = all_perl_files($path); + say 'Analyzing ', scalar @files, ' files.'; + + my $results = summarize( \@files, File::Spec->canonpath($path) ); + + report($results); + + say; say; + } + + return; +} + + +sub summarize { + my ( $files, $path ) = @_; + + # Force reporting level to be really strict, just so that the statistics + # include everything. + my $critic = Perl::Critic->new( -severity => 1 ); + + my %total_severities; + my %total_policies; + my %types; + my %files; + + foreach my $file ( @{$files} ) { + my $relative_path; + my $type; + + if ($file eq $path) { + $relative_path = $file; + } else { + my $absolute_path_length = ( length $path ) + 1; + + $relative_path = substr $file, $absolute_path_length; + } + + if ($file =~ m/ [.] ([^.]+) \z /xms) { + $type = $1; + } else { + $type = ''; + } + + $types{$type}{files}++; + foreach my $violation ( $critic->critique($file) ) { + $files{ $relative_path }{ severities }{ $violation->severity() }++; + $files{ $relative_path }{ policies }{ $violation->policy() }++; + + $types{ $type }{ severities }{ $violation->severity() }++; + $types{ $type }{ policies }{ $violation->policy() }++; + + $total_severities{ $violation->severity() }++; + $total_policies{ $violation->policy() }++; + } + } + + return { + severities => \%total_severities, + policies => \%total_policies, + types => \%types, + files => \%files, + }; +} + + +sub report { + my ( $results ) = @_; + + report_totals( $results ); + report_types( $results ); + report_files( $results ); + + return; +} + + +sub report_totals { + my ( $results ) = @_; + + say; + say 'Total violations by severity:'; + report_severities( $results->{severities} ); + + say; + say 'Total violations by policy:'; + report_policies( $results->{policies} ); + + return; +} + + +sub report_types { + my ( $results ) = @_; + my $types = $results->{types}; + + say; + say 'Total files by type:'; + foreach my $type ( sort keys %{$types} ) { + say qq{\t}, $type, ': ', $types->{$type}{files}; + } + + foreach my $type ( sort keys %{$types} ) { + say; + say "Violations in $type files by severity:"; + report_severities( $types->{$type}{severities} ); + + say; + say "Violations in $type files by policy:"; + report_policies( $types->{$type}{policies} ); + } + + return; +} + + +sub report_files { + my ( $results ) = @_; + my $files = $results->{files}; + + foreach my $file ( sort keys %{$files} ) { + say; + say "Violations in $file by severity:"; + report_severities( $files->{$file}{severities} ); + + say; + say "Violations in $file by policy:"; + report_policies( $files->{$file}{policies} ); + } + + return; +} + + +sub report_severities { + my ($severities) = @_; + + foreach my $severity ( reverse sort { $a <=> $b } keys %{$severities} ) { + say qq{\t}, $severity, ': ', $severities->{$severity}; + } + + return; +} + + +sub report_policies { + my ($policies) = @_; + + foreach my $policy ( sort keys %{$policies} ) { + (my $short_policy = $policy) =~ s/ \A Perl::Critic::Policy:: //xms; + + say qq{\t}, $short_policy, ': ', $policies->{$policy}; + } + + return; +} + + +__END__ + +=pod + +=for stopwords codebase + +=head1 NAME + +C - Produce some simple quality statistics of a codebase + + +=head1 USAGE + + generatestats path [...] + + +=head1 DESCRIPTION + +Scan a body of code and generate some statistics on violations of the +installed L policies. While there is no means of configuring +the policies here, this will take into account your F<.perlcriticrc>, if +available. + + +=head1 REQUIRED ARGUMENTS + +A list of paths to files and directories to find code in. + + +=head1 OPTIONS + +None. + + +=head1 DIAGNOSTICS + +None. + + +=head1 EXIT STATUS + +0 + + +=head1 CONFIGURATION + +None. + + +=head1 DEPENDENCIES + +L +L +L + + +=head1 INCOMPATIBILITIES + +None reported. + + +=head1 BUGS AND LIMITATIONS + +This is an example program and thus does minimal error handling. + + +=head1 AUTHOR + +Elliot Shank C<< >> + + +=head1 COPYRIGHT + +Copyright (c) 2006-2007, Elliot Shank C<< >>. All rights +reserved. + +This module is free software; you can redistribute it and/or modify it under +the same terms as Perl itself. See L. + + +=head1 DISCLAIMER OF WARRANTY + +BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE +SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE +STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE +SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND +PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, +YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY +COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE +SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO +LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR +THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER +SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/examples/loadanalysisdb b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/examples/loadanalysisdb new file mode 100755 index 0000000..0985e0a --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/examples/loadanalysisdb @@ -0,0 +1,349 @@ +#!/usr/bin/perl + +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/examples/loadanalysisdb $ +# $Date: 2008-03-16 17:40:45 -0500 (Sun, 16 Mar 2008) $ +# $Author: clonezone $ +# $Revision: 2187 $ +############################################################################## + +## no critic (ErrorHandling::RequireUseOfExceptions) +use 5.008001; +use strict; +use warnings; + +use version; our $VERSION = qv('1.002'); + +use Carp qw{ croak }; +use English qw{ -no_match_vars }; +use Readonly; + +use DBI qw{ :sql_types }; +use File::Spec qw{ }; +use Perl6::Say; + +use Perl::Critic::Utils qw{ all_perl_files policy_short_name $EMPTY }; +use Perl::Critic; + + +if ( ! @ARGV ) { + die qq{usage: loadanalysisdb path [...]\n}; +} + +main(); + +exit 0; + + +sub main { + say 'Connecting to database.'; + say; + + my $database_connection = connect_to_database(); + my $insert_statement = prepare_insert_statement($database_connection); + + foreach my $path ( @ARGV ) { + say "Looking at $path."; + + my @files = all_perl_files($path); + say 'Analyzing ', scalar @files, ' files.'; + + load( \@files, File::Spec->canonpath($path), $insert_statement ); + + say; say; + } + + say 'Disconnecting from database.'; + say; + + close_insert_statement($insert_statement); + # Need to do this or DBI emits warning at disconnect + $insert_statement = undef; + + disconnect_from_database($database_connection); + + say 'Done.'; + say; + + return; +} + + +sub load { + my ( $files, $path, $insert_statement ) = @_; + + # Force reporting level to be really strict, just so that the database + # has everything. + my $critic = Perl::Critic->new( -severity => 1 ); + + foreach my $file ( @{$files} ) { + my $relative_path; + + if ($file eq $path) { + $relative_path = $file; + } else { + my $absolute_path_length = ( length $path ) + 1; + + $relative_path = substr $file, $absolute_path_length; + } + + say "Processing $relative_path."; + + foreach my $violation ( $critic->critique($file) ) { + my ($line, $column) = @{ $violation->location() }; + + execute_insert_statement( + $insert_statement, + $relative_path, + $line, + $column, + $violation->severity(), + policy_short_name( $violation->policy() ), + $violation->explanation(), + $violation->source(), + ); + } + } + + return; +} + + +sub connect_to_database { + my $database_file_name = 'perl_critic_analysis.sqlite'; + + my $database_connection = + DBI->connect( + "dbi:SQLite:dbname=$database_file_name", + $EMPTY, # login + $EMPTY, # password + { + AutoCommit => 1, # In real life, this should be 0 + RaiseError => 1, + } + ); + + defined $database_connection or + croak "Could not connect to $database_file_name."; + + return $database_connection; +} + + +sub prepare_insert_statement { + my ( $database_connection ) = @_; + + my $insert_statement = + $database_connection->prepare(<<'END_SQL'); + INSERT INTO + violation + ( + file_path, + line_number, + column_number, + severity, + policy, + explanation, + source_code + ) + VALUES + (?, ?, ?, ?, ?, ?, ?) +END_SQL + + + # The following values are bogus-- these statements are simply to tell + # the driver what the parameter types are so that we can use execute() + # without calling bind_param() each time. See "Binding Values Without + # bind_param()" on pages 126-7 of "Programming the Perl DBI". + + ## no critic (ProhibitMagicNumbers) + $insert_statement->bind_param( 1, 'x', SQL_VARCHAR); + $insert_statement->bind_param( 2, 1, SQL_INTEGER); + $insert_statement->bind_param( 3, 1, SQL_INTEGER); + $insert_statement->bind_param( 4, 1, SQL_INTEGER); + $insert_statement->bind_param( 5, 'x', SQL_VARCHAR); + $insert_statement->bind_param( 6, 'x', SQL_VARCHAR); + $insert_statement->bind_param( 7, 'x', SQL_VARCHAR); + ## use critic + + return $insert_statement; +} + + +sub execute_insert_statement { ##no critic(ProhibitManyArgs) + my ( + $statement, + $file_path, + $line_number, + $column_number, + $severity, + $policy, + $explanation, + $source_code, + ) + = @_; + + $statement->execute( + $file_path, + $line_number, + $column_number, + $severity, + $policy, + $explanation, + $source_code, + ); + + return; +} + + +sub close_insert_statement { + my ( $insert_statement ) = @_; + + $insert_statement->finish(); + + return; +} + +sub disconnect_from_database { + my ( $database_connection ) = @_; + + $database_connection->disconnect(); + + return; +} + + +__END__ + +=pod + +=for stopwords SQLite analyses + +=head1 NAME + +C - Critique a body of code and load the results into a database for later processing. + + +=head1 USAGE + + loadanalysisdb path [...] + + +=head1 DESCRIPTION + +Scan a body of code and, rather than emit the results in a textual format, put +them into a database so that analyses can be made. + +This example doesn't put anything into the database that isn't available from +L in order to keep the code easier to understand. In +a full application of the idea presented here, one might want to include the +current date and a distribution name in the database so that progress on +cleaning up a code corpus can be tracked. + +Note the explanation attribute of L is constant for +most policies, but some of them do provide more specific diagnostics of the +code in question. + + +=head1 REQUIRED ARGUMENTS + +A list of paths to files and directories to find code in. + + +=head1 OPTIONS + +None. + + +=head1 DIAGNOSTICS + +Errors from L. + + +=head1 EXIT STATUS + +0 + + +=head1 CONFIGURATION + +None. + + +=head1 DEPENDENCIES + +L +L +L +L + +An SQLite database named "perl_critic_analysis.sqlite" with the following +schema: + + CREATE TABLE violation ( + file_path VARCHAR(1024), + line_number INTEGER, + column_number INTEGER, + severity INTEGER, + policy VARCHAR(512), + explanation TEXT, + source_code TEXT + ) + + +=head1 INCOMPATIBILITIES + +None reported. + + +=head1 BUGS AND LIMITATIONS + +This is an example program and thus does minimal error handling. + + +=head1 AUTHOR + +Elliot Shank C<< >> + + +=head1 COPYRIGHT + +Copyright (c) 2006-2007, Elliot Shank C<< >>. All rights +reserved. + +This module is free software; you can redistribute it and/or modify it under +the same terms as Perl itself. See L. + + +=head1 DISCLAIMER OF WARRANTY + +BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE +SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE +STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE +SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND +PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, +YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY +COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE +SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO +LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR +THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER +SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/examples/perlcriticrc b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/examples/perlcriticrc new file mode 100644 index 0000000..59fb925 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/examples/perlcriticrc @@ -0,0 +1,148 @@ +############################################################################## +# This file is an example of a Perl::Critic configuration file. This +# file is usually called ".perlcriticrc" and is usually located in +# your home directory or the working directory of your project. +# However, you can use the -profile option to tell Perl::Critic use a +# different file in another location. +# +# The area before any of the [Perl::Critic::Policy] sections is used +# to set default values for the arguments to the Perl::Critic engine. +# If you are using the "perlcritic" program, you can override these +# settings at the command-line. Or if you are using the Perl::Critic +# library, your API arguments will override these settings as well. + + +#----------------------------------------------------------------------------- +# exclude: Directs Perl::Critic to never apply Policies with names that +# match one of the patterns. To specify multiple patterns, separate them +# with whitespace. Do not put quotes around anything. + +exclude = Documentation Naming + +#----------------------------------------------------------------------------- +# include: Directs Perl::Critic to always apply Policies with names that +# match one of the patterns. To specify multiple patterns, separate them +# with whitespace. Do not put quotes around anything. + +include = CodeLayout Modules + +#----------------------------------------------------------------------------- +# force: Directs Perl::Critic to ignore the special "##no critic" +# comments embedded in the source code. The default is 0. If +# defined, this should be either 1 or 0. + +force = 1 + +#----------------------------------------------------------------------------- +# only: Directs Perl::Critic to only choose from Policies that are +# explicitly mentioned in this file. Otherwise, Perl::Critic chooses +# from all the Perl::Critic::Policy classes that are found on the +# local machine. The default is 0. If defined, this should be either +# 1 or 0. + +only = 1 + +#----------------------------------------------------------------------------- +# severity: Sets the default minimum severity level for Policies. The +# default is 5. If defined, this should be an integer from 1 to 5, +# where 5 is the highest severity. + +severity = 3 + +#----------------------------------------------------------------------------- +# theme: Sets the default theme. Only Policies that fit into this +# them shall be applied. If defined, this should be a valid theme +# expression. See the Perl::Critic POD for more details about this. + +theme = danger + risky - pbp + +#----------------------------------------------------------------------------- +# top: Directs Perl::Critic to only report the top N Policy violations, +# as ranked by their individual severity. If defined, this should be +# a positive integer. + +top = 50 + +#----------------------------------------------------------------------------- +# verbose: Sets the format for printing Policy violations. If +# defined, this should be either a format spcecification, or a numeric +# verbosity level. See the Perl::Critic POD for more details. + +verbose = 5 + +############################################################################## +# The rest of the file consists of several named blocks that contain +# configuration parameters for each of the Policies. The names of +# each blocks correspond to the names of the Policy modules. For +# brevity, the "Perl::Critic::Policy" portion of the name can be +# omitted. See the POD for the appropriate Policy for a complete +# description of the configuration parameters that it supports. + + +#----------------------------------------------------------------------------- +# If you vehmently disagree with a particular Policy, putting a "-" in +# front of the Policy name will effectively disables that Policy. It +# will never be applied unless you use the "-include" option to apply +# it explicitly. + +[-NamingConventions::ProhibitMixedCaseVars] +[-NamingConventions::ProhibitMixedCaseSubs] +[-TestingAndDebugging::RequireUseWarnings] + +#----------------------------------------------------------------------------- +# If you agree with a Policy, but feel that it's severity level is not +# appropriate, then you can change the severity for any Policy. If +# defined this should be an integer from 1 to 5, where 5 is the +# highest severity. + +[BuiltinFunctions::RequireBlockGrep] +severity = 2 + +[CodeLayout::ProhibitHardTabs] +severity = 1 + +[ClassHierarchies::ProhibitAutoloading] +severity = 5 + +#----------------------------------------------------------------------------- +# Policies are also organized into themes. Themes are just names for +# arbitrary groups of Policies. You can define new themes and add +# them to any Policy. If defined, this should be a string of +# whitespace-delimited words. + +[RegularExpressions::RequireExtendedFormatting] +add_themes = client_foo +severity = 3 + +[RegularExpressions::RequireExtendedFormatting] +add_themes = client_foo client_bar +severity = 3 + +#----------------------------------------------------------------------------- +# Some Policies also have specialized configuration parameters. In +# all cases, these are repsented as simple name=value pairs. See the +# POD for the appropriate Policy for a complete discussion of its +# configuration parameters. + +[ControlStructures::ProhibitPostfixControls] +allow = for if +severity = 4 + +[Documentation::RequirePodSections] +lib_sections = NAME | SYNOPSIS | METHODS | AUTHOR +add_themes = my_favorites +severity = 4 + +#----------------------------------------------------------------------------- +# If you set the "only" flag, then Perl::Critic only chooses from +# Policies that are mentioned in your configuration file. This is +# helpful when you want to use only a very small subset of the +# Policies. So just create blocks for any other Policies that you +# want to use. + +[ValuesAndExpressions::ProhibitInterpolationOfLiterals] +[ValuesAndExpressions::ProhibitLeadingZeros] +[InputOutput::ProhibitBarewordFileHandles] +[Miscellanea::ProhibitTies] + + diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/examples/perlcriticrc-conway b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/examples/perlcriticrc-conway new file mode 100644 index 0000000..eb2d6dc --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/examples/perlcriticrc-conway @@ -0,0 +1,283 @@ +############################################################################## +# This Perl::Critic configuration file sets the Policy severity levels +# according to Damian Conway's own personal recommendations. Feel free to +# use this as your own, or make modifications. +############################################################################## + +[Perl::Critic::Policy::BuiltinFunctions::ProhibitLvalueSubstr] +severity = 3 + +[Perl::Critic::Policy::BuiltinFunctions::ProhibitReverseSortBlock] +severity = 1 + +[Perl::Critic::Policy::BuiltinFunctions::ProhibitSleepViaSelect] +severity = 5 + +[Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval] +severity = 5 + +[Perl::Critic::Policy::BuiltinFunctions::ProhibitStringySplit] +severity = 2 + +[Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalCan] +severity = 4 + +[Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalIsa] +severity = 4 + +[Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidGrep] +severity = 3 + +[Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidMap] +severity = 3 + +[Perl::Critic::Policy::BuiltinFunctions::RequireBlockGrep] +severity = 4 + +[Perl::Critic::Policy::BuiltinFunctions::RequireBlockMap] +severity = 4 + +[Perl::Critic::Policy::BuiltinFunctions::RequireGlobFunction] +severity = 5 + +[Perl::Critic::Policy::BuiltinFunctions::RequireSimpleSortBlock] +severity = 3 + +[Perl::Critic::Policy::ClassHierarchies::ProhibitAutoloading] +severity = 3 + +[Perl::Critic::Policy::ClassHierarchies::ProhibitExplicitISA] +severity = 4 + +[Perl::Critic::Policy::ClassHierarchies::ProhibitOneArgBless] +severity = 5 + +[Perl::Critic::Policy::CodeLayout::ProhibitHardTabs] +severity = 3 + +[Perl::Critic::Policy::CodeLayout::ProhibitParensWithBuiltins] +severity = 1 + +[Perl::Critic::Policy::CodeLayout::ProhibitQuotedWordLists] +severity = 2 + +[Perl::Critic::Policy::CodeLayout::RequireConsistentNewlines] +severity = 4 + +[Perl::Critic::Policy::CodeLayout::RequireTidyCode] +severity = 1 + +[Perl::Critic::Policy::CodeLayout::RequireTrailingCommas] +severity = 3 + +[Perl::Critic::Policy::ControlStructures::ProhibitCStyleForLoops] +severity = 3 + +[Perl::Critic::Policy::ControlStructures::ProhibitCascadingIfElse] +severity = 3 + +[Perl::Critic::Policy::ControlStructures::ProhibitDeepNests] +severity = 3 + +[Perl::Critic::Policy::ControlStructures::ProhibitMutatingListFunctions] +severity = 5 + +[Perl::Critic::Policy::ControlStructures::ProhibitPostfixControls] +severity = 4 + +[Perl::Critic::Policy::ControlStructures::ProhibitUnlessBlocks] +severity = 4 + +[Perl::Critic::Policy::ControlStructures::ProhibitUnreachableCode] +severity = 4 + +[Perl::Critic::Policy::ControlStructures::ProhibitUntilBlocks] +severity = 4 + +[Perl::Critic::Policy::Documentation::RequirePodAtEnd] +severity = 2 + +[Perl::Critic::Policy::Documentation::RequirePodSections] +severity = 2 + +[Perl::Critic::Policy::ErrorHandling::RequireCarping] +severity = 4 + +[Perl::Critic::Policy::InputOutput::ProhibitBacktickOperators] +severity = 3 + +[Perl::Critic::Policy::InputOutput::ProhibitBarewordFileHandles] +severity = 5 + +[Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest] +severity = 4 + +[Perl::Critic::Policy::InputOutput::ProhibitOneArgSelect] +severity = 4 + +[Perl::Critic::Policy::InputOutput::ProhibitReadlineInForLoop] +severity = 5 + +[Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen] +severity = 4 + +[Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint] +severity = 3 + +[Perl::Critic::Policy::Miscellanea::ProhibitFormats] +severity = 3 + +[Perl::Critic::Policy::Miscellanea::ProhibitTies] +severity = 4 + +[-Perl::Critic::Policy::Miscellanea::RequireRcsKeywords] + +[Perl::Critic::Policy::Modules::ProhibitAutomaticExportation] +severity = 4 + +[Perl::Critic::Policy::Modules::ProhibitEvilModules] +severity = 5 + +[Perl::Critic::Policy::Modules::ProhibitMultiplePackages] +severity = 4 + +[Perl::Critic::Policy::Modules::RequireBarewordIncludes] +severity = 5 + +[Perl::Critic::Policy::Modules::RequireEndWithOne] +severity = 4 + +[Perl::Critic::Policy::Modules::RequireExplicitPackage] +severity = 4 + +[Perl::Critic::Policy::Modules::RequireFilenameMatchesPackage] +severity = 5 + +[Perl::Critic::Policy::Modules::RequireVersionVar] +severity = 4 + +[Perl::Critic::Policy::NamingConventions::ProhibitAmbiguousNames] +severity = 3 + +[Perl::Critic::Policy::NamingConventions::ProhibitMixedCaseSubs] +severity = 1 + +[Perl::Critic::Policy::NamingConventions::ProhibitMixedCaseVars] +severity = 1 + +[Perl::Critic::Policy::References::ProhibitDoubleSigils] +severity = 4 + +[Perl::Critic::Policy::RegularExpressions::ProhibitCaptureWithoutTest] +severity = 4 + +[Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting] +severity = 5 + +[Perl::Critic::Policy::RegularExpressions::RequireLineBoundaryMatching] +severity = 5 + +[Perl::Critic::Policy::Subroutines::ProhibitAmpersandSigils] +severity = 2 + +[Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms] +severity = 4 + +[Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity] +severity = 3 + +[Perl::Critic::Policy::Subroutines::ProhibitExplicitReturnUndef] +severity = 5 + +[Perl::Critic::Policy::Subroutines::ProhibitSubroutinePrototypes] +severity = 4 + +[Perl::Critic::Policy::Subroutines::ProtectPrivateSubs] +severity = 3 + +[Perl::Critic::Policy::Subroutines::RequireFinalReturn] +severity = 5 + +[Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict] +severity = 5 + +[Perl::Critic::Policy::TestingAndDebugging::ProhibitNoWarnings] +severity = 4 + +[Perl::Critic::Policy::TestingAndDebugging::ProhibitProlongedStrictureOverride] +severity = 4 + +[Perl::Critic::Policy::TestingAndDebugging::RequireTestLabels] +severity = 3 + +[Perl::Critic::Policy::TestingAndDebugging::RequireUseStrict] +severity = 5 + +[Perl::Critic::Policy::TestingAndDebugging::RequireUseWarnings] +severity = 4 + +[Perl::Critic::Policy::ValuesAndExpressions::ProhibitConstantPragma] +severity = 4 + +[Perl::Critic::Policy::ValuesAndExpressions::ProhibitEmptyQuotes] +severity = 2 + +[Perl::Critic::Policy::ValuesAndExpressions::ProhibitEscapedCharacters] +severity = 2 + +[Perl::Critic::Policy::ValuesAndExpressions::ProhibitInterpolationOfLiterals] +severity = 1 + +[Perl::Critic::Policy::ValuesAndExpressions::ProhibitLeadingZeros] +severity = 5 + +[Perl::Critic::Policy::ValuesAndExpressions::ProhibitMismatchedOperators] +severity = 2 + +[Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators] +severity = 4 + +[Perl::Critic::Policy::ValuesAndExpressions::ProhibitNoisyQuotes] +severity = 2 + +[Perl::Critic::Policy::ValuesAndExpressions::ProhibitVersionStrings] +severity = 3 + +[Perl::Critic::Policy::ValuesAndExpressions::RequireInterpolationOfMetachars] +severity = 1 + +[Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators] +severity = 2 + +[Perl::Critic::Policy::ValuesAndExpressions::RequireQuotedHeredocTerminator] +severity = 4 + +[Perl::Critic::Policy::ValuesAndExpressions::RequireUpperCaseHeredocTerminator] +severity = 4 + +[Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations] +severity = 5 + +[Perl::Critic::Policy::Variables::ProhibitLocalVars] +severity = 2 + +[Perl::Critic::Policy::Variables::ProhibitMatchVars] +severity = 4 + +[Perl::Critic::Policy::Variables::ProhibitPackageVars] +severity = 3 + +[Perl::Critic::Policy::Variables::ProhibitPunctuationVars] +severity = 2 + +[Perl::Critic::Policy::Variables::ProtectPrivateVars] +severity = 3 + +[Perl::Critic::Policy::Variables::RequireInitializationForLocalVars] +severity = 5 + +[Perl::Critic::Policy::Variables::RequireLexicalLoopIterators] +severity = 5 + +[Perl::Critic::Policy::Variables::RequireNegativeIndices] +severity = 4 \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/extras/KomodoIntegration.pod b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/extras/KomodoIntegration.pod new file mode 100644 index 0000000..b51de10 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/extras/KomodoIntegration.pod @@ -0,0 +1,88 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/extras/KomodoIntegration.pod $ +# $Date: 2008-06-22 11:08:37 -0700 (Sun, 22 Jun 2008) $ +# $Author: clonezone $ +# $Revision: 2467 $ +############################################################################## + +=head1 NAME + +KomodoIntegration - Integrating perlcritic and Komodo. + +=head1 DESCRIPTION + +This document describes the steps for integrating F with Komodo 4.0 +from ActiveState. More information about Komodo can be found at +L + +These instructions assume that F has been installed somewhere in +your C<$PATH>. If it is not in your C<$PATH>, you must give the full path to +F instead of using the C<-S> switch. Also, I'm assuming that you +have installed Perl-Critic with the same Perl that Komodo is using. If that +is not the case, you'll probably have to give a full path to F instead +of using the C<%perl> placeholder. + +=over 4 + +=item * Start Komodo. + +=item * Select C<< Toolbox -> Add -> New Command... >> from the menu. + +=item * Enter a name for the command (e.g. "perlcritic"). + +=item * In the C field, enter the following: + + %perl -S perlcritic --severity=%(ask:Severity level [1-5]?:5) --verbose=1 %F + +=item * Uncheck the C and C boxes. + +=item * In the C drop-down list, select C. + +=item * Uncheck the C box. + +=item * Check the C box, and type this into the field: + + ^(?P.+):(?P.+):(?P.+):(?P.+)$ + +=item * Check the C box. + +=item * Click the C tab. + +=item * Click the C text field, and press C. + +=item * Click the C button. + +=item * Click the C button. + +=back + +Now to run F on the current file, just press C, or +select C from the C menu. Each time, you will be +prompted to enter the minimum severity level (defaulting to 5). After a few +moments, the output will appear in the C pane. By +double-clicking on the output messages, you can navigate to the appropriate +point in the code. + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +############################################################################## +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/extras/perlcritic.el b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/extras/perlcritic.el new file mode 100644 index 0000000..f48b397 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/extras/perlcritic.el @@ -0,0 +1,681 @@ +;;; perlcritic.el --- minor mode for Perl::Critic integration + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/extras/perlcritic.el $ +;;; $Date: 2008-03-16 17:40:45 -0500 (Sun, 16 Mar 2008) $ +;;; $Author: clonezone $ +;;; $Revision: 2187 $ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +;;; Readme +;; +;; This is a minor mode for emacs intended to allow you to +;; automatically incorporate perlcritic into your daily code +;; writing. When enabled it can optionally prevent you from saving +;; code that doesn't pass your enabled perlcritic policies. +;; +;; Even if you don't enable the automatic code checking you can still +;; use the automatic checking or the `perlcritic' function. + + +;;; Installation instructions: +;; +;; Copy perlcritic.el to your ~/.site-lib directory. If you don't +;; have a .site-lib directory create it and add the following line +;; to your .emacs file. This location isn't special, you could use +;; a different location if you wished. +;; +;; (add-to-list 'load-path "/home/your-name/.site-lisp") +;; +;; Add the following lines to your .emacs file. This allows Emacs +;; to load your perlcritic library only when needed. +;; +;; (autoload 'perlcritic "perlcritic" "" t) +;; (autoload 'perlcritic-region "perlcritic" "" t) +;; (autoload 'perlcritic-mode "perlcritic" "" t) +;; +;; Add the following to your .emacs file to get perlcritic-mode to +;; run automatically for the `cperl-mode' and `perl-mode'. +;; +;; (eval-after-load "cperl-mode" +;; '(add-hook 'cperl-mode-hook 'perlcritic-mode)) +;; (eval-after-load "perl-mode" +;; '(add-hook 'perl-mode-hook 'perlcritic-mode)) +;; +;; +;; If you think you need perlcritic loaded all the time you can +;; make this unconditional by using the following command instead +;; of the above autoloading. +;; +;; (require 'perlcritic) +;; +;; Compile the file for extra performance. This is optional. You +;; will have to redo this everytime you modify or upgrade your +;; perlcritic.el file. +;; +;; M-x byte-compile-file ~/.site-lib/perlcritic.el +;; +;; Additional customization can be found in the Perl::Critic group +;; in the Tools section in the Programming section of your Emacs' +;; customization menus. + + +;;; TODO +;; +;; Find out how to get perlcritic customization stuff into the +;; customization menus without having to load perlcritic.el +;; first. +;; +;; This needs an installer. Is there anything I can use in +;; ExtUtils::MakeMaker, Module::Build, or Module::Install? +;; Alien::? +;; +;; XEmacs compatibility. I use GNU Emacs and don't test in +;; XEmacs. I'm happy to do what it takes to be compatible but +;; someone will have to point things out to me. +;; +;; Make all documentation strings start with a sentence that fits +;; on one line. See "Tips for Documentation Strings" in the Emacs +;; Lisp manual. +;; +;; Any FIXME, TODO, or XXX tags below. + + +;;; Change Log: +;; 0.10 +;; * Synched up regexp alist with Perl::Critic::Utils and accounted for all +;; past patterns too. +;; 0.09 +;; * Added documentation for perlcritic-top, perlcritic-include, +;; perlcritic-exclude, perlcritic-force, perlcritic-verbose. +;; * Added emacs/vim editor hints to the bottom. +;; * Corrected indentation. +;; 0.08 +;; * Fixed perlcritic-compilation-error-regexp-alist for all +;; severity levels. +;; * Added documentation strings for functions. +;; 0.07 +;; * Moved perlcritic-compilation-error-regexp-alist so it is in the +;; source before it's used. This only seems to matter when +;; perlcritic.el is compiled to bytecode. +;; * Added perlcritic-exclude, perlcritic-include + +;; 0.06 +;; * Code cleanliness. +;; * Comment cleanliness. +;; * Nice error message when perlcritic warns. +;; * Documented perlcritic-top, perlcritic-verbose. +;; * Regular expressions for the other standard -verbose levels. +;; * Reversed Changes list so the most recent is first. +;; * Standard emacs library declarations. +;; * Added autoloading metadata. +;; 0.05 +;; * perlcritic-bin invocation now shown in output. +;; * Fixed indentation. +;; * perlcritic-region is now interactive. +;; 0.04 +;; * Removed a roque file-level (setq perlcritic-top 1) +;; * Moved cl library to compile-time. +;; 0.03 +;; * compile.el integration. This makes for hotlink happiness. +;; * Better sanity when starting the *perlcritic* buffer. +;; 0.02 +;; * perlcritic-severity-level added. +;; * Touched up the installation documentation. +;; * perlcritic-pass-required is now buffer local. +;; 0.01 +;; * It's new. I copied much of this from perl-lint-mode. + +;;; Copyright and license +;; +;; 2006 Joshua ben Jore +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the same terms as Perl itself + + + + +;;; Code: + +;;; Customization and variables. +(defgroup perlcritic nil "Perl::Critic" + :prefix "perlcritic-" + :group 'tools) + +(defcustom perlcritic-bin "perlcritic" + "The perlcritic program used by `perlcritic'." + :type 'string + :group 'perlcritic) + +(defcustom perlcritic-pass-required nil + "When \\[perlcritic-mode] is enabled then this boolean controls +whether your file can be saved when there are perlcritic warnings. + +This variable is automatically buffer-local and may be overridden on a +per-file basis with File Variables." + :type '(radio + (const :tag "Require no warnings from perlcritic to save" t) + (const :tag "Allow warnings from perlcritic when saving" nil)) + :group 'perlcritic) +(make-variable-buffer-local 'perlcritic-pass-required) + +(defcustom perlcritic-profile nil + "Specify an alternate .perlcriticrc file. This is only used if +non-nil." + :type '(string) + :group 'perlcritic) +(make-variable-buffer-local 'perlcritic-profile) + +(defcustom perlcritic-noprofile nil + "Disables the use of any .perlcriticrc file." + :type '(boolean) + :group 'perlcritic) +(make-variable-buffer-local 'perlcritic-noprofile) + +(defcustom perlcritic-severity nil + "Directs perlcritic to only report violations of Policies with a +severity greater than N. Severity values are integers ranging from +1 (least severe) to 5 (most severe). The default is 5. For a given +-profile, decreasing the -severity will usually produce more +violations. Users can redefine the severity for any Policy in their +.perlcriticrc file. + +This variable is automatically buffer-local and may be overridden on a +per-file basis with File Variables." + ;; FIXME: My GNU Emacs doesn't show a radio widget or a menu here. + :type '(radio + (const :tag "Show only the most severe: 5" 5) + (const :tag "4" 4) + (const :tag "3" 3) + (const :tag "2" 2) + (const :tag "Show everything including the least severe: 1" 1)) + :group 'perlcritic) +(make-variable-buffer-local 'perlcritic-severity) + +(defcustom perlcritic-top nil + "Directs \"perlcritic\" to report only the top N Policy violations in +each file, ranked by their severity. If the -severity option is not +explicitly given, the -top option implies that the minimum severity +level is 1. Users can redefine the severity for any Policy in their +.perlcriticrc file. + +This variable is automatically buffer-local and may be overridden on a +per-file basis with File Variables." + :type '(integer) + :group 'perlcritic) +(make-variable-buffer-local 'perlcritic-top) + +(defcustom perlcritic-include nil + "Directs \"perlcritic\" to apply additional Policies that match the regex \"/PATTERN/imx\". +Use this option to override your profile and/or the severity settings. + +For example: + + layout + +This would cause \"perlcritic\" to apply all the \"CodeLayout::*\" policies +even if they have a severity level that is less than the default level of 5, +or have been disabled in your .perlcriticrc file. You can specify multiple +`perlcritic-include' options and you can use it in conjunction with the +`perlcritic-exclude' option. Note that `perlcritic-exclude' takes precedence +over `perlcritic-include' when a Policy matches both patterns. You can set +the default value for this option in your .perlcriticrc file." + :type '(string) + :group 'perlcritic) +(make-variable-buffer-local 'perlcritic-include) + +(defcustom perlcritic-exclude nil + "Directs \"perlcritic\" to not apply any Policy that matches the regex +\"/PATTERN/imx\". Use this option to temporarily override your profile and/or +the severity settings at the command-line. For example: + + strict + +This would cause \"perlcritic\" to not apply the \"RequireUseStrict\" and +\"ProhibitNoStrict\" Policies even though they have the highest severity +level. You can specify multiple `perlcritic-exclude' options and you can use +it in conjunction with the `perlcritic-include' option. Note that +`perlcritic-exclude' takes precedence over `perlcritic-include' when a Policy +matches both patterns. You can set the default value for this option in your +.perlcriticrc file." + :type '(string) + :group 'perlcritic) +(make-variable-buffer-local 'perlcritic-exclude) + + +(defcustom perlcritic-force nil + "Directs \"perlcritic\" to ignore the magical \"## no critic\" +pseudo-pragmas in the source code. You can set the default value for this +option in your .perlcriticrc file." + :type '(boolean) + :group 'perlcritic) +(make-variable-buffer-local 'perlcritic-force) + +(defcustom perlcritic-verbose nil + "Sets the numeric verbosity level or format for reporting violations. If +given a number (\"N\"), \"perlcritic\" reports violations using one of the +predefined formats described below. If the `perlcritic-verbose' option is not +specified, it defaults to either 4 or 5, depending on whether multiple files +were given as arguments to \"perlcritic\". You can set the default value for +this option in your .perlcriticrc file. + +Verbosity Format Specification +----------- ------------------------------------------------------------- + 1 \"%f:%l:%c:%m\n\", + 2 \"%f: (%l:%c) %m\n\", + 3 \"%m at %f line %l\n\", + 4 \"%m at line %l, column %c. %e. (Severity: %s)\n\", + 5 \"%f: %m at line %l, column %c. %e. (Severity: %s)\n\", + 6 \"%m at line %l, near ’%r’. (Severity: %s)\n\", + 7 \"%f: %m at line %l near ’%r’. (Severity: %s)\n\", + 8 \"[%p] %m at line %l, column %c. (Severity: %s)\n\", + 9 \"[%p] %m at line %l, near ’%r’. (Severity: %s)\n\", +10 \"%m at line %l, column %c.\n %p (Severity: %s)\n%d\n\", +11 \"%m at line %l, near ’%r’.\n %p (Severity: %s)\n%d\n\" + +Formats are a combination of literal and escape characters similar to the way +\"sprintf\" works. See String::Format for a full explanation of the +formatting capabilities. Valid escape characters are: + +Escape Meaning +------- ---------------------------------------------------------------- +%c Column number where the violation occurred +%d Full diagnostic discussion of the violation +%e Explanation of violation or page numbers in PBP +%F Just the name of the file where the violation occurred. +%f Path to the file where the violation occurred. +%l Line number where the violation occurred +%m Brief description of the violation +%P Full name of the Policy module that created the violation +%p Name of the Policy without the Perl::Critic::Policy:: prefix +%r The string of source code that caused the violation +%s The severity level of the violation + +The purpose of these formats is to provide some compatibility with text +editors that have an interface for parsing certain kinds of input. + + +This variable is automatically buffer-local and may be overridden on a +per-file basis with File Variables." + :type '(integer) + :group 'perlcritic) +(make-variable-buffer-local 'perlcritic-verbose) + +;; TODO: Enable strings in perlcritic-verbose. +;; (defcustom perlcritic-verbose-regexp nil +;; "An optional regexp to match the warning output. +;; +;; This is used when `perlcritic-verbose' has a regexp instead of one of +;; the standard verbose levels.") +;; (make-local-variable 'perlcritic-verbose-regexp) + + +;; compile.el requires that something be the "filename." I've tagged +;; the severity with that. It happens to make it get highlighted in +;; red. The following advice on COMPILATION-FIND-FILE makes sure that +;; the "filename" is getting ignored when perlcritic is using it. + +;; These patterns are defined in Perl::Critic::Utils + +(defvar perlcritic-compilation-error-regexp-alist + '(;; Verbose level 1 + ;; "%f:%l:%c:%m\n" + ("^\\([^\n]+\\):\\([0-9]+\\):\\([0-9]+\\)" 1 2 3) + + ;; Verbose level 2 + ;; "%f: (%l:%c) %m\n" + ("^\\([^\n]+\\): (\\([0-9]+\\):\\([0-9]+\\))" 1 2 3) + + ;; Verbose level 3 + ;; "%m at %f line %l\n" + ("^[^\n]+ at \\([^\n]+\\) line \\([0-9]+\\)" 1 2) + ;; "%m at line %l, column %c. %e. (Severity: %s)\n" + ("^[^\n]+ at line\\( \\)\\([0-9]+\\), column \\([0-9]+\\)." 1 2 3) + + ;; Verbose level 4 + ;; "%m at line %l, column %c. %e. (Severity: %s)\n" + ("^[^\n]+ at line\\( \\)\\([0-9]+\\), column \\([0-9]+\\)." 1 2 3) + ;; "%f: %m at line %l, column %c. %e. (Severity: %s)\n" + ("^\\([^\n]+\\): [^\n]+ at line \\([0-9]+\\), column \\([0-9]+\\)" 1 2 3) + + ;; Verbose level 5 + ;; "%m at line %l, near '%r'. (Severity: %s)\n" + ("^[^\n]+ at line\\( \\)\\([0-9]+\\)," 1 2) + ;; "%f: %m at line %l, column %c. %e. (Severity: %s)\n" + ("^\\([^\n]+\\): [^\n]+ at line \\([0-9]+\\), column \\([0-9]+\\)" 1 2 3) + + ;; Verbose level 6 + ;; "%m at line %l, near '%r'. (Severity: %s)\\n" + ("^[^\n]+ at line\\( \\)\\([0-9]+\\)" 1 2) + ;; "%f: %m at line %l near '%r'. (Severity: %s)\n" + ("^\\([^\n]+\\): [^\n]+ at line \\([0-9]+\\)" 1 2) + + ;; Verbose level 7 + ;; "%f: %m at line %l near '%r'. (Severity: %s)\n" + ("^\\([^\n]+\\): [^\n]+ at line \\([0-9]+\\)" 1 2) + ;; "[%p] %m at line %l, column %c. (Severity: %s)\n" + ("^\\[[^\n]+\\] [^\n]+ at line\\( \\)\\([0-9]+\\), column \\([0-9]+\\)" 1 2 3) + + ;; Verbose level 8 + ;; "[%p] %m at line %l, column %c. (Severity: %s)\n" + ("^\\[[^\n]+\\] [^\n]+ at line\\( \\)\\([0-9]+\\), column \\([0-9]+\\)" 1 2 3) + ;; "[%p] %m at line %l, near '%r'. (Severity: %s)\n" + ("^\\[[^\n]+\\] [^\n]+ at line\\( \\)\\([0-9]+\\)" 1 2) + + ;; Verbose level 9 + ;; "%m at line %l, column %c.\n %p (Severity: %s)\n%d\n" + ("^[^\n]+ at line\\( \\)\\([0-9]+\\), column \\([0-9]+\\)" 1 2 3) + ;; "[%p] %m at line %l, near '%r'. (Severity: %s)\n" + ("^\\[[^\n]+\\] [^\n]+ at line\\( \\)\\([0-9]+\\)" 1 2) + + ;; Verbose level 10 + ;; "%m at line %l, near '%r'.\n %p (Severity: %s)\n%d\n" + ("^[^\n]+ at line\\( \\)\\([0-9]+\\)" 1 2) + ;; "%m at line %l, column %c.\n %p (Severity: %s)\n%d\n" + ("^[^\n]+ at line\\( \\)\\([0-9]+\\), column \\([0-9]+\\)" 1 2 3) + + ;; Verbose level 11 + ;; "%m at line %l, near '%r'.\n %p (Severity: %s)\n%d\n" + ("^[^\n]+ at line\\( \\)\\([0-9]+\\)" 1 2) + ) + "Alist that specified how to match errors in perlcritic output.") + + + +;; The Emacs Lisp manual says to do this with the cl library. +(eval-when-compile (require 'cl)) + +;;;###autoload +(defun perlcritic () + "\\[perlcritic]] returns a either nil or t depending on whether the +current buffer passes perlcritic's check. If there are any warnings +those are displayed in a separate buffer." + (interactive) + (save-restriction + (widen) + (perlcritic-region (point-min) (point-max)))) + +;;;###autoload +(defun perlcritic-region (start end) + "\\[perlcritic-region] returns a either nil or t depending on +whether the region passes perlcritic's check. If there are any +warnings those are displayed in a separate buffer." + + (interactive "r") + + ;; Kill the perlcritic buffer so I can make a new one. + (if (get-buffer "*perlcritic*") + (kill-buffer "*perlcritic*")) + + ;; In the following lines I'll be switching between buffers + ;; freely. This upper save-excursion will keep things sane. + (save-excursion + (let ((src-buf (current-buffer)) + (err-buf (get-buffer-create "*perlcritic*"))) + + (set-buffer src-buf) + (let ((perlcritic-args (loop for p in (list + ;; Add new bin/perlcritic + ;; parameters here! + (perlcritic--param-profile) + (perlcritic--param-noprofile) + (perlcritic--param-severity) + (perlcritic--param-top) + (perlcritic--param-include) + (perlcritic--param-exclude) + (perlcritic--param-force) + (perlcritic--param-verbose)) + unless (null p) + append p))) + ; + (message "Perl critic...running") + ;; Seriously. Is this the nicest way to call + ;; CALL-PROCESS-REGION with variadic arguments? This blows! + ;; (apply FUNCTION (append STATIC-PART DYNAMIC-PART)) + (let ((rc (apply 'call-process-region + (nconc (list start end + perlcritic-bin nil + (list err-buf t) + nil) + perlcritic-args)))) + + ;; Figure out whether we're ok or not. perlcritic has to + ;; return zero and the output buffer has to be empty except + ;; for that "... source OK" line. Different versions of the + ;; perlcritic script will print different things when + ;; they're ok. I expect to see things like "some-file source + ;; OK", "SCALAR=(0x123457) source OK", "STDIN source OK", + ;; and "source OK". + (let ((perlcritic-ok (and (numberp rc) + (zerop rc) + (progn + (set-buffer err-buf) + (goto-char (point-min)) + (delete-matching-lines "source OK$") + (zerop (buffer-size)))))) + ;; Either clean up or finish setting up my output. + (if perlcritic-ok + ;; Ok! + (progn + (kill-buffer err-buf) + (message "Perl critic...ok")) + + + ;; Not ok! + (message "Perl critic...not ok") + + ;; Set up the output buffer now I know it'll be used. I + ;; scooped the guts out of compile-internal. It is + ;; CRITICAL that the errors start at least two lines + ;; from the top. compile.el normally assumes the first + ;; line is an informational `cd somedirectory' command + ;; and the second line shows the program's invocation. + ;; + ;; Since I have the space available I've put the + ;; program's invocation here. Maybe it'd make sense to + ;; put the buffer's directory here somewhere too. + (set-buffer err-buf) + (goto-char (point-min)) + (insert (reduce (lambda (a b) (concat a " " b)) + (nconc (list perlcritic-bin) + perlcritic-args)) + "\n" + ;; TODO: instead of a blank line, print the + ;; buffer's directory+file. + "\n") + (goto-char (point-min)) + ;; TODO: get `recompile' to work. + + ;; just an fyi. compilation-mode will delete my local + ;; variables so be sure to call it *first*. + (compilation-mode "perlcritic") + (set (make-local-variable 'perlcritic-buffer) src-buf) + (set (make-local-variable 'compilation-error-regexp-alist) + perlcritic-compilation-error-regexp-alist) + (ad-activate #'compilation-find-file) + ; (ad-deactivate #'compilation-find-file) + (display-buffer err-buf)) + + ;; Return our success or failure. + perlcritic-ok)))))) + + + + +;;; Parameters for use by perlcritic-region. +(defun perlcritic--param-profile () + "A private method that supplies the -profile FILENAME parameter for +\\[perlcritic-region]" + (if perlcritic-profile (list "-profile" perlcritic-profile))) + +(defun perlcritic--param-noprofile () + "A private method that supplies the -noprofile parameter for +\\[perlcritic-region]" + (if perlcritic-noprofile (list "-noprofile"))) + +(defun perlcritic--param-force () + "A private method that supplies the -force parameter for +\\[perlcritic-region]" + (if perlcritic-force (list "-force"))) + +(defun perlcritic--param-severity () + "A private method that supplies the -severity NUMBER parameter for +\\[perlcritic-region]" + (cond ((stringp perlcritic-severity) + (list "-severity" perlcritic-severity)) + ((numberp perlcritic-severity) + (list "-severity" (number-to-string perlcritic-severity))) + (t nil))) + +(defun perlcritic--param-top () + "A private method that supplies the -top NUMBER parameter for +\\[perlcritic-region]" + (cond ((stringp perlcritic-top) + (list "-top" perlcritic-top)) + ((numberp perlcritic-top) + (list "-top" (number-to-string perlcritic-top))) + (t nil))) + +(defun perlcritic--param-include () + "A private method that supplies the -include REGEXP parameter for +\\[perlcritic-region]" + (if perlcritic-include + (list "-include" perlcritic-include) + nil)) + +(defun perlcritic--param-exclude () + "A private method that supplies the -exclude REGEXP parameter for +\\[perlcritic-region]" + (if perlcritic-exclude + (list "-exclude" perlcritic-exclude) + nil)) + +(defun perlcritic--param-verbose () + "A private method that supplies the -verbose NUMBER parameter for +\\[perlcritic-region]" + (cond ((stringp perlcritic-verbose) + (list "-verbose" perlcritic-verbose)) + ((numberp perlcritic-verbose) + (list "-verbose" (number-to-string perlcritic-verbose))) + (t nil))) + + +;; Interactive functions for use by the user to modify parameters on +;; an adhoc basis. I'm sure there's room for significant niceness +;; here. Suggest something. Please. +(defun perlcritic-profile (profile) + "Sets perlcritic's -profile FILENAME parameter." + (interactive "sperlcritic -profile: ") + (setq perlcritic-profile (if (string= profile "") nil profile))) + +(defun perlcritic-noprofile (noprofile) + "Toggles perlcritic's -noprofile parameter." + (interactive (list (yes-or-no-p "Enable perlcritic -noprofile? "))) + (setq perlcritic-noprofile noprofile)) + +(defun perlcritic-force (force) + "Toggles perlcritic's -force parameter." + (interactive (list (yes-or-no-p "Enable perlcritic -force? "))) + (setq perlcritic-force force)) + +(defun perlcritic-severity (severity) + "Sets perlcritic's -severity NUMBER parameter." + (interactive "nperlcritic -severity: ") + (setq perlcritic-severity severity)) + +(defun perlcritic-top (top) + "Sets perlcritic's -top NUMBER parameter." + (interactive "nperlcritic -top: ") + (setq perlcritic-top top)) + +(defun perlcritic-include (include) + "Sets perlcritic's -include REGEXP parameter." + (interactive "sperlcritic -include: ") + (setq perlcritic-include include)) + +(defun perlcritic-exclude (exclude) + "Sets perlcritic's -exclude REGEXP parameter." + (interactive "sperlcritic -exclude: ") + (setq perlcritic-exclude exclude)) + +(defun perlcritic-verbose (verbose) + "Sets perlcritic's -verbose NUMBER parameter." + (interactive "nperlcritic -verbose: ") + (setq perlcritic-verbose verbose)) + + + + + +;; Hooks compile.el's compilation-find-file to enable our file-less +;; operation. We feed `perlcritic-bin' from STDIN, not from a file. +(defadvice compilation-find-file (around perlcritic-find-file) + "Lets perlcritic lookup into the buffer we just came from and don't +require that the perl document exist in a file anywhere." + (let ((debug-buffer (marker-buffer marker))) + (if (local-variable-p 'perlcritic-buffer debug-buffer) + (setq ad-return-value perlcritic-buffer) + ad-do-it))) + + + + + +;; All the scaffolding of having a minor mode. +(defvar perlcritic-mode nil + "Toggle `perlcritic-mode'") +(make-variable-buffer-local 'perlcritic-mode) + +(defun perlcritic-write-hook () + "Check perlcritic during `write-file-hooks' for `perlcritic-mode'" + (if perlcritic-mode + (save-excursion + (widen) + (mark-whole-buffer) + (let ((perlcritic-ok (perlcritic))) + (if perlcritic-pass-required + ;; Impede saving if we're not ok. + (not perlcritic-ok) + ;; Don't impede saving. We might not be ok but that + ;; doesn't matter now. + nil))) + ;; Don't impede saving. We're not in perlcritic-mode. + nil)) + +;;;###autoload +(defun perlcritic-mode (&optional arg) + "Perl::Critic checking minor mode." + (interactive "P") + + ;; Enable/disable perlcritic-mode + (setq perlcritic-mode (if (null arg) + ;; Nothing! Just toggle it. + (not perlcritic-mode) + ;; Set it. + (> (prefix-numeric-value arg) 0))) + + (make-local-hook 'write-file-hooks) + (if perlcritic-mode + (add-hook 'write-file-hooks 'perlcritic-write-hook) + (remove-hook 'write-file-hooks 'perlcritic-write-hook))) + +;; Make a nice name for perl critic mode. This string will appear at +;; the bottom of the screen. +(if (not (assq 'perlcritic-mode minor-mode-alist)) + (setq minor-mode-alist + (cons '(perlcritic-mode " Critic") + minor-mode-alist))) + +(provide 'perlcritic) + +;; Local Variables: +;; mode: emacs-lisp +;; tab-width: 8 +;; fill-column: 78 +;; indent-tabs-mode: nil +;; End: +;; ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : + +;;; perlcritic.el ends here diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS.pm new file mode 100644 index 0000000..2cc268e --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS.pm @@ -0,0 +1,81 @@ +# $Id: AssertOS.pm,v 1.2 2007/09/28 16:30:11 drhyde Exp $ + +package Devel::AssertOS; + +use Devel::CheckOS qw(die_if_os_isnt); + +use strict; + +use vars qw($VERSION); + +$VERSION = '1.0'; + +# localising prevents the warningness leaking out of this module +local $^W = 1; # use warnings is a 5.6-ism + +=head1 NAME + +Devel::AssertOS - require that we are running on a particular OS + +=head1 DESCRIPTION + +Devel::AssertOS is a utility module for Devel::CheckOS and +Devel::AssertOS::*. It is nothing but a magic C that lets you +do this: + + use Devel::AssertOS qw(Linux FreeBSD Cygwin); + +which will die unless the platform the code is running on is Linux, FreeBSD +or Cygwin. + +=cut + +sub import { + shift; + die("Devel::AssertOS needs at least one parameter\n") unless(@_); + die_if_os_isnt(@_); +} + +=head1 BUGS and FEEDBACK + +I welcome feedback about my code, including constructive criticism. +Bug reports should be made using L or by email. + +You will need to include in your bug report the exact value of $^O, what +the OS is called (eg Windows Vista 64 bit Ultimate Home Edition), and, +if relevant, what "OS family" it should be in and who wrote it. + +If you are feeling particularly generous you can encourage me in my +open source endeavours by buying me something from my wishlist: + L + +=head1 SEE ALSO + +$^O in L + +L + +L + +L + +=head1 AUTHOR + +David Cantrell EFE + +Thanks to David Golden for suggesting that I add this utility module. + +=head1 COPYRIGHT and LICENCE + +Copyright 2007 David Cantrell + +This module is free-as-in-speech software, and may be used, distributed, +and modified under the same conditions as perl itself. + +=head1 CONSPIRACY + +This module is also free-as-in-mason software. + +=cut + +$^O; diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/AIX.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/AIX.pm new file mode 100644 index 0000000..c6acc9d --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/AIX.pm @@ -0,0 +1,13 @@ +# $Id: AIX.pm,v 1.1 2007/09/27 16:41:24 drhyde Exp $ + +package Devel::AssertOS::AIX; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'aix' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Amiga.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Amiga.pm new file mode 100644 index 0000000..27c7b3d --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Amiga.pm @@ -0,0 +1,13 @@ +# $Id: Amiga.pm,v 1.1 2007/09/27 16:41:24 drhyde Exp $ + +package Devel::AssertOS::Amiga; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'amigaos' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Apple.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Apple.pm new file mode 100644 index 0000000..7b4cfaf --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Apple.pm @@ -0,0 +1,13 @@ +# $Id: Apple.pm,v 1.2 2007/09/28 14:35:08 drhyde Exp $ + +package Devel::AssertOS::Apple; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O =~ /^(darwin|MacOS)/ ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/BSDOS.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/BSDOS.pm new file mode 100644 index 0000000..654f57f --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/BSDOS.pm @@ -0,0 +1,13 @@ +# $Id: BSDOS.pm,v 1.1 2007/09/27 16:41:24 drhyde Exp $ + +package Devel::AssertOS::BSDOS; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'bsdos' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/BeOS.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/BeOS.pm new file mode 100644 index 0000000..561daa4 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/BeOS.pm @@ -0,0 +1,13 @@ +# $Id: BeOS.pm,v 1.1 2007/09/27 16:41:24 drhyde Exp $ + +package Devel::AssertOS::BeOS; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'beos' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Cygwin.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Cygwin.pm new file mode 100644 index 0000000..9814083 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Cygwin.pm @@ -0,0 +1,13 @@ +# $Id: Cygwin.pm,v 1.1 2007/09/27 16:41:24 drhyde Exp $ + +package Devel::AssertOS::Cygwin; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'cygwin' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/DEC.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/DEC.pm new file mode 100644 index 0000000..71c449c --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/DEC.pm @@ -0,0 +1,13 @@ +# $Id: DEC.pm,v 1.2 2007/09/28 14:35:08 drhyde Exp $ + +package Devel::AssertOS::DEC; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O =~ /^(VMS|dec_osf)$/ ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/DGUX.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/DGUX.pm new file mode 100644 index 0000000..66c2a9e --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/DGUX.pm @@ -0,0 +1,13 @@ +# $Id: DGUX.pm,v 1.1 2007/09/27 16:41:24 drhyde Exp $ + +package Devel::AssertOS::DGUX; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'dgux' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/DragonflyBSD.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/DragonflyBSD.pm new file mode 100644 index 0000000..039fe5a --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/DragonflyBSD.pm @@ -0,0 +1,13 @@ +# $Id: DragonflyBSD.pm,v 1.1 2007/09/27 16:41:24 drhyde Exp $ + +package Devel::AssertOS::DragonflyBSD; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'dragonfly' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Dynix.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Dynix.pm new file mode 100644 index 0000000..ef72d7d --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Dynix.pm @@ -0,0 +1,13 @@ +# $Id: Dynix.pm,v 1.1 2007/09/27 16:41:24 drhyde Exp $ + +package Devel::AssertOS::Dynix; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'dynixptx' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/FreeBSD.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/FreeBSD.pm new file mode 100644 index 0000000..87f3c5f --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/FreeBSD.pm @@ -0,0 +1,13 @@ +# $Id: FreeBSD.pm,v 1.3 2007/09/27 16:41:24 drhyde Exp $ + +package Devel::AssertOS::FreeBSD; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'freebsd' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/HPUX.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/HPUX.pm new file mode 100644 index 0000000..396fa10 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/HPUX.pm @@ -0,0 +1,13 @@ +# $Id: HPUX.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::HPUX; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'hpux' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Interix.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Interix.pm new file mode 100644 index 0000000..6d8640e --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Interix.pm @@ -0,0 +1,13 @@ +# $Id: Interix.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::Interix; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'interix' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Irix.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Irix.pm new file mode 100644 index 0000000..d4ce927 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Irix.pm @@ -0,0 +1,13 @@ +# $Id: Irix.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::Irix; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'irix' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Linux.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Linux.pm new file mode 100644 index 0000000..f36698f --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Linux.pm @@ -0,0 +1,13 @@ +# $Id: Linux.pm,v 1.3 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::Linux; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'linux' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MPEiX.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MPEiX.pm new file mode 100644 index 0000000..dc1a6c5 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MPEiX.pm @@ -0,0 +1,13 @@ +# $Id: MPEiX.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::MPEiX; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'mpeix' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MSDOS.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MSDOS.pm new file mode 100644 index 0000000..d63c6d1 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MSDOS.pm @@ -0,0 +1,13 @@ +# $Id: MSDOS.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::MSDOS; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'dos' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MSWin32.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MSWin32.pm new file mode 100644 index 0000000..9965437 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MSWin32.pm @@ -0,0 +1,13 @@ +# $Id: MSWin32.pm,v 1.1 2007/09/28 14:35:08 drhyde Exp $ + +package Devel::AssertOS::MSWin32; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'MSWin32' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MacOSX.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MacOSX.pm new file mode 100644 index 0000000..f1c600f --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MacOSX.pm @@ -0,0 +1,13 @@ +# $Id: MacOSX.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::MacOSX; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'darwin' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MacOSclassic.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MacOSclassic.pm new file mode 100644 index 0000000..0e34ef1 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MacOSclassic.pm @@ -0,0 +1,13 @@ +# $Id: MacOSclassic.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::MacOSclassic; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'MacOS' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MachTen.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MachTen.pm new file mode 100644 index 0000000..912576f --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MachTen.pm @@ -0,0 +1,13 @@ +# $Id: MachTen.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::MachTen; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'machten' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MicrosoftWindows.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MicrosoftWindows.pm new file mode 100644 index 0000000..ccdcb5b --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/MicrosoftWindows.pm @@ -0,0 +1,13 @@ +# $Id: MicrosoftWindows.pm,v 1.3 2007/09/28 14:35:08 drhyde Exp $ + +package Devel::AssertOS::MicrosoftWindows; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O =~ /^(cygwin|MSWin32)$/ ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/NeXT.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/NeXT.pm new file mode 100644 index 0000000..0341e5c --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/NeXT.pm @@ -0,0 +1,13 @@ +# $Id: NeXT.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::NeXT; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'next' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/NetBSD.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/NetBSD.pm new file mode 100644 index 0000000..25ee800 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/NetBSD.pm @@ -0,0 +1,13 @@ +# $Id: NetBSD.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::NetBSD; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'netbsd' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Netware.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Netware.pm new file mode 100644 index 0000000..7fca8bf --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Netware.pm @@ -0,0 +1,13 @@ +# $Id: Netware.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::Netware; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'netware' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OS2.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OS2.pm new file mode 100644 index 0000000..554ade2 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OS2.pm @@ -0,0 +1,13 @@ +# $Id: OS2.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::OS2; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'os2' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OS390.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OS390.pm new file mode 100644 index 0000000..b466c6a --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OS390.pm @@ -0,0 +1,13 @@ +# $Id: OS390.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::OS390; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'os390' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OS400.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OS400.pm new file mode 100644 index 0000000..2869dba --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OS400.pm @@ -0,0 +1,13 @@ +# $Id: OS400.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::OS400; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'os400' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OSF.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OSF.pm new file mode 100644 index 0000000..cb66c2a --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OSF.pm @@ -0,0 +1,13 @@ +# $Id: OSF.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::OSF; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'dec_osf' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OpenBSD.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OpenBSD.pm new file mode 100644 index 0000000..6f59f7c --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/OpenBSD.pm @@ -0,0 +1,13 @@ +# $Id: OpenBSD.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::OpenBSD; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'openbsd' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/POSIXBC.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/POSIXBC.pm new file mode 100644 index 0000000..b899c52 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/POSIXBC.pm @@ -0,0 +1,13 @@ +# $Id: POSIXBC.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::POSIXBC; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'posix-bc' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/RISCOS.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/RISCOS.pm new file mode 100644 index 0000000..1be1a7f --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/RISCOS.pm @@ -0,0 +1,13 @@ +# $Id: RISCOS.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::RISCOS; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'riscos' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/SCO.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/SCO.pm new file mode 100644 index 0000000..9049a15 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/SCO.pm @@ -0,0 +1,13 @@ +# $Id: SCO.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::SCO; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'sco_sv' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Solaris.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Solaris.pm new file mode 100644 index 0000000..0c5eaf9 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Solaris.pm @@ -0,0 +1,13 @@ +# $Id: Solaris.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::Solaris; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'solaris' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Sun.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Sun.pm new file mode 100644 index 0000000..3e95ca2 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Sun.pm @@ -0,0 +1,13 @@ +# $Id: Sun.pm,v 1.2 2007/09/28 14:35:08 drhyde Exp $ + +package Devel::AssertOS::Sun; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O =~ /^(sunos|solaris)$/ ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/SunOS.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/SunOS.pm new file mode 100644 index 0000000..de12a79 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/SunOS.pm @@ -0,0 +1,13 @@ +# $Id: SunOS.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::SunOS; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'sunos' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/SysVr4.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/SysVr4.pm new file mode 100644 index 0000000..f21247c --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/SysVr4.pm @@ -0,0 +1,13 @@ +# $Id: SysVr4.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::SysVr4; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'svr4' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/SysVr5.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/SysVr5.pm new file mode 100644 index 0000000..badac2b --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/SysVr5.pm @@ -0,0 +1,13 @@ +# $Id: SysVr5.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::SysVr5; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'svr5' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Unicos.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Unicos.pm new file mode 100644 index 0000000..3664864 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Unicos.pm @@ -0,0 +1,13 @@ +# $Id: Unicos.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::Unicos; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O =~ /^unicos(mk)?$/ ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Unix.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Unix.pm new file mode 100644 index 0000000..0464953 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/Unix.pm @@ -0,0 +1,40 @@ +# $Id: Unix.pm,v 1.4 2007/09/28 14:35:08 drhyde Exp $ + +package Devel::AssertOS::Unix; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +# list of OSes lifted from Module::Build 0.2808 +# +sub os_is { + $^O =~ /^( + aix | + bsdos | + dgux | + dragonfly | + dynixptx | + freebsd | + linux | + hpux | + irix | + darwin | + machten | + openbsd | + netbsd | + dec_osf | + svr4 | + svr5 | + sco_sv | + unicos | + unicosmk | + solaris | + sunos | + interix + )$/x ? 1 : 0; +} + +die_unsupported() unless(os_is()); + +1; diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/VMESA.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/VMESA.pm new file mode 100644 index 0000000..9bd5964 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/VMESA.pm @@ -0,0 +1,13 @@ +# $Id: VMESA.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::VMESA; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'vmesa' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/VMS.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/VMS.pm new file mode 100644 index 0000000..f6533cf --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/VMS.pm @@ -0,0 +1,13 @@ +# $Id: VMS.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::VMS; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'VMS' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/VOS.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/VOS.pm new file mode 100644 index 0000000..0921b5b --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/AssertOS/VOS.pm @@ -0,0 +1,13 @@ +# $Id: VOS.pm,v 1.1 2007/09/27 16:41:25 drhyde Exp $ + +package Devel::AssertOS::VOS; + +use Devel::CheckOS qw(die_unsupported); + +$VERSION = '1.0'; + +sub os_is { $^O eq 'VOS' ? 1 : 0; } + +die_unsupported() unless(os_is()); + +1; \ No newline at end of file diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/CheckOS.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/CheckOS.pm new file mode 100644 index 0000000..155eee5 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Devel/CheckOS.pm @@ -0,0 +1,238 @@ +# $Id: CheckOS.pm,v 1.13 2007/10/04 20:15:05 drhyde Exp $ + +package Devel::CheckOS; + +use strict; +use Exporter; + +use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS); + +$VERSION = '1.2'; + +# localising prevents the warningness leaking out of this module +local $^W = 1; # use warnings is a 5.6-ism + +@ISA = qw(Exporter); +@EXPORT_OK = qw(os_is os_isnt die_if_os_is die_if_os_isnt die_unsupported list_platforms); +%EXPORT_TAGS = ( + all => \@EXPORT_OK, + booleans => [qw(os_is os_isnt die_unsupported)], + fatal => [qw(die_if_os_is die_if_os_isnt)] +); + +=head1 NAME + +Devel::CheckOS - check what OS we're running on + +=head1 DESCRIPTION + +Devel::CheckOS provides a more friendly interface to $^O, and also lets +you check for various OS "families" such as "Unix", which includes things +like Linux, Solaris, AIX etc. + +=head1 SYNOPSIS + + use Devel::CheckOS; + print "Hey, I know this, it's a Unix system\n" if(os_is('Unix')); + +=head1 FUNCTIONS + +Devel::CheckOS implements the following functions, which load subsidiary +OS-specific modules on demand to do the real work. They can be exported +by listing their names after C. You can also export +groups of functions thus: + + use Devel::CheckOS qw(:booleans); # export the boolean functions + # and 'die_unsupported' + + use Devel::CheckOS qw(:fatal); # export those that die on no match + + use Devel::CheckOS qw(:all); # export everything + +=head2 Boolean functions + +=head3 os_is + +Takes a list of OS names. If the current platform matches any of them, +it returns true, otherwise it returns false. The names can be a mixture +of OSes and OS families, eg ... + + os_is(qw(Unix VMS)); # Unix is a family, VMS is an OS + +=cut + +sub os_is { + my @targets = @_; + foreach my $target (@targets) { + die("Devel::CheckOS: $target isn't a legal OS name\n") + unless($target =~ /^\w+$/); + eval "use Devel::AssertOS::$target"; + if(!$@) { + no strict 'refs'; + return 1 if(&{"Devel::AssertOS::${target}::os_is"}()); + } + } + return 0; +} + +=head3 os_isnt + +If the current platform matches any of the parameters it returns false, +otherwise it returns true. + +=cut + +sub os_isnt { + my @targets = @_; + foreach my $target (@targets) { + return 0 if(os_is($target)); + } + return 1; +} + +=head2 Fatal functions + +=head3 die_if_os_isnt + +As C, except that it dies instead of returning false. The die() +message matches what the CPAN-testers look for to determine if a module +doesn't support a particular platform. + +=cut + +sub die_if_os_isnt { + os_is(@_) ? 1 : die_unsupported(); +} + +=head3 die_if_os_is + +As C, except that it dies instead of returning false. + +=cut + +sub die_if_os_is { + os_isnt(@_) ? 1 : die_unsupported(); +} + +=head2 And some utility functions ... + +=head3 die_unsupported + +This function simply dies with the message "OS unsupported", which is what +the CPAN testers look for to figure out whether a platform is supported or +not. + +=cut + +sub die_unsupported { die("OS unsupported\n"); } + +=head3 list_platforms + +Return a list of all the platforms for which the corresponding +Devel::AssertOS::* module is available. This includes both OSes and OS +families, and both those bundled with this module and any third-party +add-ons you have installed. + +Unfortunately, on some platforms this list may have file case +broken. eg, some platforms might return 'freebsd' instead of 'FreeBSD'. +This is because they have case-insensitive filesystems so things +should Just Work anyway. + +=cut + +sub list_platforms { + eval " # only load these if needed + use File::Find::Rule; + use File::Spec; + "; + + die($@) if($@); + return sort { $a cmp $b } map { + s/^.*\///g; + s/\.pm$//gi; + $_; + } File::Find::Rule->file()->name('*.pm')->in( + grep { -d } + map { File::Spec->catdir($_, qw(Devel AssertOS)) } + @INC + ); +} + +=head1 PLATFORMS SUPPORTED + +To see the list of platforms for which information is available, run this: + + perl -MDevel::CheckOS -e 'print join(", ", Devel::CheckOS::list_platforms())' + +Note that capitalisation is important. These are the names of the +underlying Devel::AssertOS::* modules +which do the actual platform detection, so they have to +be 'legal' filenames and module names, which unfortunately precludes +funny characters, so platforms like OS/2 are mis-spelt deliberately. +Sorry. + +Also be aware that not all of them have been properly tested. I don't +have access to most of them and have had to work from information +gleaned from L and a few other places. + +The following OS 'families' are supported 'out of the box': + + Apple (Mac OS, both classic and OS X) + DEC + MicrosoftWindows (this matches either MSWin32 or Cygwin) + Sun + Unix + +If you want to add your own OSes or families, see L +and please feel free to upload the results to the CPAN. + +=head1 BUGS and FEEDBACK + +I welcome feedback about my code, including constructive criticism. +Bug reports should be made using L or by email. + +You will need to include in your bug report the exact value of $^O, what +the OS is called (eg Windows Vista 64 bit Ultimate Home Edition), and, +if relevant, what "OS family" it should be in and who wrote it. + +If you are feeling particularly generous you can encourage me in my +open source endeavours by buying me something from my wishlist: + L + +=head1 SEE ALSO + +$^O in L + +L + +L + +L + +=head1 AUTHOR + +David Cantrell EFE + +Thanks to David Golden for the name and ideas about the interface, and +to the cpan-testers-discuss mailing list for prompting me to write it +in the first place. + +Thanks to Ken Williams, from whose L I lifted some of the +information about what should be in the Unix family. + +Thanks to Billy Abbott for finding some bugs for me on VMS. + +=head1 COPYRIGHT and LICENCE + +Copyright 2007 David Cantrell + +This module is free-as-in-speech software, and may be used, distributed, +and modified under the same conditions as perl itself. + +=head1 CONSPIRACY + +This module is also free-as-in-mason software. + +=cut + +$^O; diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Perl/Critic/BuildUtilities.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Perl/Critic/BuildUtilities.pm new file mode 100644 index 0000000..063366c --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/inc/Perl/Critic/BuildUtilities.pm @@ -0,0 +1,230 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/inc/Perl/Critic/BuildUtilities.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::BuildUtilities; + +use 5.006001; +use strict; +use warnings; + +use English q<-no_match_vars>; + +our $VERSION = '1.088'; + +use base qw{ Exporter }; + +our @EXPORT_OK = qw< + recommended_module_versions + test_wrappers_to_generate + get_PL_files + dump_unlisted_or_optional_module_versions + emit_tar_warning_if_necessary +>; + + +use lib 't/tlib'; + +use Devel::CheckOS qw< os_is >; + + +sub recommended_module_versions { + return ( + 'File::HomeDir' => 0, + 'Perl::Tidy' => 0, + 'Readonly::XS' => 0, + 'Regexp::Parser' => '0.20', + 'Term::ANSIColor' => 0, + + # All of these are for Documentation::PodSpelling + 'File::Which' => 0, + 'IPC::Open2' => 1, + 'Pod::Spell' => 1, + 'Text::ParseWords' => 3, + ); +} + + +sub test_wrappers_to_generate { + my @tests_to_be_wrapped = qw< + t/00_modules.t + t/01_config.t + t/01_config_bad_perlcriticrc.t + t/01_policy_config.t + t/02_policy.t + t/03_pragmas.t + t/04_optionsprocessor.t + t/05_utils.t + t/05_utils_ppi.t + t/05_utils_pod.t + t/06_violation.t + t/07_perlcritic.t + t/08_document.t + t/09_theme.t + t/10_userprofile.t + t/11_policyfactory.t + t/12_policylisting.t + t/12_themelisting.t + t/13_bundled_policies.t + t/14_policy_parameters.t + t/15_statistics.t + t/20_policy_podspelling.t + t/20_policy_requiretidycode.t + xt/author/80_policysummary.t + t/92_memory_leaks.t + xt/author/94_includes.t + >; + + return + map + { "xt/author/generated/${_}_without_optional_dependencies.t" } + @tests_to_be_wrapped; +} + +my @TARGET_FILES = qw< + lib/Perl/Critic/PolicySummary.pod + t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run + t/Variables/RequireLocalizedPunctuationVars.run +>; + +sub get_PL_files { + my %PL_files = map { ( "$_.PL" => $_ ) } @TARGET_FILES; + + $PL_files{'t/generate_without_optional_dependencies_wrappers.PL'} = + [ test_wrappers_to_generate() ]; + + return \%PL_files; +} + +sub dump_unlisted_or_optional_module_versions { + print + "\nVersions of optional/unlisted/indirect dependencies:\n\n"; + + my @unlisted_modules = ( + qw< + >, + keys %{ { recommended_module_versions() } }, + ); + + foreach my $module (sort @unlisted_modules) { + my $version; + + if ($module eq 'Readonly::XS') { + eval 'use Readonly; use Readonly::XS; $version = $Readonly::XS::VERSION;'; + } + else { + eval "use $module; \$version = \$${module}::VERSION;"; + } + if ($EVAL_ERROR) { + $version = 'not installed'; + } elsif (not defined $version) { + $version = 'undef'; + } + + print " $module = $version\n"; + } + + print "\n"; + + return; +} + +sub emit_tar_warning_if_necessary { + if ( os_is( qw ) ) { + print <<'END_OF_TAR_WARNING'; +NOTE: tar(1) on some Solaris systems cannot deal well with long file +names. + +If you get warnings about missing files below, please ensure that you +extracted the Perl::Critic tarball using GNU tar. + +END_OF_TAR_WARNING + } +} + +1; + +__END__ + +=head1 NAME + +Perl::Critic::BuildUtilities - Common bits of compiling Perl::Critic. + + +=head1 DESCRIPTION + +Various utilities used in assembling Perl::Critic, primary for use by +*.PL programs that generate code. + + +=head1 IMPORTABLE SUBROUTINES + +=over + +=item C + +Returns a hash mapping between recommended (but not required) modules +for Perl::Critic and the minimum version required of each module, + + +=item C + +Returns a list of test wrappers to be generated by +F. + + +=item C + +Returns a reference to a hash with a mapping from the name of a .PL +program to an array of the parameters to be passed to it, suited for +use by L or +L. May print to C messages +about what it is doing. + + +=item C + +Prints to C a list of all the unlisted (e.g. things in core +like L), optional (e.g. L), or potentially +indirect (e.g. L) dependencies, plus their versions, if +they're installed. + + +=item C + +On some Solaris systems, C can't deal with long file names and +thus files are not correctly extracted from the tarball. So this +prints a warning if the current system is Solaris. + + +=back + + +=head1 AUTHOR + +Elliot Shank C<< >> + + +=head1 LICENCE AND COPYRIGHT + +Copyright (c) 2007, Elliot Shank C<< >>. 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. + +=cut + +############################################################################## +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic.pm new file mode 100644 index 0000000..20aa6b3 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic.pm @@ -0,0 +1,1158 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic; + +use 5.006001; +use strict; +use warnings; + +use English qw(-no_match_vars); +use Readonly; + +use base qw(Exporter); + +use File::Spec; +use Scalar::Util qw(blessed); + +use PPI::Document; +use PPI::Document::File; + +use Perl::Critic::Exception::Configuration::Generic; +use Perl::Critic::Exception::Parse qw{ throw_parse }; +use Perl::Critic::Config; +use Perl::Critic::Violation; +use Perl::Critic::Document; +use Perl::Critic::Statistics; +use Perl::Critic::Utils qw{ :characters }; + +#----------------------------------------------------------------------------- + +our $VERSION = '1.088'; + +Readonly::Array our @EXPORT_OK => qw(critique); + +#----------------------------------------------------------------------------- + +sub new { + my ( $class, %args ) = @_; + my $self = bless {}, $class; + $self->{_config} = $args{-config} || Perl::Critic::Config->new( %args ); + $self->{_stats} = Perl::Critic::Statistics->new(); + return $self; +} + +#----------------------------------------------------------------------------- + +sub config { + my $self = shift; + return $self->{_config}; +} + +#----------------------------------------------------------------------------- + +sub add_policy { + my ( $self, @args ) = @_; + #Delegate to Perl::Critic::Config + return $self->config()->add_policy( @args ); +} + +#----------------------------------------------------------------------------- + +sub policies { + my $self = shift; + + #Delegate to Perl::Critic::Config + return $self->config()->policies(); +} + +#----------------------------------------------------------------------------- + +sub statistics { + my $self = shift; + return $self->{_stats}; +} + +#----------------------------------------------------------------------------- + +sub critique { ##no critic (ArgUnpacking) + + #------------------------------------------------------------------- + # This subroutine can be called as an object method or as a static + # function. In the latter case, the first argument can be a + # hashref of configuration parameters that shall be used to create + # an object behind the scenes. Note that this object does not + # persist. In other words, it is not a singleton. Here are some + # of the ways this subroutine might get called: + # + # #Object style... + # $critic->critique( $code ); + # + # #Functional style... + # critique( $code ); + # critique( {}, $code ); + # critique( {-foo => bar}, $code ); + #------------------------------------------------------------------ + + my ( $self, $source_code ) = @_ >= 2 ? @_ : ( {}, $_[0] ); + $self = ref $self eq 'HASH' ? __PACKAGE__->new(%{ $self }) : $self; + return if not defined $source_code; # If no code, then nothing to do. + + my $doc = $self->_create_perl_critic_document($source_code); + + if ( 0 == $self->policies() ) { + Perl::Critic::Exception::Configuration::Generic->throw( + message => 'There are no enabled policies.', + ) + } + + return $self->_gather_violations($doc); +} + +#============================================================================= +# PRIVATE functions + +sub _create_perl_critic_document { + my ($self, $source_code) = @_; + + # $source_code can be a file name, or a reference to a + # PPI::Document, or a reference to a scalar containing source + # code. In the last case, PPI handles the translation for us. + + my $doc = _is_ppi_doc( $source_code ) ? $source_code + : ref $source_code ? PPI::Document->new($source_code) + : PPI::Document::File->new($source_code); + + # Bail on error + if ( not defined $doc ) { + my $errstr = PPI::Document::errstr(); + my $file = ref $source_code ? undef : $source_code; + throw_parse + message => qq, + file_name => $file; + } + + # Pre-index location of each node (for speed) + $doc->index_locations(); + + # Wrap the doc in a caching layer + return Perl::Critic::Document->new($doc); +} + +#----------------------------------------------------------------------------- + +sub _gather_violations { + my ($self, $doc) = @_; + + # Disable the magic shebang fix + my %is_line_disabled = _unfix_shebang($doc); + + # Filter exempt code, if desired + if ( not $self->config->force() ) { + my @site_policies = $self->config->site_policy_names(); + %is_line_disabled = ( %is_line_disabled, + _filter_code($doc, @site_policies) ); + } + + # Evaluate each policy + my @policies = $self->config->policies(); + my @violations = + map { _critique( $_, $doc, \%is_line_disabled) } @policies; + + # Accumulate statistics + $self->statistics->accumulate( $doc, \@violations ); + + # If requested, rank violations by their severity and return the top N. + if ( @violations && (my $top = $self->config->top()) ) { + my $limit = @violations < $top ? $#violations : $top-1; + @violations = Perl::Critic::Violation::sort_by_severity(@violations); + @violations = ( reverse @violations )[ 0 .. $limit ]; #Slicing... + } + + # Always return violations sorted by location + return Perl::Critic::Violation->sort_by_location(@violations); +} + +#----------------------------------------------------------------------------- + +sub _is_ppi_doc { + my ($ref) = @_; + return blessed($ref) && $ref->isa('PPI::Document'); +} + +#----------------------------------------------------------------------------- + +sub _critique { + + my ($policy, $doc, $is_line_disabled) = @_; + my @violations = (); + my $maximum_violations = $policy->get_maximum_violations_per_document(); + + if (defined $maximum_violations && $maximum_violations == 0) { + return; + } + + my $policy_name = $policy->get_long_name(); + + TYPE: + for my $type ( $policy->applies_to() ) { + + ELEMENT: + for my $element ( @{ $doc->find($type) || [] } ) { + + # Evaluate the policy on this $element. A policy may + # return zero or more violations. We only want the + # violations that occur on lines that have not been + # disabled. + + VIOLATION: + for my $violation ( $policy->violates( $element, $doc ) ) { + my $line = $violation->location()->[0]; + if (exists $is_line_disabled->{$line}) { + next VIOLATION if $is_line_disabled->{$line}->{$policy_name}; + next VIOLATION if $is_line_disabled->{$line}->{ALL}; + } + + push @violations, $violation; + if ( + defined $maximum_violations + and @violations >= $maximum_violations + ) { + last TYPE; + } + } + } + } + + return @violations; +} + +#----------------------------------------------------------------------------- + +sub _filter_code { + + my ($doc, @site_policies)= @_; + + my $nodes_ref = $doc->find('PPI::Token::Comment') || return; + my %disabled_lines; + + _filter_shebang_line($nodes_ref, \%disabled_lines, \@site_policies); + _filter_other_lines($nodes_ref, \%disabled_lines, \@site_policies); + return %disabled_lines; +} + +sub _filter_shebang_line { + my ($nodes_ref, $disabled_lines, $site_policies) = @_; + + my $shebang_no_critic = qr{\A [#]! .*? [#][#] \s* no \s+ critic}mx; + + # Special case for the very beginning of the file: allow "##no critic" after the shebang + if (0 < @{$nodes_ref}) { + my $loc = $nodes_ref->[0]->location; + if (1 == $loc->[0] && 1 == $loc->[1] && $nodes_ref->[0] =~ $shebang_no_critic) { + my $pragma = shift @{$nodes_ref}; + for my $policy (_parse_nocritic_import($pragma, $site_policies)) { + $disabled_lines->{ 1 }->{$policy} = 1; + } + } + } + return; +} + +sub _filter_other_lines { + my ($nodes_ref, $disabled_lines, $site_policies) = @_; + + my $no_critic = qr{\A \s* [#][#] \s* no \s+ critic}mx; + my $use_critic = qr{\A \s* [#][#] \s* use \s+ critic}mx; + + PRAGMA: + for my $pragma ( grep { $_ =~ $no_critic } @{$nodes_ref} ) { + + # Parse out the list of Policy names after the + # 'no critic' pragma. I'm thinking of this just + # like a an C argument for real pragmas. + my @no_policies = _parse_nocritic_import($pragma, $site_policies); + + # Grab surrounding nodes to determine the context. + # This determines whether the pragma applies to + # the current line or the block that follows. + my $parent = $pragma->parent(); + my $grandparent = $parent ? $parent->parent() : undef; + my $sib = $pragma->sprevious_sibling(); + + + # Handle single-line usage on simple statements + if ( $sib && $sib->location->[0] == $pragma->location->[0] ) { + my $line = $pragma->location->[0]; + for my $policy ( @no_policies ) { + $disabled_lines->{ $line }->{$policy} = 1; + } + next PRAGMA; + } + + + # Handle single-line usage on compound statements + if ( ref $parent eq 'PPI::Structure::Block' ) { + if ( ref $grandparent eq 'PPI::Statement::Compound' + || ref $grandparent eq 'PPI::Statement::Sub' ) { + if ( $parent->location->[0] == $pragma->location->[0] ) { + my $line = $grandparent->location->[0]; + for my $policy ( @no_policies ) { + $disabled_lines->{ $line }->{$policy} = 1; + } + next PRAGMA; + } + } + } + + + # Handle multi-line usage. This is either a "no critic" .. + # "use critic" region or a block where "no critic" persists + # until the end of the scope. The start is the always the "no + # critic" which we already found. So now we have to search + # for the end. + + my $start = $pragma; + my $end = $pragma; + + SIB: + while ( my $sib = $end->next_sibling() ) { + $end = $sib; # keep track of last sibling encountered in this scope + last SIB + if $sib->isa('PPI::Token::Comment') && $sib =~ $use_critic; + } + + # We either found an end or hit the end of the scope. + # Flag all intervening lines + for my $line ( $start->location->[0] .. $end->location->[0] ) { + for my $policy ( @no_policies ) { + $disabled_lines->{ $line }->{$policy} = 1; + } + } + } + + return; +} + +#----------------------------------------------------------------------------- + +sub _parse_nocritic_import { + + my ($pragma, $site_policies) = @_; + + my $module = qr{ [\w:]+ }mx; + my $delim = qr{ \s* [,\s] \s* }mx; + my $qw = qr{ (?: qw )? }mx; + my $qualifier = qr{ $qw [(]? \s* ( $module (?: $delim $module)* ) \s* [)]? }mx; + my $no_critic = qr{ \#\# \s* no \s+ critic \s* $qualifier }mx; ##no critic(EscapedMetacharacters) + + if ( my ($module_list) = $pragma =~ $no_critic ) { + my @modules = split $delim, $module_list; + + # Compose the specified modules into a regex alternation. Wrap each + # in a no-capturing group to permit "|" in the modules specification + # (backward compatibility) + my $re = join q{|}, map {"(?:$_)"} @modules; + return grep {m/$re/imx} @{$site_policies}; + } + + # Default to disabling ALL policies. + return qw(ALL); +} + +#----------------------------------------------------------------------------- +sub _unfix_shebang { + + # When you install a script using ExtUtils::MakeMaker or Module::Build, it + # inserts some magical code into the top of the file (just after the + # shebang). This code allows people to call your script using a shell, + # like `sh my_script`. Unfortunately, this code causes several Policy + # violations, so we just disable it as if a "## no critic" comment had + # been attached. + + my $doc = shift; + my $first_stmnt = $doc->schild(0) || return; + + # Different versions of MakeMaker and Build use slightly differnt shebang + # fixing strings. This matches most of the ones I've found in my own Perl + # distribution, but it may not be bullet-proof. + + my $fixin_rx = qr{^eval 'exec .* \$0 \${1\+"\$@"}'\s*[\r\n]\s*if.+;}m; ##no critic(RequireExtendedFormatting) + if ( $first_stmnt =~ $fixin_rx ) { + my $line = $first_stmnt->location()->[0]; + return ( $line => {ALL => 1}, $line + 1 => {ALL => 1} ); + } + + #No magic shebang was found! + return; +} + +#----------------------------------------------------------------------------- + +1; + +#----------------------------------------------------------------------------- + +__END__ + +=pod + +=for stopwords DGR INI-style API -params pbp refactored ActivePerl +ben Jore Dolan's + +=head1 NAME + +Perl::Critic - Critique Perl source code for best-practices. + + +=head1 SYNOPSIS + + use Perl::Critic; + my $file = shift; + my $critic = Perl::Critic->new(); + my @violations = $critic->critique($file); + print @violations; + + +=head1 DESCRIPTION + +Perl::Critic is an extensible framework for creating and applying coding +standards to Perl source code. Essentially, it is a static source code +analysis engine. Perl::Critic is distributed with a number of +L modules that attempt to enforce various coding +guidelines. Most Policy modules are based on Damian Conway's book B. However, Perl::Critic is B limited to PBP and will even +support Policies that contradict Conway. You can enable, disable, and +customize those Polices through the Perl::Critic interface. You can also +create new Policy modules that suit your own tastes. + +For a command-line interface to Perl::Critic, see the documentation for +L. If you want to integrate Perl::Critic with your build process, +L provides an interface that is suitable for test scripts. +Also, L is useful for gradually applying +coding standards to legacy code. For the ultimate convenience (at the expense +of some flexibility) see the L pragma. + +Win32 and ActivePerl users can find PPM distributions of Perl::Critic at +L. + +If you'd like to try L without installing anything, there is a +web-service available at L. The web-service does not +yet support all the configuration features that are available in the native +Perl::Critic API, but it should give you a good idea of what it does. You can +also invoke the perlcritic web-service from the command-line by doing an +HTTP-post, such as one of these: + + $> POST http://perlcritic.com/perl/critic.pl < MyModule.pm + $> lwp-request -m POST http://perlcritic.com/perl/critic.pl < MyModule.pm + $> wget -q -O - --post-file=MyModule.pm http://perlcritic.com/perl/critic.pl + +Please note that the perlcritic web-service is still alpha code. The URL and +interface to the service are subject to change. + + +=head1 CONSTRUCTOR + +=over + +=item C<< new( [ -profile => $FILE, -severity => $N, -theme => $string, -include => \@PATTERNS, -exclude => \@PATTERNS, -top => $N, -only => $B, -profile-strictness => $PROFILE_STRICTNESS_{WARN|FATAL|QUIET}, -force => $B, -verbose => $N ], -color => $B, -criticism-fatal => $B) >> + +=item C<< new( -config => Perl::Critic::Config->new() ) >> + +=item C<< new() >> + +Returns a reference to a new Perl::Critic object. Most arguments are just +passed directly into L, but I have described them here +as well. The default value for all arguments can be defined in your +F<.perlcriticrc> file. See the L<"CONFIGURATION"> section for more +information about that. All arguments are optional key-value pairs as +follows: + +B<-profile> is a path to a configuration file. If C<$FILE> is not defined, +Perl::Critic::Config attempts to find a F<.perlcriticrc> configuration file in +the current directory, and then in your home directory. Alternatively, you +can set the C environment variable to point to a file in another +location. If a configuration file can't be found, or if C<$FILE> is an empty +string, then all Policies will be loaded with their default configuration. +See L<"CONFIGURATION"> for more information. + +B<-severity> is the minimum severity level. Only Policy modules that have a +severity greater than C<$N> will be applied. Severity values are integers +ranging from 1 (least severe) to 5 (most severe). The default is 5. For a +given C<-profile>, decreasing the C<-severity> will usually reveal more Policy +violations. You can set the default value for this option in your +F<.perlcriticrc> file. Users can redefine the severity level for any Policy +in their F<.perlcriticrc> file. See L<"CONFIGURATION"> for more information. + +If it is difficult for you to remember whether severity "5" is the most or +least restrictive level, then you can use one of these named values: + + SEVERITY NAME ...is equivalent to... SEVERITY NUMBER + -------------------------------------------------------- + -severity => 'gentle' -severity => 5 + -severity => 'stern' -severity => 4 + -severity => 'harsh' -severity => 3 + -severity => 'cruel' -severity => 2 + -severity => 'brutal' -severity => 1 + +B<-theme> is special expression that determines which Policies to apply based +on their respective themes. For example, the following would load only +Policies that have a 'bugs' AND 'pbp' theme: + + my $critic = Perl::Critic->new( -theme => 'bugs && pbp' ); + +Unless the C<-severity> option is explicitly given, setting C<-theme> silently +causes the C<-severity> to be set to 1. You can set the default value for +this option in your F<.perlcriticrc> file. See the L<"POLICY THEMES"> section +for more information about themes. + + +B<-include> is a reference to a list of string C<@PATTERNS>. Policy modules +that match at least one C will always be loaded, irrespective +of all other settings. For example: + + my $critic = Perl::Critic->new(-include => ['layout'] -severity => 4); + +This would cause Perl::Critic to apply all the C Policy modules +even though they have a severity level that is less than 4. You can set the +default value for this option in your F<.perlcriticrc> file. You can also use +C<-include> in conjunction with the C<-exclude> option. Note that C<-exclude> +takes precedence over C<-include> when a Policy matches both patterns. + +B<-exclude> is a reference to a list of string C<@PATTERNS>. Policy modules +that match at least one C will not be loaded, irrespective of +all other settings. For example: + + my $critic = Perl::Critic->new(-exclude => ['strict'] -severity => 1); + +This would cause Perl::Critic to not apply the C and +C Policy modules even though they have a severity level that +is greater than 1. You can set the default value for this option in your +F<.perlcriticrc> file. You can also use C<-exclude> in conjunction with the +C<-include> option. Note that C<-exclude> takes precedence over C<-include> +when a Policy matches both patterns. + +B<-single-policy> is a string C. Only one policy that matches +C will be used. Policies that do not match will be excluded. +This option has precedence over the C<-severity>, C<-theme>, C<-include>, +C<-exclude>, and C<-only> options. You can set the default value for this +option in your F<.perlcriticrc> file. + +B<-top> is the maximum number of Violations to return when ranked by their +severity levels. This must be a positive integer. Violations are still +returned in the order that they occur within the file. Unless the +C<-severity> option is explicitly given, setting C<-top> silently causes the +C<-severity> to be set to 1. You can set the default value for this option in +your F<.perlcriticrc> file. + +B<-only> is a boolean value. If set to a true value, Perl::Critic will only +choose from Policies that are mentioned in the user's profile. If set to a +false value (which is the default), then Perl::Critic chooses from all the +Policies that it finds at your site. You can set the default value for this +option in your F<.perlcriticrc> file. + +B<-profile-strictness> is an enumerated value, one of +L (the +default), +L, and +L. If set +to L, +Perl::Critic will make certain warnings about problems found in a +F<.perlcriticrc> or file specified via the B<-profile> option fatal. +For example, Perl::Critic normally only Cs about profiles +referring to non-existent Policies, but this value makes this +situation fatal. Correspondingly, +L makes +Perl::Critic shut up about these things. + +B<-force> is a boolean value that controls whether Perl::Critic observes the +magical C<"## no critic"> pseudo-pragmas in your code. If set to a true +value, Perl::Critic will analyze all code. If set to a false value (which is +the default) Perl::Critic will ignore code that is tagged with these comments. +See L<"BENDING THE RULES"> for more information. You can set the default +value for this option in your F<.perlcriticrc> file. + +B<-verbose> can be a positive integer (from 1 to 11), or a literal format +specification. See L for an explanation of format +specifications. You can set the default value for this option in your +F<.perlcriticrc> file. + +B<-color> is not used by Perl::Critic but is provided for the benefit of +L. + +B<-criticism-fatal> is not used by Perl::Critic but is provided for the +benefit of L. + +B<-config> is a reference to a L object. If you have +created your own Config object for some reason, you can pass it in here +instead of having Perl::Critic create one for you. Using the C<-config> +option causes all the other options to be silently ignored. + +=back + + +=head1 METHODS + +=over + +=item C + +Runs the C<$source_code> through the Perl::Critic engine using all the +Policies that have been loaded into this engine. If C<$source_code> is a +scalar reference, then it is treated as a string of actual Perl code. If +C<$source_code> is a reference to an instance of L, then that +instance is used directly. Otherwise, it is treated as a path to a local file +containing Perl code. This method returns a list of +L objects for each violation of the loaded Policies. +The list is sorted in the order that the Violations appear in the code. If +there are no violations, this method returns an empty list. + +=item C<< add_policy( -policy => $policy_name, -params => \%param_hash ) >> + +Creates a Policy object and loads it into this Critic. If the object cannot +be instantiated, it will throw a fatal exception. Otherwise, it returns a +reference to this Critic. + +B<-policy> is the name of a L subclass module. The +C<'Perl::Critic::Policy'> portion of the name can be omitted for brevity. +This argument is required. + +B<-params> is an optional reference to a hash of Policy parameters. The +contents of this hash reference will be passed into to the constructor of the +Policy module. See the documentation in the relevant Policy module for a +description of the arguments it supports. + +=item C< policies() > + +Returns a list containing references to all the Policy objects that have been +loaded into this engine. Objects will be in the order that they were loaded. + +=item C< config() > + +Returns the L object that was created for or given +to this Critic. + +=item C< statistics() > + +Returns the L object that was created for this +Critic. The Statistics object accumulates data for all files that are +analyzed by this Critic. + +=back + + +=head1 FUNCTIONAL INTERFACE + +For those folks who prefer to have a functional interface, The C +method can be exported on request and called as a static function. If the +first argument is a hashref, its contents are used to construct a new +Perl::Critic object internally. The keys of that hash should be the same as +those supported by the C method. Here are some examples: + + use Perl::Critic qw(critique); + + # Use default parameters... + @violations = critique( $some_file ); + + # Use custom parameters... + @violations = critique( {-severity => 2}, $some_file ); + + # As a one-liner + %> perl -MPerl::Critic=critique -e 'print critique(shift)' some_file.pm + +None of the other object-methods are currently supported as static +functions. Sorry. + + +=head1 CONFIGURATION + +Most of the settings for Perl::Critic and each of the Policy modules can be +controlled by a configuration file. The default configuration file is called +F<.perlcriticrc>. Perl::Critic will look for this file in the current +directory first, and then in your home directory. Alternatively, you can set +the C environment variable to explicitly point to a different file +in another location. If none of these files exist, and the C<-profile> option +is not given to the constructor, then all the modules that are found in the +Perl::Critic::Policy namespace will be loaded with their default +configuration. + +The format of the configuration file is a series of INI-style blocks that +contain key-value pairs separated by '='. Comments should start with '#' and +can be placed on a separate line or after the name-value pairs if you desire. + +Default settings for Perl::Critic itself can be set B For example, putting any or all of these at the top of your +configuration file will set the default value for the corresponding +constructor argument. + + severity = 3 #Integer or named level + only = 1 #Zero or One + force = 0 #Zero or One + verbose = 4 #Integer or format spec + top = 50 #A positive integer + theme = (pbp || security) && bugs #A theme expression + include = NamingConventions ClassHierarchies #Space-delimited list + exclude = Variables Modules::RequirePackage #Space-delimited list + criticism-fatal = 1 #Zero or One + color = 1 #Zero or One + +The remainder of the configuration file is a series of blocks like this: + + [Perl::Critic::Policy::Category::PolicyName] + severity = 1 + set_themes = foo bar + add_themes = baz + maximum_violations_per_document = 57 + arg1 = value1 + arg2 = value2 + +C is the full name of a module +that implements the policy. The Policy modules distributed with Perl::Critic +have been grouped into categories according to the table of contents in Damian +Conway's book B. For brevity, you can omit the +C<'Perl::Critic::Policy'> part of the module name. + +C is the level of importance you wish to assign to the Policy. All +Policy modules are defined with a default severity value ranging from 1 (least +severe) to 5 (most severe). However, you may disagree with the default +severity and choose to give it a higher or lower severity, based on your own +coding philosophy. You can set the C to an integer from 1 to 5, or +use one of the equivalent names: + + SEVERITY NAME ...is equivalent to... SEVERITY NUMBER + ---------------------------------------------------- + gentle 5 + stern 4 + harsh 3 + cruel 2 + brutal 1 + +C sets the theme for the Policy and overrides its default theme. +The argument is a string of one or more whitespace-delimited alphanumeric +words. Themes are case-insensitive. See L<"POLICY THEMES"> for more +information. + +C appends to the default themes for this Policy. The argument is +a string of one or more whitespace-delimited words. Themes are +case-insensitive. See L<"POLICY THEMES"> for more information. + +C limits the number of Violations the Policy +will return for a given document. Some Policies have a default limit; see the +documentation for the individual Policies to see whether there is one. To +force a Policy to not have a limit, specify "no_limit" or the empty string for +the value of this parameter. + +The remaining key-value pairs are configuration parameters that will be passed +into the constructor for that Policy. The constructors for most Policy +objects do not support arguments, and those that do should have reasonable +defaults. See the documentation on the appropriate Policy module for more +details. + +Instead of redefining the severity for a given Policy, you can completely +disable a Policy by prepending a '-' to the name of the module in your +configuration file. In this manner, the Policy will never be loaded, +regardless of the C<-severity> given to the Perl::Critic constructor. + +A simple configuration might look like this: + + #-------------------------------------------------------------- + # I think these are really important, so always load them + + [TestingAndDebugging::RequireUseStrict] + severity = 5 + + [TestingAndDebugging::RequireUseWarnings] + severity = 5 + + #-------------------------------------------------------------- + # I think these are less important, so only load when asked + + [Variables::ProhibitPackageVars] + severity = 2 + + [ControlStructures::ProhibitPostfixControls] + allow = if unless # My custom configuration + severity = cruel # Same as "severity = 2" + + #-------------------------------------------------------------- + # Give these policies a custom theme. I can activate just + # these policies by saying `perlcritic -theme larry` + + [Modules::RequireFilenameMatchesPackage] + add_themes = larry + + [TestingAndDebugging::RequireTestLables] + add_themes = larry curly moe + + #-------------------------------------------------------------- + # I do not agree with these at all, so never load them + + [-NamingConventions::ProhibitMixedCaseVars] + [-NamingConventions::ProhibitMixedCaseSubs] + + #-------------------------------------------------------------- + # For all other Policies, I accept the default severity, + # so no additional configuration is required for them. + +For additional configuration examples, see the F file +that is included in this F directory of this distribution. + +Damian Conway's own Perl::Critic configuration is also included in this +distribution as F. + + +=head1 THE POLICIES + +A large number of Policy modules are distributed with Perl::Critic. They are +described briefly in the companion document L and +in more detail in the individual modules themselves. Say C<"perlcritic -doc +PATTERN"> to see the perldoc for all Policy modules that match the regex +C + +There are a number of distributions of additional policies on CPAN. If +L doesn't contain a policy that you want, some one may have +already written it. See the L section below for a list of some +of these distributions. + + +=head1 POLICY THEMES + +Each Policy is defined with one or more "themes". Themes can be used to +create arbitrary groups of Policies. They are intended to provide an +alternative mechanism for selecting your preferred set of Policies. For +example, you may wish disable a certain subset of Policies when analyzing test +scripts. Conversely, you may wish to enable only a specific subset of +Policies when analyzing modules. + +The Policies that ship with Perl::Critic are have been broken into the +following themes. This is just our attempt to provide some basic logical +groupings. You are free to invent new themes that suit your needs. + + THEME DESCRIPTION + -------------------------------------------------------------------------- + core All policies that ship with Perl::Critic + pbp Policies that come directly from "Perl Best Practices" + bugs Policies that that prevent or reveal bugs + maintenance Policies that affect the long-term health of the code + cosmetic Policies that only have a superficial effect + complexity Policies that specificaly relate to code complexity + security Policies that relate to security issues + tests Policies that are specific to test scripts + + +Any Policy may fit into multiple themes. Say C<"perlcritic -list"> to get a +listing of all available Policies and the themes that are associated with each +one. You can also change the theme for any Policy in your F<.perlcriticrc> +file. See the L<"CONFIGURATION"> section for more information about that. + +Using the C<-theme> option, you can create an arbitrarily complex rule that +determines which Policies will be loaded. Precedence is the same as regular +Perl code, and you can use parentheses to enforce precedence as well. +Supported operators are: + + Operator Altertative Example + ---------------------------------------------------------------------------- + && and 'pbp && core' + || or 'pbp || (bugs && security)' + ! not 'pbp && ! (portability || complexity)' + +Theme names are case-insensitive. If the C<-theme> is set to an empty string, +then it evaluates as true all Policies. + + +=head1 BENDING THE RULES + +Perl::Critic takes a hard-line approach to your code: either you comply or you +don't. In the real world, it is not always practical (nor even possible) to +fully comply with coding standards. In such cases, it is wise to show that +you are knowingly violating the standards and that you have a Damn Good Reason +(DGR) for doing so. + +To help with those situations, you can direct Perl::Critic to ignore certain +lines or blocks of code by using pseudo-pragmas: + + require 'LegacyLibaray1.pl'; ## no critic + require 'LegacyLibrary2.pl'; ## no critic + + for my $element (@list) { + + ## no critic + + $foo = ""; #Violates 'ProhibitEmptyQuotes' + $barf = bar() if $foo; #Violates 'ProhibitPostfixControls' + #Some more evil code... + + ## use critic + + #Some good code... + do_something($_); + } + +The C<"## no critic"> comments direct Perl::Critic to ignore the remaining +lines of code until the end of the current block, or until a C<"## use +critic"> comment is found (whichever comes first). If the C<"## no critic"> +comment is on the same line as a code statement, then only that line of code +is overlooked. To direct perlcritic to ignore the C<"## no critic"> comments, +use the C<-force> option. + +A bare C<"## no critic"> comment disables all the active Policies. If you +wish to disable only specific Policies, add a list of Policy names as +arguments, just as you would for the C<"no strict"> or C<"no warnings"> +pragmas. For example, this would disable the C and +C policies until the end of the block or until the +next C<"## use critic"> comment (whichever comes first): + + ## no critic (EmptyQuotes, PostfixControls) + + # Now exempt from ValuesAndExpressions::ProhibitEmptyQuotes + $foo = ""; + + # Now exempt ControlStructures::ProhibitPostfixControls + $barf = bar() if $foo; + + # Still subjected to ValuesAndExpression::RequireNumberSeparators + $long_int = 10000000000; + +Since the Policy names are matched against the C<"## no critic"> arguments as +regular expressions, you can abbreviate the Policy names or disable an entire +family of Policies in one shot like this: + + ## no critic (NamingConventions) + + # Now exempt from NamingConventions::ProhibitMixedCaseVars + my $camelHumpVar = 'foo'; + + # Now exempt from NamingConventions::ProhibitMixedCaseSubs + sub camelHumpSub {} + +The argument list must be enclosed in parentheses and must contain one or more +comma-separated barewords (e.g. don't use quotes). The C<"## no critic"> +pragmas can be nested, and Policies named by an inner pragma will be disabled +along with those already disabled an outer pragma. + +Some Policies like C apply to an entire +block of code. In those cases, C<"## no critic"> must appear on the line +where the violation is reported. For example: + + sub complicated_function { ## no critic (ProhibitExcessComplexity) + # Your code here... + } + +Policies such as C apply to the entire +document, in which case violations are reported at line 1. But if the file +requires a shebang line, it is impossible to put C<"## no critic"> on the +first line of the file. This is a known limitation and it will be addressed +in a future release. As a workaround, you can disable the affected policies +at the command-line or in your F<.perlcriticrc> file. But beware that this +will affect the analysis of B files. + +Use this feature wisely. C<"## no critic"> should be used in the smallest +possible scope, or only on individual lines of code. And you should always be +as specific as possible about which policies you want to disable (i.e. never +use a bare C<"## no critic">). If Perl::Critic complains about your code, try +and find a compliant solution before resorting to this feature. + + +=head1 THE L PHILOSOPHY + +Coding standards are deeply personal and highly subjective. The goal of +Perl::Critic is to help you write code that conforms with a set of best +practices. Our primary goal is not to dictate what those practices are, but +rather, to implement the practices discovered by others. Ultimately, you make +the rules -- Perl::Critic is merely a tool for encouraging consistency. If +there is a policy that you think is important or that we have overlooked, we +would be very grateful for contributions, or you can simply load your own +private set of policies into Perl::Critic. + + +=head1 EXTENDING THE CRITIC + +The modular design of Perl::Critic is intended to facilitate the addition of +new Policies. You'll need to have some understanding of L, but most +Policy modules are pretty straightforward and only require about 20 lines of +code. Please see the L file included in this +distribution for a step-by-step demonstration of how to create new Policy +modules. + +If you develop any new Policy modules, feel free to send them to C<< + >> and I'll be happy to put them into the Perl::Critic +distribution. Or if you would like to work on the Perl::Critic project +directly, check out our repository at L. To +subscribe to our mailing list, send a message to C<< + >>. + +The Perl::Critic team is also available for hire. If your organization has +its own coding standards, we can create custom Policies to enforce your local +guidelines. Or if your code base is prone to a particular defect pattern, we +can design Policies that will help you catch those costly defects B +they go into production. To discuss your needs with the Perl::Critic team, +just contact C<< >>. + + +=head1 PREREQUISITES + +Perl::Critic requires the following modules: + +L + +L + +L + +L + +L + +L + +L + +L + +L + +L + +L + +L + +L + +L + +L + +L + + +The following modules are optional, but recommended for complete +testing: + +L + +L + +L + +L + +L + +L + +L + +L + +L + + +=head1 CONTACTING THE DEVELOPMENT TEAM + +You are encouraged to subscribe to the mailing list; send a message to +C<< >>. See also +L. +You can also contact the author at C<< >>. + +At least one member of the development team has started hanging around in +L. + + +=head1 SEE ALSO + +There are a number of distributions of additional Policies available. A few +are listed here: + +L + +L + +L + +L + +L + +L + +These distributions enable you to use Perl::Critic in your unit tests: + +L + +L + +There are also a couple of distributions that will install all the +Perl::Critic related modules known to the development team: + +L + +L + +If you want to make sure you have absolutely everything, you can use these: + +L + +L + + +=head1 BUGS + +Scrutinizing Perl code is hard for humans, let alone machines. If you find +any bugs, particularly false-positives or false-negatives from a +Perl::Critic::Policy, please submit them to +L. Thanks. + +Most policies will produce false-negatives if they cannot understand a +particular block of code. + + +=head1 CREDITS + +Adam Kennedy - For creating L, the heart and soul of L. + +Damian Conway - For writing B, finally :) + +Chris Dolan - For contributing the best features and Policy modules. + +Andy Lester - Wise sage and master of all-things-testing. + +Elliot Shank - The self-proclaimed quality freak. + +Giuseppe Maxia - For all the great ideas and positive encouragement. + +and Sharon, my wife - For putting up with my all-night code sessions. + +Thanks also to the Perl Foundation for providing a grant to support Chris +Dolan's project to implement twenty PBP policies. +L + + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +############################################################################## +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Config.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Config.pm new file mode 100644 index 0000000..575d167 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Config.pm @@ -0,0 +1,1165 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Config.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Config; + +use 5.006001; +use strict; +use warnings; + +use English qw(-no_match_vars); +use Readonly; + +use List::MoreUtils qw(any none apply); +use Scalar::Util qw(blessed); + +use Perl::Critic::Exception::AggregateConfiguration; +use Perl::Critic::Exception::Configuration; +use Perl::Critic::Exception::Configuration::Option::Global::ParameterValue; +use Perl::Critic::Exception::Fatal::Internal qw{ throw_internal }; +use Perl::Critic::PolicyFactory; +use Perl::Critic::Theme qw( $RULE_INVALID_CHARACTER_REGEX cook_rule ); +use Perl::Critic::UserProfile qw(); +use Perl::Critic::Utils qw{ + :booleans :characters :severities :internal_lookup :classification +}; +use Perl::Critic::Utils::Constants qw{ :profile_strictness }; +use Perl::Critic::Utils::DataConversion qw{ boolean_to_number dor }; + +#----------------------------------------------------------------------------- + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $SINGLE_POLICY_CONFIG_KEY => 'single-policy'; + +#----------------------------------------------------------------------------- +# Constructor + +sub new { + + my ( $class, %args ) = @_; + my $self = bless {}, $class; + $self->_init( %args ); + return $self; +} + +#----------------------------------------------------------------------------- + +sub _init { + my ( $self, %args ) = @_; + + # -top or -theme imply that -severity is 1, unless it is already defined + if ( defined $args{-top} || defined $args{-theme} ) { + $args{-severity} ||= $SEVERITY_LOWEST; + } + + my $errors = Perl::Critic::Exception::AggregateConfiguration->new(); + + # Construct the UserProfile to get default options. + my $profile_source = $args{-profile}; #Can be file path or data struct + my $profile = + Perl::Critic::UserProfile->new( -profile => $profile_source ); + my $options_processor = $profile->options_processor(); + $self->{_profile} = $profile; + + $self->_validate_and_save_profile_strictness( + $args{'-profile-strictness'}, + $errors, + ); + + # If given, these options should always have a true value. + $self->_validate_and_save_regex( + 'include', $args{-include}, $options_processor->include(), $errors + ); + $self->_validate_and_save_regex( + 'exclude', $args{-exclude}, $options_processor->exclude(), $errors + ); + $self->_validate_and_save_regex( + $SINGLE_POLICY_CONFIG_KEY, + $args{ qq/-$SINGLE_POLICY_CONFIG_KEY/ }, + $options_processor->single_policy(), + $errors, + ); + + $self->_validate_and_save_verbosity($args{-verbose}, $errors); + $self->_validate_and_save_severity($args{-severity}, $errors); + $self->_validate_and_save_top($args{-top}, $errors); + + # If given, these options can be true or false (but defined) + # We normalize these to numeric values by multiplying them by 1; + { + $self->{_force} = boolean_to_number( dor( $args{-force}, $options_processor->force() ) ); + $self->{_only} = boolean_to_number( dor( $args{-only}, $options_processor->only() ) ); + $self->{_color} = boolean_to_number( dor( $args{-color}, $options_processor->color() ) ); + $self->{_criticism_fatal} = + boolean_to_number(dor( $args{'-criticism_fatal'}, $options_processor->criticism_fatal() ) ); + } + + $self->_validate_and_save_theme($args{-theme}, $errors); + + # Construct a Factory with the Profile + my $factory = + Perl::Critic::PolicyFactory->new( + -profile => $profile, + -errors => $errors, + '-profile-strictness' => $self->profile_strictness(), + ); + $self->{_factory} = $factory; + + # Initialize internal storage for Policies + $self->{_policies} = []; + + # "NONE" means don't load any policies + if ( not defined $profile_source or $profile_source ne 'NONE' ) { + # Heavy lifting here... + $self->_load_policies($errors); + } + + if ( $errors->has_exceptions() ) { + $errors->rethrow(); + } + + return $self; +} + +#----------------------------------------------------------------------------- + +sub add_policy { + + my ( $self, %args ) = @_; + + if ( not $args{-policy} ) { + throw_internal q{The -policy argument is required}; + } + + my $policy = $args{-policy}; + + # If the -policy is already a blessed object, then just add it directly. + if ( blessed $policy ) { + $self->_add_policy_if_enabled($policy); + return $self; + } + + # NOTE: The "-config" option is supported for backward compatibility. + my $params = $args{-params} || $args{-config}; + + my $factory = $self->{_factory}; + my $policy_object = + $factory->create_policy(-name=>$policy, -params=>$params); + $self->_add_policy_if_enabled($policy_object); + + return $self; +} + +#----------------------------------------------------------------------------- + +sub _add_policy_if_enabled { + my ( $self, $policy_object ) = @_; + + my $config = $policy_object->__get_config() + or throw_internal + q{Policy was not set up properly because it doesn't have } + . q{a value for its config attribute.}; + + if ( $policy_object->initialize_if_enabled( $config ) ) { + push @{ $self->{_policies} }, $policy_object; + } + + return; +} + +#----------------------------------------------------------------------------- + +sub _load_policies { + + my ( $self, $errors ) = @_; + my $factory = $self->{_factory}; + my @policies = $factory->create_all_policies( $errors ); + + return if $errors->has_exceptions(); + + for my $policy ( @policies ) { + + # If -single-policy is true, only load policies that match it + if ( $self->single_policy() ) { + if ( $self->_policy_is_single_policy( $policy ) ) { + $self->add_policy( -policy => $policy ); + } + next; + } + + # To load, or not to load -- that is the question. + my $load_me = $self->only() ? $FALSE : $TRUE; + + ## no critic (ProhibitPostfixControls) + $load_me = $FALSE if $self->_policy_is_disabled( $policy ); + $load_me = $TRUE if $self->_policy_is_enabled( $policy ); + $load_me = $FALSE if $self->_policy_is_unimportant( $policy ); + $load_me = $FALSE if not $self->_policy_is_thematic( $policy ); + $load_me = $TRUE if $self->_policy_is_included( $policy ); + $load_me = $FALSE if $self->_policy_is_excluded( $policy ); + + + next if not $load_me; + $self->add_policy( -policy => $policy ); + } + + # When using -single-policy, only one policy should ever be loaded. + if ($self->single_policy() && scalar $self->policies() != 1) { + $self->_add_single_policy_exception_to($errors); + } + + return; +} + +#----------------------------------------------------------------------------- + +sub _policy_is_disabled { + my ($self, $policy) = @_; + my $profile = $self->_profile(); + return $profile->policy_is_disabled( $policy ); +} + +#----------------------------------------------------------------------------- + +sub _policy_is_enabled { + my ($self, $policy) = @_; + my $profile = $self->_profile(); + return $profile->policy_is_enabled( $policy ); +} + +#----------------------------------------------------------------------------- + +sub _policy_is_thematic { + my ($self, $policy) = @_; + my $theme = $self->theme(); + return $theme->policy_is_thematic( -policy => $policy ); +} + +#----------------------------------------------------------------------------- + +sub _policy_is_unimportant { + my ($self, $policy) = @_; + my $policy_severity = $policy->get_severity(); + my $min_severity = $self->{_severity}; + return $policy_severity < $min_severity; +} + +#----------------------------------------------------------------------------- + +sub _policy_is_included { + my ($self, $policy) = @_; + my $policy_long_name = ref $policy; + my @inclusions = $self->include(); + return any { $policy_long_name =~ m/$_/imx } @inclusions; +} + +#----------------------------------------------------------------------------- + +sub _policy_is_excluded { + my ($self, $policy) = @_; + my $policy_long_name = ref $policy; + my @exclusions = $self->exclude(); + return any { $policy_long_name =~ m/$_/imx } @exclusions; +} + +#----------------------------------------------------------------------------- + +sub _policy_is_single_policy { + my ($self, $policy) = @_; + + my @patterns = $self->single_policy(); + return if not @patterns; + + my $policy_long_name = ref $policy; + return any { $policy_long_name =~ m/$_/imx } @patterns; +} + +#----------------------------------------------------------------------------- + +sub _new_global_value_exception { + my ($self, @args) = @_; + + return + Perl::Critic::Exception::Configuration::Option::Global::ParameterValue + ->new(@args); +} + +#----------------------------------------------------------------------------- + +sub _add_single_policy_exception_to { + my ($self, $errors) = @_; + + my $message_suffix = $EMPTY; + my $patterns = join q{", "}, $self->single_policy(); + + if (scalar $self->policies() == 0) { + $message_suffix = + q{did not match any policies (in combination with } + . q{other policy restrictions).}; + } + else { + $message_suffix = qq{matched multiple policies:\n\t}; + $message_suffix .= join qq{,\n\t}, apply { chomp } sort $self->policies(); + } + + $errors->add_exception( + $self->_new_global_value_exception( + option_name => $SINGLE_POLICY_CONFIG_KEY, + option_value => $patterns, + message_suffix => $message_suffix, + ) + ); + + return; +} + +#----------------------------------------------------------------------------- + +sub _validate_and_save_regex { + my ($self, $option_name, $args_value, $default_value, $errors) = @_; + + my $full_option_name; + my $source; + my @regexes; + + if ($args_value) { + $full_option_name = "-$option_name"; + + if (ref $args_value) { + @regexes = @{ $args_value }; + } + else { + @regexes = ( $args_value ); + } + } + + if (not @regexes) { + $full_option_name = $option_name; + $source = $self->_profile()->source(); + + if (ref $default_value) { + @regexes = @{ $default_value }; + } + elsif ($default_value) { + @regexes = ( $default_value ); + } + } + + my $found_errors; + foreach my $regex (@regexes) { + eval { my $test = qr/$regex/imx; } + or do { + my $cleaned_error = $EVAL_ERROR || ''; + $cleaned_error =~ + s/ [ ] at [ ] .* Config [.] pm [ ] line [ ] \d+ [.] \n? \z/./xms; + + $errors->add_exception( + $self->_new_global_value_exception( + option_name => $option_name, + option_value => $regex, + source => $source, + message_suffix => qq{is not valid: $cleaned_error}, + ) + ); + + $found_errors = 1; + } + } + + if (not $found_errors) { + my $option_key = $option_name; + $option_key =~ s/ - /_/xmsg; + + $self->{"_$option_key"} = \@regexes; + } + + return; +} + +#----------------------------------------------------------------------------- + +sub _validate_and_save_profile_strictness { + my ($self, $args_value, $errors) = @_; + + my $option_name; + my $source; + my $profile_strictness; + + if ($args_value) { + $option_name = '-profile-strictness'; + $profile_strictness = $args_value; + } + else { + $option_name = 'profile-strictness'; + + my $profile = $self->_profile(); + $source = $profile->source(); + $profile_strictness = $profile->options_processor()->profile_strictness(); + } + + if ( not $PROFILE_STRICTNESSES{$profile_strictness} ) { + $errors->add_exception( + $self->_new_global_value_exception( + option_name => $option_name, + option_value => $profile_strictness, + source => $source, + message_suffix => q{is not one of "} + . join ( q{", "}, (sort keys %PROFILE_STRICTNESSES) ) + . q{".}, + ) + ); + + $profile_strictness = $PROFILE_STRICTNESS_FATAL; + } + + $self->{_profile_strictness} = $profile_strictness; + + return; +} + +#----------------------------------------------------------------------------- + +sub _validate_and_save_verbosity { + my ($self, $args_value, $errors) = @_; + + my $option_name; + my $source; + my $verbosity; + + if ($args_value) { + $option_name = '-verbose'; + $verbosity = $args_value; + } + else { + $option_name = 'verbose'; + + my $profile = $self->_profile(); + $source = $profile->source(); + $verbosity = $profile->options_processor()->verbose(); + } + + if ( + is_integer($verbosity) + and not is_valid_numeric_verbosity($verbosity) + ) { + $errors->add_exception( + $self->_new_global_value_exception( + option_name => $option_name, + option_value => $verbosity, + source => $source, + message_suffix => + 'is not the number of one of the pre-defined verbosity formats.', + ) + ); + } + else { + $self->{_verbose} = $verbosity; + } + + return; +} + +#----------------------------------------------------------------------------- + +sub _validate_and_save_severity { + my ($self, $args_value, $errors) = @_; + + my $option_name; + my $source; + my $severity; + + if ($args_value) { + $option_name = '-severity'; + $severity = $args_value; + } + else { + $option_name = 'severity'; + + my $profile = $self->_profile(); + $source = $profile->source(); + $severity = $profile->options_processor()->severity(); + } + + if ( is_integer($severity) ) { + if ( + $severity >= $SEVERITY_LOWEST and $severity <= $SEVERITY_HIGHEST + ) { + $self->{_severity} = $severity; + } + else { + $errors->add_exception( + $self->_new_global_value_exception( + option_name => $option_name, + option_value => $severity, + source => $source, + message_suffix => + "is not between $SEVERITY_LOWEST (low) and $SEVERITY_HIGHEST (high).", + ) + ); + } + } + elsif ( not any { $_ eq lc $severity } @SEVERITY_NAMES ) { + $errors->add_exception( + $self->_new_global_value_exception( + option_name => $option_name, + option_value => $severity, + source => $source, + message_suffix => + q{is not one of the valid severity names: "} + . join (q{", "}, @SEVERITY_NAMES) + . q{".}, + ) + ); + } + else { + $self->{_severity} = severity_to_number($severity); + } + + return; +} + +#----------------------------------------------------------------------------- + +sub _validate_and_save_top { + my ($self, $args_value, $errors) = @_; + + my $option_name; + my $source; + my $top; + + if (defined $args_value and $args_value ne q{}) { + $option_name = '-top'; + $top = $args_value; + } + else { + $option_name = 'top'; + + my $profile = $self->_profile(); + $source = $profile->source(); + $top = $profile->options_processor()->top(); + } + + if ( is_integer($top) and $top >= 0 ) { + $self->{_top} = $top; + } + else { + $errors->add_exception( + $self->_new_global_value_exception( + option_name => $option_name, + option_value => $top, + source => $source, + message_suffix => q{is not a non-negative integer.}, + ) + ); + } + + return; +} + +#----------------------------------------------------------------------------- + +sub _validate_and_save_theme { + my ($self, $args_value, $errors) = @_; + + my $option_name; + my $source; + my $theme_rule; + + if ($args_value) { + $option_name = '-theme'; + $theme_rule = $args_value; + } + else { + $option_name = 'theme'; + + my $profile = $self->_profile(); + $source = $profile->source(); + $theme_rule = $profile->options_processor()->theme(); + } + + if ( $theme_rule =~ m/$RULE_INVALID_CHARACTER_REGEX/xms ) { + my $bad_character = $1; + + $errors->add_exception( + $self->_new_global_value_exception( + option_name => $option_name, + option_value => $theme_rule, + source => $source, + message_suffix => + qq{contains an illegal character ("$bad_character").}, + ) + ); + } + else { + my $rule_as_code = cook_rule($theme_rule); + $rule_as_code =~ s/ [\w\d]+ / 1 /gxms; + + # eval of an empty string does not reset $@ in Perl 5.6. + local $EVAL_ERROR = $EMPTY; + eval $rule_as_code; ## no critic (ProhibitStringyEval, RequireCheckingReturnValueOfEval) + + if ($EVAL_ERROR) { + $errors->add_exception( + $self->_new_global_value_exception( + option_name => $option_name, + option_value => $theme_rule, + source => $source, + message_suffix => q{is not syntactically valid.}, + ) + ); + } + else { + eval { + $self->{_theme} = + Perl::Critic::Theme->new( -rule => $theme_rule ); + } + or do { + $errors->add_exception_or_rethrow( $EVAL_ERROR ); + }; + } + } + + return; +} + +#----------------------------------------------------------------------------- +# Begin ACCESSSOR methods + +sub _profile { + my $self = shift; + return $self->{_profile}; +} + +#----------------------------------------------------------------------------- + +sub policies { + my $self = shift; + return @{ $self->{_policies} }; +} + +#----------------------------------------------------------------------------- + +sub exclude { + my $self = shift; + return @{ $self->{_exclude} }; +} + +#----------------------------------------------------------------------------- + +sub force { + my $self = shift; + return $self->{_force}; +} + +#----------------------------------------------------------------------------- + +sub include { + my $self = shift; + return @{ $self->{_include} }; +} + +#----------------------------------------------------------------------------- + +sub only { + my $self = shift; + return $self->{_only}; +} + +#----------------------------------------------------------------------------- + +sub profile_strictness { + my $self = shift; + return $self->{_profile_strictness}; +} + +#----------------------------------------------------------------------------- + +sub severity { + my $self = shift; + return $self->{_severity}; +} + +#----------------------------------------------------------------------------- + +sub single_policy { + my $self = shift; + return @{ $self->{_single_policy} }; +} + +#----------------------------------------------------------------------------- + +sub theme { + my $self = shift; + return $self->{_theme}; +} + +#----------------------------------------------------------------------------- + +sub top { + my $self = shift; + return $self->{_top}; +} + +#----------------------------------------------------------------------------- + +sub verbose { + my $self = shift; + return $self->{_verbose}; +} + +#----------------------------------------------------------------------------- + +sub color { + my $self = shift; + return $self->{_color}; +} + +#----------------------------------------------------------------------------- + +sub criticism_fatal { + my $self = shift; + return $self->{_criticism_fatal}; +} + +#----------------------------------------------------------------------------- + +sub site_policy_names { + return Perl::Critic::PolicyFactory::site_policy_names(); +} + +1; + +#----------------------------------------------------------------------------- + +__END__ + +=pod + +=for stopwords -params INI-style + +=head1 NAME + +Perl::Critic::Config - The final derived Perl::Critic configuration, combined from any profile file and command-line parameters. + +=head1 DESCRIPTION + +Perl::Critic::Config takes care of finding and processing +user-preferences for L. The Config object defines which +Policy modules will be loaded into the Perl::Critic engine and how +they should be configured. You should never really need to +instantiate Perl::Critic::Config directly because the Perl::Critic +constructor will do it for you. + +=head1 CONSTRUCTOR + +=over 8 + +=item C<< new( [ -profile => $FILE, -severity => $N, -theme => $string, -include => \@PATTERNS, -exclude => \@PATTERNS, -single-policy => $PATTERN, -top => $N, -only => $B, -profile-strictness => $PROFILE_STRICTNESS_{WARN|FATAL|QUIET}, -force => $B, -verbose => $N, -color => $B, -criticism-fatal => $B] ) >> + +=item C<< new() >> + +Returns a reference to a new Perl::Critic::Config object. The default +value for all arguments can be defined in your F<.perlcriticrc> file. +See the L<"CONFIGURATION"> section for more information about that. +All arguments are optional key-value pairs as follows: + +B<-profile> is a path to a configuration file. If C<$FILE> is not +defined, Perl::Critic::Config attempts to find a F<.perlcriticrc> +configuration file in the current directory, and then in your home +directory. Alternatively, you can set the C environment +variable to point to a file in another location. If a configuration +file can't be found, or if C<$FILE> is an empty string, then all +Policies will be loaded with their default configuration. See +L<"CONFIGURATION"> for more information. + +B<-severity> is the minimum severity level. Only Policy modules that +have a severity greater than C<$N> will be loaded into this Config. +Severity values are integers ranging from 1 (least severe) to 5 (most +severe). The default is 5. For a given C<-profile>, decreasing the +C<-severity> will usually result in more Policy violations. Users can +redefine the severity level for any Policy in their F<.perlcriticrc> +file. See L<"CONFIGURATION"> for more information. + +B<-theme> is special string that defines a set of Policies based on +their respective themes. If C<-theme> is given, only policies that +are members of that set will be loaded. See the L<"POLICY THEMES"> +section for more information about themes. Unless the C<-severity> +option is explicitly given, setting C<-theme> causes the C<-severity> +to be set to 1. + +B<-include> is a reference to a list of string C<@PATTERNS>. Policies +that match at least one C will be loaded into this +Config, irrespective of the severity settings. You can use it in +conjunction with the C<-exclude> option. Note that C<-exclude> takes +precedence over C<-include> when a Policy matches both patterns. + +B<-exclude> is a reference to a list of string C<@PATTERNS>. Polices +that match at least one C will not be loaded into this +Config, irrespective of the severity settings. You can use it in +conjunction with the C<-include> option. Note that C<-exclude> takes +precedence over C<-include> when a Policy matches both patterns. + +B<-single-policy> is a string C. Only the policy that matches +C will be used. This value overrides the +C<-severity>, C<-theme>, C<-include>, C<-exclude>, and C<-only> +options. + +B<-top> is the maximum number of Violations to return when ranked by +their severity levels. This must be a positive integer. Violations +are still returned in the order that they occur within the file. +Unless the C<-severity> option is explicitly given, setting C<-top> +silently causes the C<-severity> to be set to 1. + +B<-only> is a boolean value. If set to a true value, Perl::Critic +will only choose from Policies that are mentioned in the user's +profile. If set to a false value (which is the default), then +Perl::Critic chooses from all the Policies that it finds at your site. + +B<-profile-strictness> is an enumerated value, one of +L (the +default), +L, and +L. If set +to L, +Perl::Critic will make certain warnings about problems found in a +F<.perlcriticrc> or file specified via the B<-profile> option fatal. +For example, Perl::Critic normally only Cs about profiles +referring to non-existent Policies, but this value makes this +situation fatal. Correspondingly, +L makes +Perl::Critic shut up about these things. + +B<-force> controls whether Perl::Critic observes the magical C<"## no +critic"> pseudo-pragmas in your code. If set to a true value, +Perl::Critic will analyze all code. If set to a false value (which is +the default) Perl::Critic will ignore code that is tagged with these +comments. See L for more +information. + +B<-verbose> can be a positive integer (from 1 to 10), or a literal +format specification. See L for an +explanation of format specifications. + +B<-color> is not used by Perl::Critic but is provided for the benefit +of L. + +B<-criticism-fatal> is not used by Perl::Critic but is provided for the benefit +of L. + + + +=back + +=head1 METHODS + +=over 8 + +=item C<< add_policy( -policy => $policy_name, -params => \%param_hash ) >> + +Creates a Policy object and loads it into this Config. If the object +cannot be instantiated, it will throw a fatal exception. Otherwise, +it returns a reference to this Critic. + +B<-policy> is the name of a L subclass +module. The C<'Perl::Critic::Policy'> portion of the name can be +omitted for brevity. This argument is required. + +B<-params> is an optional reference to a hash of Policy parameters. +The contents of this hash reference will be passed into to the +constructor of the Policy module. See the documentation in the +relevant Policy module for a description of the arguments it supports. + +=item C< policies() > + +Returns a list containing references to all the Policy objects that +have been loaded into this Config. Objects will be in the order that +they were loaded. + +=item C< exclude() > + +Returns the value of the C<-exclude> attribute for this Config. + +=item C< include() > + +Returns the value of the C<-include> attribute for this Config. + +=item C< force() > + +Returns the value of the C<-force> attribute for this Config. + +=item C< only() > + +Returns the value of the C<-only> attribute for this Config. + +=item C< profile_strictness() > + +Returns the value of the C<-profile-strictness> attribute for this +Config. + +=item C< severity() > + +Returns the value of the C<-severity> attribute for this Config. + +=item C< single_policy() > + +Returns the value of the C<-single-policy> attribute for this Config. + +=item C< theme() > + +Returns the L object that was created for +this Config. + +=item C< top() > + +Returns the value of the C<-top> attribute for this Config. + +=item C< verbose() > + +Returns the value of the C<-verbose> attribute for this Config. + +=item C< color() > + +Returns the value of the C<-color> attribute for this Config. + +=item C< criticism_fatal() > + +Returns the value of the C<-criticsm-fatal> attribute for this Config. + +=back + +=head1 SUBROUTINES + +Perl::Critic::Config has a few static subroutines that are used +internally, but may be useful to you in some way. + +=over 8 + +=item C + +Returns a list of all the Policy modules that are currently installed +in the Perl::Critic:Policy namespace. These will include modules that +are distributed with Perl::Critic plus any third-party modules that +have been installed. + +=back + +=head1 CONFIGURATION + +Most of the settings for Perl::Critic and each of the Policy modules +can be controlled by a configuration file. The default configuration +file is called F<.perlcriticrc>. L will look +for this file in the current directory first, and then in your home +directory. Alternatively, you can set the C environment +variable to explicitly point to a different file in another location. +If none of these files exist, and the C<-profile> option is not given +to the constructor, then all Policies will be loaded with their +default configuration. + +The format of the configuration file is a series of INI-style +blocks that contain key-value pairs separated by '='. Comments +should start with '#' and can be placed on a separate line or after +the name-value pairs if you desire. + +Default settings for Perl::Critic itself can be set B For example, putting any or all of these at the top of +your configuration file will set the default value for the +corresponding Perl::Critic constructor argument. + + severity = 3 #Integer from 1 to 5 + only = 1 #Zero or One + force = 0 #Zero or One + verbose = 4 #Integer or format spec + top = 50 #A positive integer + theme = risky + (pbp * security) - cosmetic #A theme expression + include = NamingConventions ClassHierarchies #Space-delimited list + exclude = Variables Modules::RequirePackage #Space-delimited list + color = 1 #Zero or One + +The remainder of the configuration file is a series of blocks like +this: + + [Perl::Critic::Policy::Category::PolicyName] + severity = 1 + set_themes = foo bar + add_themes = baz + arg1 = value1 + arg2 = value2 + +C is the full name of a +module that implements the policy. The Policy modules distributed +with Perl::Critic have been grouped into categories according to the +table of contents in Damian Conway's book B. For +brevity, you can omit the C<'Perl::Critic::Policy'> part of the +module name. + +C is the level of importance you wish to assign to the +Policy. All Policy modules are defined with a default severity value +ranging from 1 (least severe) to 5 (most severe). However, you may +disagree with the default severity and choose to give it a higher or +lower severity, based on your own coding philosophy. + +The remaining key-value pairs are configuration parameters that will +be passed into the constructor of that Policy. The constructors for +most Policy modules do not support arguments, and those that do should +have reasonable defaults. See the documentation on the appropriate +Policy module for more details. + +Instead of redefining the severity for a given Policy, you can +completely disable a Policy by prepending a '-' to the name of the +module in your configuration file. In this manner, the Policy will +never be loaded, regardless of the C<-severity> given to the +Perl::Critic::Config constructor. + +A simple configuration might look like this: + + #-------------------------------------------------------------- + # I think these are really important, so always load them + + [TestingAndDebugging::RequireUseStrict] + severity = 5 + + [TestingAndDebugging::RequireUseWarnings] + severity = 5 + + #-------------------------------------------------------------- + # I think these are less important, so only load when asked + + [Variables::ProhibitPackageVars] + severity = 2 + + [ControlStructures::ProhibitPostfixControls] + allow = if unless #My custom configuration + severity = 2 + + #-------------------------------------------------------------- + # Give these policies a custom theme. I can activate just + # these policies by saying (-theme => 'larry + curly') + + [Modules::RequireFilenameMatchesPackage] + add_themes = larry + + [TestingAndDebugging::RequireTestLables] + add_themes = curly moe + + #-------------------------------------------------------------- + # I do not agree with these at all, so never load them + + [-NamingConventions::ProhibitMixedCaseVars] + [-NamingConventions::ProhibitMixedCaseSubs] + + #-------------------------------------------------------------- + # For all other Policies, I accept the default severity, theme + # and other parameters, so no additional configuration is + # required for them. + +For additional configuration examples, see the F file +that is included in this F directory of this distribution. + +=head1 THE POLICIES + +A large number of Policy modules are distributed with Perl::Critic. +They are described briefly in the companion document +L and in more detail in the individual +modules themselves. + +=head1 POLICY THEMES + +Each Policy is defined with one or more "themes". Themes can be used to +create arbitrary groups of Policies. They are intended to provide an +alternative mechanism for selecting your preferred set of Policies. For +example, you may wish disable a certain subset of Policies when analyzing test +scripts. Conversely, you may wish to enable only a specific subset of +Policies when analyzing modules. + +The Policies that ship with Perl::Critic are have been broken into the +following themes. This is just our attempt to provide some basic logical +groupings. You are free to invent new themes that suit your needs. + + THEME DESCRIPTION + -------------------------------------------------------------------------- + core All policies that ship with Perl::Critic + pbp Policies that come directly from "Perl Best Practices" + bugs Policies that that prevent or reveal bugs + maintenance Policies that affect the long-term health of the code + cosmetic Policies that only have a superficial effect + complexity Policies that specificaly relate to code complexity + security Policies that relate to security issues + tests Policies that are specific to test scripts + + +Say C<`perlcritic -list`> to get a listing of all available policies +and the themes that are associated with each one. You can also change +the theme for any Policy in your F<.perlcriticrc> file. See the +L<"CONFIGURATION"> section for more information about that. + +Using the C<-theme> option, you can combine theme names with mathematical and +boolean operators to create an arbitrarily complex expression that represents +a custom "set" of Policies. The following operators are supported + + Operator Alternative Meaning + ---------------------------------------------------------------------------- + * and Intersection + - not Difference + + or Union + +Operator precedence is the same as that of normal mathematics. You +can also use parenthesis to enforce precedence. Here are some examples: + + Expression Meaning + ---------------------------------------------------------------------------- + pbp * bugs All policies that are "pbp" AND "bugs" + pbp and bugs Ditto + + bugs + cosmetic All policies that are "bugs" OR "cosmetic" + bugs or cosmetic Ditto + + pbp - cosmetic All policies that are "pbp" BUT NOT "cosmetic" + pbp not cosmetic Ditto + + -maintenance All policies that are NOT "maintenance" + not maintenance Ditto + + (pbp - bugs) * complexity All policies that are "pbp" BUT NOT "bugs", + AND "complexity" + (pbp not bugs) and complexity Ditto + +Theme names are case-insensitive. If C<-theme> is set to an empty string, +then it is equivalent to the set of all Policies. A theme name that doesn't +exist is equivalent to an empty set. Please See +L for a discussion on set theory. + +=head1 SEE ALSO + +L, L + + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +############################################################################## +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/DEVELOPER.pod b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/DEVELOPER.pod new file mode 100644 index 0000000..d08e89a --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/DEVELOPER.pod @@ -0,0 +1,1058 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/DEVELOPER.pod $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +=pod + +=for stopwords lookup RequireBlockGrep + +=head1 NAME + +Perl::Critic::DEVELOPER - How to make new Perl::Critic::Policy modules. + + +=head1 DESCRIPTION + +For developers who want to create custom coding standards, the +following tells how to create a Policy module for L. +Although the Perl::Critic distribution already includes a number of +Policies based on Damian Conway's book I (which +will be referred to via "I" from here on), Perl::Critic is not +limited to his guidelines and can be used to enforce any practice, +preference, or style that you want to follow. You can even write +Policies to enforce contradictory guidelines. All you need to do is +write a corresponding L subclass, which may +require as little as 10 lines of code. + + +=head1 BACKGROUND + +The heart of Perl::Critic is L, a parser and lexer for Perl. PPI +transforms Perl source code into a Document Object Model (DOM). Each +token in the document is represented by a PPI class, such as +L or L, and then organized +into structure classes, like L and +L. The root node of the hierarchy is the +L. + +The L engine traverses each node in the L +tree and invokes each of the L subclasses at the +appropriate node. The Policy can inspect the node, look at the +surrounding nodes, and do whatever else it wants. If the Policy +decides that that a coding standard has been violated, it returns one +or more L objects. If there are no +violations, then the Policy returns nothing. + +Policies are usually written based on existing policies, so let's look +at one to see how it works. The F Policy is +relatively simple and demonstrates most of the important issues. The +goal of this Policy is to enforce that every call to C uses a +block for the first argument and not an expression. The reasons for +this Policy are discussed in detail in I. + + +=head1 EXAMPLE POLICY + +First, the Policy module needs to have a name. Perl::Critic uses +L to automatically discover all modules in the +C namespace. Also, we've adopted the convention +of grouping Policies into directories according to the chapters of +I. Since the goal of this Policy is to enforce the use of block +arguments to C and it comes from the "Builtin Functions" chapter +of I, we call it +C<"Perl::Critic::Policy::BuiltinFunctions::RequireBlockGrep">. + + package Perl::Critic::Policy::BuiltinFunctions::RequireBlockGrep; + +Next, we set some pragmas and load the modules that we'll need. All +Policy modules inherit from the L class, which +provides no-op implementations of the basic methods. Our job is to +override these methods to make them do something useful. + +Technically, C and C are optional, but we +don't want Perl::Critic to be a hypocrite, now do we? + + use strict; + use warnings; + + use Readonly; + + use Perl::Critic::Utils qw{ :severities :classification :ppi }; + use base 'Perl::Critic::Policy'; + + our $VERSION = '1.05'; + +Next, we'll declare a description and explanation for this Policy. +The description is always just a string that basically says "this is +what's wrong." The explanation can be either a string with further +details, or a reference to an array of integers that correspond to +page numbers in I. We make them read-only because they never +change. (See +L for why +we don't C.) + + Readonly::Scalar my $DESC => q{Expression form of "grep"}; + Readonly::Scalar my $EXPL => [ 169 ]; + +Most policies don't need to override the C +method provided by L. However, if your Policy +is configurable via F<.perlcriticrc>, you should implement a +C method and need to implement +C to examine the C<$config> values. Since +this Policy isn't configurable, we'll declare that by providing an +implementation of C that returns an empty +list. + + sub supported_parameters { return () } + +Next, we define the C method, which must return an +integer indicating the severity of violating this Policy. Severity +values range from 1 to 5, where 5 is the "most severe." In general, +level 5 is reserved for things that are frequently misused and/or +cause bugs. Level 1 is for things that are highly subjective or +purely cosmetic. The L package exports several +severity constants that you can use here via the C<:severities> tag. + + sub default_severity { return $SEVERITY_HIGH } + +Likewise, the C method returns a list of theme +names. Themes are intended to be named groups of Policies. All +Policies that ship with Perl::Critic have a C<"core"> theme. Since +use of C without blocks often leads to bugs, we include a +C<"bugs"> theme. And since this Policy comes directly from I, +this Policy should be a member of the C<"pbp"> theme. + + sub default_themes { return qw( core bugs pbp ) } + +As a Policy author, you can assign any themes you want to the Policy. +If you're publishing a suite of custom Policies, we suggest that you +create a unique theme that covers all the Policies in the +distribution. That way, users can easily enable or disable all of +your policies at once. For example, Policies in the +L distribution all have a C<"more"> theme. + +Next, we indicate what elements of the code this Policy will analyze, +like statements or variables or conditionals or POD. These elements +are specified as PPI classes such as L, +L, L or +L respectively. The applies_to() method returns a +list of PPI package names. (You can get that list of available +package names via C.) As Perl::Critic traverses the +document, it will call the C method from this module +whenever it encounters one of the PPI types that are given here. In +this case, we just want to test calls to C. Since the token +"grep" is a L, we return that package name from the +C method. + + sub applies_to { return 'PPI::Token::Word' } + +If your Policy needs to analyze several different types of elements, +the C method may return the name of several PPI packages. +If your Policy needs to examine the file as a whole, then the +C method should return L. Since there is +only one PPI::Document element, your Policy would only be invoked once +per file. + +Now comes the interesting part. The C method does all the +work. It is always called with 2 arguments: a reference to the +current PPI element that Perl::Critic is traversing, and a reference +to the entire PPI document. [And since this is an object method, there +will be an additional argument that is a reference to this object +(C<$self>), but you already knew that!] Since this Policy does not +need access to the document as a whole, we ignore the last parameter +by assigning to C. + + sub violates { + my ( $self, $elem, undef ) = @_; + +The violates() method then often performs some tests to make sure we +have the right "type" of element. In our example, we know that the +element will be a L because that's what we declared +back in the C method. However, we didn't specify +exactly which "word" we were looking for. Evaluating a PPI element in +a string context returns the literal form of the code. (You can also +use the c method.) So we make sure that this +PPI::Token::Word is, in fact, "grep". If it's not, then we don't' +need to bother examining it. + + return if $elem ne 'grep'; + +The C class is also used for barewords and methods +called on object references. It is possible for someone to declare a +bareword hash key as C<<%hash = ( grep => 'foo' )>>. We don't want to +test those types of elements because they don't represent function +calls to C. So we use one of handy utility functions from +L to make sure that this "grep" is actually in +the right context. (The C subroutine is brought +in via the C<:classification> tag.) + + return if ! is_function_call($elem); + +Now that we know this element is a call to the C function, we +can look at the nearby elements to see what kind of arguments are +being passed to it. In the following paragraphs, we discuss how to do +this manually in order to explore L; after that, we'll show how +this Policy actually uses facilities provided by +L to get this done. + +Every PPI element is linked to its siblings, parent, and children (if +it has any). Since those siblings could just be whitespace, we use +the C to get the next code-sibling (the "s" in +C stands for "significant"). + + my $sib = $elem->snext_sibling() or return; + +In Perl, the parenthesis around argument lists are usually optional, +and PPI packs the elements into a L object when +parentheses are used. So if the sibling is a PPI::Structure::List, we +pull out the first (significant) child of that list. This child will +be the first argument to C. If parentheses were not used, then +the sibling itself is the first argument. + + my $arg = $sib->isa('PPI::Structure::List') ? $sib->schild(0) : $sib; + +In actuality, this sort of function argument lookup is common, so +there is a L subroutine available via +the C<:ppi> tag. So we use that instead. + + my $arg = first_arg($elem); + +Finally, we now have a reference to the first argument to C. If +that argument is a block (i.e. something in curly braces), then it +will be a L, in which case our Policy is +satisfied and we just return nothing. + + return if !$arg; + return if $arg->isa('PPI::Structure::Block'); + +But if it is not a L, then we know that this +call to C must be using the expression form, and that violates +our Policy. So we create and return a new L +object via the L method, passing in +the description, explanation, and a reference to the PPI element that +caused the violation. And that's all there is to it! + + return $self->violation( $DESC, $EXPL, $elem ); + } + + 1; + +One last thing -- people are going to need to understand what is wrong +with the code when your Policy finds a problem. It isn't reasonable +to include all the details in your violation description or +explanation. So please include a DESCRIPTION section in the POD for +your Policy. It should succinctly describe the behavior and +motivation for your Policy and include a few examples of both good and +bad code. Here's an example: + + =pod + + =head1 NAME + + Perl::Critic::Policy::BuiltinFunctions::RequireBlockGrep + + + =head1 DESCRIPTION + + The expression forms of C and C are awkward and hard to read. + Use the block forms instead. + + @matches = grep /pattern/, @list; #not ok + @matches = grep { /pattern/ } @list; #ok + + @mapped = map transform($_), @list; #not ok + @mapped = map { transform($_) } @list; #ok + + =cut + +When your policy has a section like this, users can invoke +L with a C<--verbose> parameter of C<10> or C<11> to see +it along with the rest of the output for violations of your policy. + + +=head1 MAKING YOUR POLICY CONFIGURABLE + +L takes care of gathering configuration information for +your Policy, from whatever source the user specifies. (See +L for the details of how a user specifies +the values you're going to receive.) What your Policy ends up +receiving for the value of a parameter is a string with leading and +trailing whitespace removed. By default, you will need to handle +conversion of that string to a useful form yourself. However, if you +provide some metadata about your parameters, the parameter handling +will be taken care of for you. (Additionally, tools that deal with +Policies themselves can use this information to enhance their +functionality. See the L C<--profile-proto> option for an +example.) + +You can look at +L +for a simple example of a configurable Policy and +L for a more +complex one. + +=head2 Do It All Yourself + +The C method for a Policy receives one +argument: an instance of L. This method +is only called if the user's configuration has enabled the policy. It +returns a boolean stating whether the Policy should continue to be +enabled. Generally, the only reason to return C<$FALSE> is when some +external requirement is missing. For example, +L disables itself +if L is not installed. + +A basic, do-nothing implementation of C would +be: + + use Perl::Critic::Utils qw< :booleans >; + + ... + + sub initialize_if_enabled { + my ( $self, $config ) = @_; + + return $TRUE; + } + +As stated above, what you get in C<$config> are trimmed strings. For +example, if the user's F<.perlcritic> contains + + [Your::Policy] + foo = bar baz + factor = 5.52 + selections = 2 78 92 + +then C<$config> will contain the equivalent of + + my $config = { + foo => 'bar baz', + factor => '5.52', + selections => '2 78 92', + }; + +To make this available to the C method, the values are +usually put into C<$self> under the name of the configuration item +prefixed with an underscore. E.g. + + sub initialize_if_enabled { + my ( $self, $config ) = @_; + + $self->{_foo} = $config->get{foo}; + $self->{_factor} = $config->get{factor}; + $self->{_selections} = $config->get{selections}; + + return $TRUE; + } + +Often, you'll want to convert the configuration values into something +more useful. In this example, C is supposed to be a list +of integers. L contains a number of functions +that can help you with this. Assuming that C wants to +have C as an array, you'll want to have something like +this: + + use Perl::Critic::Utils qw{ :booleans :characters :data_conversion }; + + sub initialize_if_enabled { + my ( $self, $config ) = @_; + + $self->{_foo} = $config->get{foo}; + $self->{_factor} = $config->get{factor}; + + my $selections = $config->get{selections}; + $selections = defined $selections ? $selections : $EMPTY_STRING; + $self->{_selections} = [ words_from_string($selections) ]; + + return $TRUE; + } + +Since C contains numbers, it may be desirable to change +the assignment to look like + + $self->{_selections} = [ map { $_ + 0 } words_from_string($selections) ]; + +If C needs to quickly determine whether a particular value +is in C, you would want to use a hash instead of an array, +like this: + + $self->{_selections} = { hashify( words_from_string($selections) ) }; + +For an example of a Policy that has some simple, but non-standard +configuration handling, see +L. + + +=head2 Note On Constructors + +It used to be the case that Policies handled configuration by +implementing a constructor. However, there was no requirement to call +the base constructor; as long as the Policy ended up being a blessed +hash reference, everything was fine. Unfortunately, this meant that +Policies would be loaded and their prerequisites would be Cd, +even if the Policy wasn't enabled, slowing things down. Also, this +severely restricted the core of L's ability to enhance +things. Use of constructors is deprecated and is incompatible with +C metadata below. Kindly use +C, instead, to do any sort of set up that you +need. + + + +=head2 Providing Basic Configuration Information Via C + +As minimum for a well behaved Policy, you should implement +C in order to tell the rest of C +what configuration values the Policy looks for, even if it is only to say +that the Policy is not configurable. In the simple form, this +function returns a list of the names of the parameters the Policy +supports. So, for an non-configurable Policy, as in the +C example above, this looked like + + sub supported_parameters { return () } + +For the example being used in the C section +above, this would be + + sub supported_parameters { return qw< foo factor selections >; } + +Given this information, C can tell the user when they +have specified a parameter for a Policy which isn't valid, e.g. when +they've misspelled the name of the parameter, and can emit the +parameter as part of a F<.perlcritic> prototype. + +You can provide even more information about your Policy's +configuration by giving each parameter a description and a string +representation of the default value for the parameter. You do this by +having the values in the list returned by C be +hash references instead of strings, with keys of C, +C, and C. For example, + + sub supported_parameters { + return ( + { + name => 'allowed_values', + description => + 'Individual and ranges of values to allow, and/or "all_integers".', + default_string => '0 1 2', + }, + { + name => 'allowed_types', + description => 'Kind of literals to allow.', + default_string => 'Float', + }, + ); + } + +Note that use of constructors is +L with specifying parameters in +this way. + + +=head2 Using C to Get It Done For You + +The C discussion above showed how you could +help others with your Policy, but didn't do anything to make your life +as a Policy author easier; you still need to implement +C to access any configuration that the user +has specified. To have the configuration automatically handled for +you, you need to declare how your parameters act by specifying a value +for their C. For example, the following declares that a +parameter allows the user to choose from five specific values and that +the user can select any combination of them: + + sub supported_parameters { + return ( + { + name => 'allowed_types', + description => 'Kind of literals to allow.', + default_string => 'Float', + behavior => 'enumeration', + enumeration_values => [ qw{ Binary Exp Float Hex Octal } ], + enumeration_allow_multiple_values => 1, + }, + ); + } + +When you specify a behavior, parsing and validation of the +user-specified and default values is done for you and your +C method can retrieve the value under the key of the +parameter name prefixed with an underscore, e.g., for the above +declaration, the parsed and validated value can be accessed via +C<<$self->{_allowed_types}>>. + +The behaviors provide additional functionality to C; for +more on this, see L and +L. + +The following discusses each of the supported behaviors and the +options they support. For the full details of a behavior, see the +documentation for the implementing class. + + +=head3 "string" + +Implemented in L. + +The most basic of behaviors, the value of the parameter will be stored +in the Policy as a string. + +This behavior is not configurable. + +=head4 C example + + sub supported_parameters { + return ( + { + name => 'a_string', + description => 'An example string.', + default_string => 'blah blah blah', + behavior => 'string', + }, + ); + } + + +=head4 Access example + + sub violates { + my ($self, $element, $document) = @_; + + ... + my $string = $self->{_a_string}; + ... + } + + +=head3 "boolean" + +Implemented in L. + +The value of the parameter will be either L +or L. + +This behavior is not configurable. + +=head4 C example + + sub supported_parameters { + return ( + { + name => 'a_boolean', + description => 'An example boolean.', + default_string => '1', + behavior => 'boolean', + }, + ); + } + + +=head4 Access example + + sub violates { + my ($self, $element, $document) = @_; + + ... + my $is_whatever = $self->{_a_boolean}; + if ($is_whatever) { + ... + } + ... + } + + +=head3 "integer" + +Implemented in L. + +The value is validated against C +(with an special check for "0"). Notice that this means that +underscores are allowed in input values as with Perl numeric literals. + +This takes two options, C and +C, which specify endpoints of an inclusive range to +restrict the value to. Either, neither, or both may be specified. + +=head4 C example + + sub supported_parameters { + return ( + { + name => 'an_integer', + description => 'An example integer.', + default_string => '5', + behavior => 'integer', + integer_minimum => 0, + integer_maximum => 10, + }, + ); + } + + +=head4 Access example + + sub violates { + my ($self, $element, $document) = @_; + + ... + my $integer = $self->{_an_integer}; + if ($integer > $TURNING_POINT) { + ... + } + ... + } + + +=head3 "string list" + +Implemented in L. + +The values will be derived by splitting the input string on blanks. +(See L.) The parameter will +be stored as a reference to a hash, with the values being the keys. + +This takes one optional option, C, of a +reference to an array of strings that will always be included in the +parameter value, e.g. if the value of this option is +C<[ qw{ a b c } ]> and the user specifies a value of C<'c d e'>, then +the value of the parameter will contain C<'a'>, C<'b'>, C<'c'>, +C<'d'>, and C<'e'>. + +=head4 C example + + sub supported_parameters { + return ( + { + name => 'a_string_list', + description => 'An example list.', + default_string => 'red pink blue', + behavior => 'string list', + always_present_values => [ qw{ green purple} ], + }, + ); + } + + +=head4 Access example + + sub violates { + my ($self, $element, $document) = @_; + + ... + my $list = $self->{_a_string_list}; + my @list = keys %{$list}; + ... + return if not $list->{ $element->content() }; + ... + } + + +=head3 "enumeration" + +Implemented in L. + +The values will be derived by splitting the input string on blanks. +(See L.) Depending upon the +value of the C option, the +parameter will be stored as a string or a reference to a hash, with +the values being the keys. + +This behavior takes one required option and one optional one. A value +for C of a reference to an array of valid strings +is required. A true value can be specified for +C to allow the user to pick more +than one value, but this defaults to false. + +=head4 C example + + use Perl::Critic::Utils qw{ :characters }; + + sub supported_parameters { + return ( + { + name => 'a_single_valued_enumeration', + description => + 'An example enumeration that can only have a single value.', + default_string => $EMPTY, + behavior => 'enumeration', + enumeration_values => [ qw{ block statement pod operator } ], + enumeration_allow_multiple_values => 0, + }, + { + name => 'a_multi_valued_enumeration', + description => + 'An example enumeration that can have multiple values.', + default_string => 'fe', + behavior => 'enumeration', + enumeration_values => [ qw{ fe fi fo fum } ], + enumeration_allow_multiple_values => 1, + }, + ); + } + + +=head4 Access example + + sub violates { + my ($self, $element, $document) = @_; + + ... + my $single_value = $self->{_a_single_valued_enumeration}; + ... + my $multi_value = $self->{_a_multi_valued_enumeration}; + if ( $multi_value->{fum} ) { + ... + } + ... + } + + +=head2 Using a Custom Parser + +If none of the behaviors does exactly what you want it to, you can +provide your own parser for a parameter. The reason for doing this as +opposed to using an implementation of C is +that it allows you to use a behavior to provide its extra +functionality and it provides a means for a C +configuration program, e.g. an IDE that integrates C, to +validate your parameter as the user modifies its value. + +The way you declare that you have a custom parser is to include a +reference to it in the parameter specification with the C key. +For example: + + sub supported_parameters { + return ( + { + name => 'file_name', + description => 'A file for to read a list of values from.', + default_string => undef, + behavior => 'string', + parser => \&_parse_file_name, + }, + ); + } + +A parser is a method on a subclass of L that +takes two parameters: the L that is +being specified and the value string provided by the user. The method +is responsible for dealing with any default value and for saving the +parsed value for later use by the C method. + +An example parser (without enough error handling) for the above +example declaration: + + use File::Slurp qw< slurp >; + + use Perl::Critic::Exception::Configuration::Option::Policy::ParameterValue + qw{ throw_policy_value }; + + sub _parse_file_name { + my ($self, $parameter, $config_string) = @_; + + my @thingies; + + if ($config_string) { + if (not -r $config_string) { + throw_policy_value + policy => $self->get_short_name(), + option_name => $parameter->get_name(), + option_value => $config_string, + message_suffix => 'is not readable.'; + } + + @thingies = slurp $config_string; + } + + $self->{_thingies} = \@thingies; + + return; + } + +Note that, if the value for the parameter is not valid, an instance of +L +is thrown. This allows C to include that problem along +with any other problems found with the user's configuration in a +single error message. + + +=head2 Using Both C and C + +There are cases where a Policy needs additional initialization beyond +configuration or where the way it acts depends upon the combination of +multiple parameters. In such situations, you will need to create an +implementation of C. If you want to take +advantage of the supplied parameter handling from within +implementation of C, note that the +information from C will already have been +used, with user-supplied parameter values validated and placed into +the Policy by the time C has been called. It +is likely that you will not need to refer the contents of the +C<$config> parameter; just pull the information you need out of +C<$self>. In fact, any value for the parameter values will be gone. + + + +=head2 Summary of permitted hash keys in C. + + +=head3 All types + + +=over + +=item - "name" (mandatory) + +=item - "description" (optional) + +=item - "behavior" (optional) + +Currently, one of: + +=over + +=item "boolean" + +=item "enumeration" + +=item "integer" + +=item "string" + +=item "string list" + +=back + +=item - "default_string" (optional) + +A string representation of the default value of the parameter. + +=item - "parser" (optional) + +A code ref to a custom parser for the parameter. + +=back + +=head3 Enumerations + +=over + +=item - "enumeration_values" (mandatory) + +A mandatory reference to an array of strings. + +=item - "enumeration_allow_multiple_values" (optional) + +Boolean indicating whether or not the user is restricted to a single +value. + +=back + +=head3 Integers + +=over + +=item - "integer_minimum" (optional) + +Minimum allowed value, inclusive. + +=item - "integer_maximum" (optional) + +Maximum allowed value, inclusive. + +=back + +=head3 String lists + +=over + +=item - "list_always_present_values" (optional) + +A reference to an array of values that should always be included in +the value of the parameter. + +=back + + +=head1 ADDITIONAL FEATURES + +=head2 C + +Certain problems that a Policy detects can be endemic to a particular +file; if there's one violation, there's likely to be many. A good +example of this is +L; if +there's one line before L, there's a good chance that the +entire file is missing L. In such cases, it's not much +help to the user to report every single violation. If you've got such +a policy, you should override +L +method to provide a limit. The user can override this value with a +value for "maximum_violations_per_document" in their F<.perlcriticrc>. + +See the source code for +L +and L +for examples. + + +=head1 DISTRIBUTING YOUR POLICIES + +=head2 Create a Distribution + +You need to come up with a name for your set of policies. Sets of +add-on policies are generally named C>, +e.g. L. + +The module representing the distribution will not actually have any +functionality; it's just documentation and a name for users to use +when installing via L/L. The important part is that +this will include a list of the included policies, with descriptions +of each. + +A typical implementation will look like: + + package Perl::Critic::Example; + + use strict; + use warnings; + + our $VERSION = '1.000000'; + + 1; # Magic true value required at end of module + + __END__ + + =head1 NAME + + Perl::Critic::Example - Policies for Perl::Critic that act as an example. + + =head1 AFFILIATION + + This module has no functionality, but instead contains documentation + for this distribution and acts as a means of pulling other modules + into a bundle. All of the Policy modules contained herein will have + an "AFFILIATION" section announcing their participation in this + grouping. + + + =head1 SYNOPSIS + + Some L policies that will help you keep your code + nice and compliant. + + + =head1 DESCRIPTION + + The included policies are: + + =over + + =item L + + Complains about some example documentation issues. [Severity: 3] + + + =item L + + All modules must have at least one variable. [Severity: 3] + + + =back + + + =head1 CONFIGURATION AND ENVIRONMENT + + All policies included are in the "example" theme. See the + L documentation for how to make use of this. + + +=head2 Themes + +Users can choose which policies to enable using themes. You should +implement C so that users can take advantage of +this. In particular, you should use a theme named after your +distribution in all your policies; this should match the value listed +in the C POD section as shown above. + + default_themes { return qw< example math > } + +If you're looking for ideas of what themes to do, have a look at the +output of C. + + +=head2 Documentation + +=head3 AFFILIATION + +Since all policies have to go somewhere under the +C namespace, it isn't always clear what +distribution a policy came from when browsing through their +documentation. For this reason, you should include an C +section in the POD for all of your policies that state where the +policy comes from. For example: + + =head1 AFFILIATION + + This policy is part of L. + + +=head3 CONFIGURATION + +In order to make it clear what can be done with a policy, you should +always include a C section in your POD, even if it's +only to say: + + =head1 CONFIGURATION + + This Policy is not configurable except for the standard options. + + +=head1 HINT + +When you're trying to figure out what L is going to hand you for +a chunk of code, there is a F program in the +L distribution that will help you. For example, when +developing the above RequireBlockGrep example, you might want to try + + tools/ppidump '@matches = grep /pattern/, @list;' + +and + + tools/ppidump '@matches = grep { /pattern/ } @list;' + +to see the differences between the two cases. + + +=head1 VERSION + +This is part of L version 1.088. + + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +############################################################################## +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=70 ft=pod expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Document.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Document.pm new file mode 100644 index 0000000..796f043 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Document.pm @@ -0,0 +1,326 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Document.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Document; + +use 5.006001; +use strict; +use warnings; + +use List::Util qw< max >; +use PPI::Document; +use Scalar::Util qw< weaken >; +use version; + +#----------------------------------------------------------------------------- + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +our $AUTOLOAD; +sub AUTOLOAD { ## no critic(ProhibitAutoloading,ArgUnpacking) + my ( $function_name ) = $AUTOLOAD =~ m/ ([^:\']+) \z /xms; + return if $function_name eq 'DESTROY'; + my $self = shift; + return $self->{_doc}->$function_name(@_); +} + +#----------------------------------------------------------------------------- + +sub new { + my ($class, $doc) = @_; + return bless { _doc => $doc }, $class; +} + +#----------------------------------------------------------------------------- + +sub ppi_document { + my ($self) = @_; + return $self->{_doc}; +} + +#----------------------------------------------------------------------------- + +sub isa { + my ($self, @args) = @_; + return $self->SUPER::isa(@args) + || ( (ref $self) && $self->{_doc} && $self->{_doc}->isa(@args) ); +} + +#----------------------------------------------------------------------------- + +sub find { + my ($self, $wanted, @more_args) = @_; + + # This method can only find elements by their class names. For + # other types of searches, delegate to the PPI::Document + if ( ( ref $wanted ) || !$wanted || $wanted !~ m/ \A PPI:: /xms ) { + return $self->{_doc}->find($wanted, @more_args); + } + + # Build the class cache if it doesn't exist. This happens at most + # once per Perl::Critic::Document instance. %elements of will be + # populated as a side-effect of calling the $finder_sub coderef + # that is produced by the caching_finder() closure. + if ( !$self->{_elements_of} ) { + + my %cache = ( 'PPI::Document' => [ $self ] ); + + # The cache refers to $self, and $self refers to the cache. This + # creates a circular reference that leaks memory (i.e. $self is not + # destroyed until execution is complete). By weakening the reference, + # we allow perl to collect the garbage properly. + weaken( $cache{'PPI::Document'}->[0] ); + + my $finder_coderef = _caching_finder( \%cache ); + $self->{_doc}->find( $finder_coderef ); + $self->{_elements_of} = \%cache; + } + + # find() must return false-but-defined on fail + return $self->{_elements_of}->{$wanted} || q{}; +} + +#----------------------------------------------------------------------------- + +sub find_first { + my ($self, $wanted, @more_args) = @_; + + # This method can only find elements by their class names. For + # other types of searches, delegate to the PPI::Document + if ( ( ref $wanted ) || !$wanted || $wanted !~ m/ \A PPI:: /xms ) { + return $self->{_doc}->find_first($wanted, @more_args); + } + + my $result = $self->find($wanted); + return $result ? $result->[0] : $result; +} + +#----------------------------------------------------------------------------- + +sub find_any { + my ($self, $wanted, @more_args) = @_; + + # This method can only find elements by their class names. For + # other types of searches, delegate to the PPI::Document + if ( ( ref $wanted ) || !$wanted || $wanted !~ m/ \A PPI:: /xms ) { + return $self->{_doc}->find_any($wanted, @more_args); + } + + my $result = $self->find($wanted); + return $result ? 1 : $result; +} + +#----------------------------------------------------------------------------- + +sub filename { + my ($self) = @_; + return $self->{_doc}->can('filename') ? $self->{_doc}->filename : undef; +} + +#----------------------------------------------------------------------------- + +sub highest_explicit_perl_version { + my ($self) = @_; + + my $highest_explicit_perl_version = + $self->{_highest_explicit_perl_version}; + + if ( not exists $self->{_highest_explicit_perl_version} ) { + my $includes = $self->find( \&_is_a_version_statement ); + + if ($includes) { + $highest_explicit_perl_version = + max map { version->new( $_->version() ) } @{$includes}; + } + else { + $highest_explicit_perl_version = undef; + } + + $self->{_highest_explicit_perl_version} = + $highest_explicit_perl_version; + } + + return $highest_explicit_perl_version if $highest_explicit_perl_version; + return; +} + +sub _is_a_version_statement { + my (undef, $element) = @_; + + return 0 if not $element->isa('PPI::Statement::Include'); + return 1 if $element->version(); + return 0; +} + +#----------------------------------------------------------------------------- + +sub _caching_finder { + + my $cache_ref = shift; # These vars will persist for the life + my %isa_cache = (); # of the code ref that this sub returns + + + # Gather up all the PPI elements and sort by @ISA. Note: if any + # instances used multiple inheritance, this implementation would + # lead to multiple copies of $element in the $elements_of lists. + # However, PPI::* doesn't do multiple inheritance, so we are safe + + return sub { + my (undef, $element) = @_; + my $classes = $isa_cache{ref $element}; + if ( !$classes ) { + $classes = [ ref $element ]; + # Use a C-style loop because we append to the classes array inside + for ( my $i = 0; $i < @{$classes}; $i++ ) { ## no critic(ProhibitCStyleForLoops) + no strict 'refs'; ## no critic(ProhibitNoStrict) + push @{$classes}, @{"$classes->[$i]::ISA"}; + $cache_ref->{$classes->[$i]} ||= []; + } + $isa_cache{$classes->[0]} = $classes; + } + + for my $class ( @{$classes} ) { + push @{$cache_ref->{$class}}, $element; + } + + return 0; # 0 tells find() to keep traversing, but not to store this $element + }; +} + +#----------------------------------------------------------------------------- + +1; + +__END__ + +=pod + +=for stopwords pre-caches + +=head1 NAME + +Perl::Critic::Document - Caching wrapper around a PPI::Document. + + +=head1 SYNOPSIS + + use PPI::Document; + use Perl::Critic::Document; + my $doc = PPI::Document->new('Foo.pm'); + $doc = Perl::Critic::Document->new($doc); + ## Then use the instance just like a PPI::Document + + +=head1 DESCRIPTION + +Perl::Critic does a lot of iterations over the PPI document tree via +the C method. To save some time, this class +pre-caches a lot of the common C calls in a single traversal. +Then, on subsequent requests we return the cached data. + +This is implemented as a facade, where method calls are handed to the +stored C instance. + + +=head1 CAVEATS + +This facade does not implement the overloaded operators from +L (that is, the C work). Therefore, +users of this facade must not rely on that syntactic sugar. So, for +example, instead of C you should write Ccontent();> + +Perhaps there is a CPAN module out there which implements a facade +better than we do here? + + +=head1 CONSTRUCTOR + +=over + +=item C<< new($doc) >> + +Create a new instance referencing a PPI::Document instance. + + +=back + + +=head1 METHODS + +=over + +=item C<< new($doc) >> + +Create a new instance referencing a PPI::Document instance. + + +=item C<< ppi_document() >> + +Accessor for the wrapped PPI::Document instance. Note that altering this +instance in any way can cause unpredictable failures in Perl::Critic's +subsequent analysis because some caches may fall out of date. + + +=item C<< find($wanted) >> + +=item C<< find_first($wanted) >> + +=item C<< find_any($wanted) >> + +If C<$wanted> is a simple PPI class name, then the cache is employed. +Otherwise we forward the call to the corresponding method of the +C instance. + + +=item C<< filename() >> + +Returns the filename for the source code if applicable +(PPI::Document::File) or C otherwise (PPI::Document). + + +=item C<< isa( $classname ) >> + +To be compatible with other modules that expect to get a PPI::Document, the +Perl::Critic::Document class masquerades as the PPI::Document class. + + +=item C<< highest_explicit_perl_version() >> + +Returns a L object for the highest Perl version requirement declared +in the document via a C or C statement. Returns nothing if +there is no version statement. + + +=back + + +=head1 AUTHOR + +Chris Dolan + + +=head1 COPYRIGHT + +Copyright (c) 2006-2008 Chris Dolan. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception.pm new file mode 100644 index 0000000..4a928d3 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception.pm @@ -0,0 +1,95 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Exception.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Exception; + +use 5.006001; +use strict; +use warnings; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +use Exception::Class ( + 'Perl::Critic::Exception' => { + isa => 'Exception::Class::Base', + description => 'A problem discovered by Perl::Critic.', + }, +); + +use base 'Exporter'; + +#----------------------------------------------------------------------------- + +sub short_class_name { + my ( $self ) = @_; + + return substr ref $self, (length 'Perl::Critic') + 2; +} + +#----------------------------------------------------------------------------- + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords + +=head1 NAME + +Perl::Critic::Exception - A problem identified by L. + +=head1 DESCRIPTION + +A base class for all problems discovered by L. This +exists to enable differentiating exceptions from L code +from those originating in other modules. + +This is an abstract class. It should never be instantiated. + + +=head1 METHODS + +=over + +=item C + +Retrieve the name of the class of this object with C<'Perl::Critic::'> +stripped off. + + +=back + + +=head1 AUTHOR + +Elliot Shank + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Elliot Shank. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/AggregateConfiguration.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/AggregateConfiguration.pm new file mode 100644 index 0000000..6d3775b --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/AggregateConfiguration.pm @@ -0,0 +1,202 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Exception/AggregateConfiguration.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Exception::AggregateConfiguration; + +use 5.006001; +use strict; +use warnings; + +use Carp qw{ confess }; +use English qw(-no_match_vars); +use Readonly; + +use Perl::Critic::Utils qw{ :characters }; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +use Exception::Class ( + 'Perl::Critic::Exception::AggregateConfiguration' => { + isa => 'Perl::Critic::Exception', + description => 'A collected set of configuration exceptions.', + fields => [ qw{ exceptions } ], + alias => 'throw_aggregate', + }, +); + +#----------------------------------------------------------------------------- + +Readonly::Array our @EXPORT_OK => qw< throw_aggregate >; + +#----------------------------------------------------------------------------- + +sub new { + my ($class, %options) = @_; + + my $exceptions = $options{exceptions}; + if (not $exceptions) { + $options{exceptions} = []; + } + + return $class->SUPER::new(%options); +} + +#----------------------------------------------------------------------------- + +sub add_exception { + my ( $self, $exception ) = @_; + + push @{ $self->exceptions() }, $exception; + + return; +} + +#----------------------------------------------------------------------------- + +sub add_exceptions_from { + my ( $self, $aggregate ) = @_; + + push @{ $self->exceptions() }, @{ $aggregate->exceptions() }; + + return; +} + +#----------------------------------------------------------------------------- + +sub add_exception_or_rethrow { + my ( $self, $eval_error ) = @_; + + return if not $eval_error; + confess $eval_error if not ref $eval_error; ## no critic (RequireUseOfExceptions) + + if ( $eval_error->isa('Perl::Critic::Exception::Configuration') ) { + $self->add_exception($eval_error); + } + elsif ( + $eval_error->isa('Perl::Critic::Exception::AggregateConfiguration') + ) { + $self->add_exceptions_from($eval_error); + } + else { + die $eval_error; ## no critic (RequireUseOfExceptions, RequireCarping) + } + + return; +} + +#----------------------------------------------------------------------------- + +sub has_exceptions { + my ( $self ) = @_; + + return @{ $self->exceptions() } ? 1 : 0; +} + +#----------------------------------------------------------------------------- + +my $MESSAGE_PREFIX = $EMPTY; +my $MESSAGE_SUFFIX = "\n"; +my $MESSAGE_SEPARATOR = $MESSAGE_SUFFIX . $MESSAGE_PREFIX; + +sub full_message { + my ( $self ) = @_; + + my $message = $MESSAGE_PREFIX; + $message .= join $MESSAGE_SEPARATOR, @{ $self->exceptions() }; + $message .= $MESSAGE_SUFFIX; + + return $message; +} + +1; + +#----------------------------------------------------------------------------- + +__END__ + +=pod + +=for stopwords + +=head1 NAME + +Perl::Critic::Exception::AggregateConfiguration - A collection of a set of problems found in the configuration and/or command-line options. + +=head1 DESCRIPTION + +A set of configuration settings can have multiple problems. This is +an object for collecting all the problems found so that the user can +see them in one run. + + +=head1 METHODS + +=over + +=item C + +Accumulate the parameter with rest of the exceptions. + + +=item C + +Accumulate the exceptions from another instance of this class. + + +=item C + +Returns a reference to an array of the collected exceptions. + + +=item C + +If the parameter is an instance of +L or +L, add it. +Otherwise, C with the parameter, if it is a reference, or +C with it. If the parameter is false, simply returns. + + +=item C + +Answer whether any configuration problems have been found. + + +=item C + +Concatenate the exception messages. See +L. + + +=back + + +=head1 AUTHOR + +Elliot Shank + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Elliot Shank. 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. + +=cut + +############################################################################## +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration.pm new file mode 100644 index 0000000..ebe4e04 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration.pm @@ -0,0 +1,90 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Exception/Configuration.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Exception::Configuration; + +use 5.006001; +use strict; +use warnings; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +use Exception::Class ( + 'Perl::Critic::Exception::Configuration' => { + isa => 'Perl::Critic::Exception', + description => 'A problem with Perl::Critic configuration, whether from a file or a command line or some other source.', + fields => [ qw{ source } ], + }, +); + +#----------------------------------------------------------------------------- + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords + +=head1 NAME + +Perl::Critic::Exception::Configuration - A problem with L configuration. + +=head1 DESCRIPTION + +A representation of a problem found with the configuration of +L, whether from a F<.perlcriticrc>, another profile +file, or command line. + +This is an abstract class. It should never be instantiated. + + +=head1 METHODS + +=over + +=item C + +Where the configuration information came from, if it could be determined. + + +=back + + +=head1 SEE ALSO + +L +L + + +=head1 AUTHOR + +Elliot Shank + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Elliot Shank. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Generic.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Generic.pm new file mode 100644 index 0000000..f3b0428 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Generic.pm @@ -0,0 +1,95 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Exception/Configuration/Generic.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Exception::Configuration::Generic; + +use 5.006001; +use strict; +use warnings; + +use Readonly; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +use Exception::Class ( + 'Perl::Critic::Exception::Configuration::Generic' => { + isa => 'Perl::Critic::Exception::Configuration', + description => + q{A problem with Perl::Critic configuration that isn't related to an option.}, + alias => 'throw_generic', + }, +); + +#----------------------------------------------------------------------------- + +Readonly::Array our @EXPORT_OK => qw< throw_generic >; + +#----------------------------------------------------------------------------- + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords + +=head1 NAME + +Perl::Critic::Exception::Configuration::Generic - A problem with L configuration that doesn't involve an option. + +=head1 DESCRIPTION + +A representation of a problem found with the configuration of L, +whether from a F<.perlcriticrc>, another profile file, or command line. + +This covers things like file reading and parsing errors. + + +=head1 CLASS METHODS + +=over + +=item C<< throw( message => $message, source => $source ) >> + +See L. + + +=item C<< new( message => $message, source => $source ) >> + +See L. + + +=back + + +=head1 AUTHOR + +Elliot Shank + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Elliot Shank. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option.pm new file mode 100644 index 0000000..a996200 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option.pm @@ -0,0 +1,142 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Exception/Configuration/Option.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Exception::Configuration::Option; + +use 5.006001; +use strict; +use warnings; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +use Perl::Critic::Exception::Fatal::Internal; + +use Exception::Class ( # this must come after "use P::C::Exception::*" + 'Perl::Critic::Exception::Configuration::Option' => { + isa => 'Perl::Critic::Exception::Configuration', + description => 'A problem with an option in the Perl::Critic configuration, whether from a file or a command line or some other source.', + fields => [ qw{ option_name option_value message_suffix } ], + }, +); + +#----------------------------------------------------------------------------- + +sub message { + my $self = shift; + + return $self->full_message(); +} + +#----------------------------------------------------------------------------- + +sub error { + my $self = shift; + + return $self->full_message(); +} + +#----------------------------------------------------------------------------- + +## no critic (Subroutines::RequireFinalReturn) +sub full_message { + Perl::Critic::Exception::Fatal::Internal->throw( + 'Subclass failed to override abstract method.' + ); +} +## use critic + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords + +=head1 NAME + +Perl::Critic::Exception::Configuration::Option - A problem with an option in the L configuration. + +=head1 DESCRIPTION + +A representation of a problem found with an option in the +configuration of L, whether from a F<.perlcriticrc>, +another profile file, or command line. + +This is an abstract class. It should never be instantiated. + + +=head1 METHODS + +=over + +=item C + +The name of the option that was found to be in error. + + +=item C + +The value of the option that was found to be in error. + + +=item C + +Any text that should be applied to end of the standard message for +this kind of exception. + + +=item C + +=item C + +Overridden to call C. I.e. any message string in the +superclass is ignored. + + +=item C + +Overridden to turn it into an abstract method to force subclasses to +implement it. + + +=back + + +=head1 SEE ALSO + +L +L + + +=head1 AUTHOR + +Elliot Shank + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Elliot Shank. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Global.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Global.pm new file mode 100644 index 0000000..1489987 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Global.pm @@ -0,0 +1,71 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Exception/Configuration/Option/Global.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Exception::Configuration::Option::Global; + +use 5.006001; +use strict; +use warnings; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +use Exception::Class ( + 'Perl::Critic::Exception::Configuration::Option::Global' => { + isa => 'Perl::Critic::Exception::Configuration::Option', + description => 'A problem with global Perl::Critic configuration.', + }, +); + +#----------------------------------------------------------------------------- + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords + +=head1 NAME + +Perl::Critic::Exception::Configuration::Option::Global - A problem with L global configuration. + +=head1 DESCRIPTION + +A representation of a problem found with the global configuration of +L, whether from a F<.perlcriticrc>, another profile +file, or command line. + +This is an abstract class. It should never be instantiated. + + +=head1 AUTHOR + +Elliot Shank + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Elliot Shank. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Global/ExtraParameter.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Global/ExtraParameter.pm new file mode 100644 index 0000000..00141f3 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Global/ExtraParameter.pm @@ -0,0 +1,123 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Exception/Configuration/Option/Global/ExtraParameter.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Exception::Configuration::Option::Global::ExtraParameter; + +use 5.006001; +use strict; +use warnings; + +use Readonly; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +use Exception::Class ( + 'Perl::Critic::Exception::Configuration::Option::Global::ExtraParameter' => { + isa => 'Perl::Critic::Exception::Configuration::Option::Global', + description => 'The configuration referred to a non-existant global option.', + alias => 'throw_extra_global', + }, +); + +#----------------------------------------------------------------------------- + +Readonly::Array our @EXPORT_OK => qw< throw_extra_global >; + +#----------------------------------------------------------------------------- + +sub full_message { + my ( $self ) = @_; + + my $source = $self->source(); + if ($source) { + $source = qq{ (found in "$source")}; + } + else { + $source = q{}; + } + + my $option_name = $self->option_name(); + + return qq{"$option_name" is not a supported option$source.}; +} + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords + +=head1 NAME + +Perl::Critic::Exception::Configuration::Option::Global::ExtraParameter - The configuration referred to a non-existent global option. + +=head1 DESCRIPTION + +A representation of the configuration attempting to specify a value +for an option that L doesn't have, whether from a +F<.perlcriticrc>, another profile file, or command line. + + +=head1 CLASS METHODS + +=over + +=item C<< throw( option_name => $option_name, source => $source ) >> + +See L. + + +=item C<< new( option_name => $option_name, source => $source ) >> + +See L. + + +=back + + +=head1 METHODS + +=over + +=item C + +Provide a standard message for values for non-existent parameters for +policies. See L. + + +=back + + +=head1 AUTHOR + +Elliot Shank + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Elliot Shank. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Global/ParameterValue.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Global/ParameterValue.pm new file mode 100644 index 0000000..23280ef --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Global/ParameterValue.pm @@ -0,0 +1,132 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Exception/Configuration/Option/Global/ParameterValue.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Exception::Configuration::Option::Global::ParameterValue; + +use 5.006001; +use strict; +use warnings; + +use Readonly; + +use Perl::Critic::Utils qw{ :characters }; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +use Exception::Class ( + 'Perl::Critic::Exception::Configuration::Option::Global::ParameterValue' => { + isa => 'Perl::Critic::Exception::Configuration::Option::Global', + description => 'A problem with the value of a global parameter.', + alias => 'throw_global_value', + }, +); + +#----------------------------------------------------------------------------- + +Readonly::Array our @EXPORT_OK => qw< throw_global_value >; + +#----------------------------------------------------------------------------- + +sub full_message { + my ( $self ) = @_; + + my $source = $self->source(); + if ($source) { + $source = qq{ found in "$source"}; + } + else { + $source = $EMPTY; + } + + my $option_name = $self->option_name(); + my $option_value = + defined $self->option_value() + ? $DQUOTE . $self->option_value() . $DQUOTE + : ''; + my $message_suffix = $self->message_suffix() || $EMPTY; + + return + qq{The value for the global "$option_name" option } + . qq{($option_value)$source $message_suffix}; +} + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords + +=head1 NAME + +Perl::Critic::Exception::Configuration::Option::Global::ParameterValue - A problem with the value of a global parameter. + +=head1 DESCRIPTION + +A representation of a problem found with the value of a global +parameter, whether from a F<.perlcriticrc>, another profile file, or +command line. + + +=head1 CLASS METHODS + +=over + +=item C<< throw( option_name => $option_name, option_value => $option_value, source => $source, message_suffix => $message_suffix ) >> + +See L. + + +=item C<< new( option_name => $option_name, option_value => $option_value, source => $source, message_suffix => $message_suffix ) >> + +See L. + + +=back + + +=head1 METHODS + +=over + +=item C + +Provide a standard message for global configuration problems. See +L. + + +=back + + +=head1 AUTHOR + +Elliot Shank + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Elliot Shank. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Policy.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Policy.pm new file mode 100644 index 0000000..4d9f11c --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Policy.pm @@ -0,0 +1,98 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Exception/Configuration/Option/Policy.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Exception::Configuration::Option::Policy; + +use 5.006001; +use strict; +use warnings; + +use Perl::Critic::Utils qw{ &policy_short_name }; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +use Exception::Class ( + 'Perl::Critic::Exception::Configuration::Option::Policy' => { + isa => 'Perl::Critic::Exception::Configuration::Option', + description => 'A problem with the configuration of a policy.', + fields => [ qw{ policy } ], + }, +); + +#----------------------------------------------------------------------------- + +sub new { + my ($class, %options) = @_; + + my $policy = $options{policy}; + if ($policy) { + $options{policy} = policy_short_name($policy); + } + + return $class->SUPER::new(%options); +} + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords + +=head1 NAME + +Perl::Critic::Exception::Configuration::Option::Policy - A problem with configuration of a policy. + +=head1 DESCRIPTION + +A representation of a problem found with the configuration of a +L, whether from a F<.perlcriticrc>, another +profile file, or command line. + +This is an abstract class. It should never be instantiated. + + +=head1 METHODS + +=over + +=item C + +The short name of the policy that had configuration problems. + + +=back + + +=head1 AUTHOR + +Elliot Shank + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Elliot Shank. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Policy/ExtraParameter.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Policy/ExtraParameter.pm new file mode 100644 index 0000000..e8920db --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Policy/ExtraParameter.pm @@ -0,0 +1,125 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Exception/Configuration/Option/Policy/ExtraParameter.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Exception::Configuration::Option::Policy::ExtraParameter; + +use 5.006001; +use strict; +use warnings; + +use Readonly; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +use Exception::Class ( + 'Perl::Critic::Exception::Configuration::Option::Policy::ExtraParameter' => { + isa => 'Perl::Critic::Exception::Configuration::Option::Policy', + description => 'The configuration of a policy referred to a non-existant parameter.', + alias => 'throw_extra_parameter', + }, +); + +#----------------------------------------------------------------------------- + +Readonly::Array our @EXPORT_OK => qw< throw_extra_parameter >; + +#----------------------------------------------------------------------------- + +sub full_message { + my ( $self ) = @_; + + my $source = $self->source(); + if ($source) { + $source = qq{ (found in "$source")}; + } + else { + $source = q{}; + } + + my $policy = $self->policy(); + my $option_name = $self->option_name(); + + return + qq{The $policy policy doesn't take a "$option_name" option$source.}; +} + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords + +=head1 NAME + +Perl::Critic::Exception::Configuration::Option::Policy::ExtraParameter - The configuration referred to a non-existent parameter for a policy. + +=head1 DESCRIPTION + +A representation of the configuration attempting to specify a value +for a parameter that a L doesn't have, whether +from a F<.perlcriticrc>, another profile file, or command line. + + +=head1 CLASS METHODS + +=over + +=item C<< throw( policy => $policy, option_name => $option_name, source => $source ) >> + +See L. + + +=item C<< new( policy => $policy, option_name => $option_name, source => $source ) >> + +See L. + + +=back + + +=head1 METHODS + +=over + +=item C + +Provide a standard message for values for non-existent parameters for +policies. See L. + + +=back + + +=head1 AUTHOR + +Elliot Shank + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Elliot Shank. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Policy/ParameterValue.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Policy/ParameterValue.pm new file mode 100644 index 0000000..ca7b129 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Configuration/Option/Policy/ParameterValue.pm @@ -0,0 +1,133 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Exception/Configuration/Option/Policy/ParameterValue.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Exception::Configuration::Option::Policy::ParameterValue; + +use 5.006001; +use strict; +use warnings; + +use Readonly; + +use Perl::Critic::Utils qw{ :characters }; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +use Exception::Class ( + 'Perl::Critic::Exception::Configuration::Option::Policy::ParameterValue' => { + isa => 'Perl::Critic::Exception::Configuration::Option::Policy', + description => 'A problem with the value of a parameter for a policy.', + alias => 'throw_policy_value', + }, +); + +#----------------------------------------------------------------------------- + +Readonly::Array our @EXPORT_OK => qw< throw_policy_value >; + +#----------------------------------------------------------------------------- + +sub full_message { + my ( $self ) = @_; + + my $source = $self->source(); + if ($source) { + $source = qq{ found in "$source"}; + } + else { + $source = $EMPTY; + } + + my $policy = $self->policy(); + my $option_name = $self->option_name(); + my $option_value = + defined $self->option_value() + ? $DQUOTE . $self->option_value() . $DQUOTE + : ''; + my $message_suffix = $self->message_suffix() || $EMPTY; + + return + qq{The value for the $policy "$option_name" option } + . qq{($option_value)$source $message_suffix}; +} + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords + +=head1 NAME + +Perl::Critic::Exception::Configuration::Option::Policy::ParameterValue - A problem with the value of a parameter for a policy. + +=head1 DESCRIPTION + +A representation of a problem found with the value of a parameter for a +L, whether from a F<.perlcriticrc>, another +profile file, or command line. + + +=head1 CLASS METHODS + +=over + +=item C<< throw( policy => $policy, option_name => $option_name, option_value => $option_value, source => $source, message_suffix => $message_suffix ) >> + +See L. + + +=item C<< new( policy => $policy, option_name => $option_name, option_value => $option_value, source => $source, message_suffix => $message_suffix ) >> + +See L. + + +=back + + +=head1 METHODS + +=over + +=item C + +Provide a standard message for policy parameter value problems. See +L. + + +=back + + +=head1 AUTHOR + +Elliot Shank + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Elliot Shank. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Fatal.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Fatal.pm new file mode 100644 index 0000000..b89b77b --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Fatal.pm @@ -0,0 +1,112 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Exception/Fatal.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Exception::Fatal; + +use 5.006001; +use strict; +use warnings; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +use Exception::Class ( + 'Perl::Critic::Exception::Fatal' => { + isa => 'Perl::Critic::Exception', + description => + 'A problem that should cause Perl::Critic to stop running.', + }, +); + +#----------------------------------------------------------------------------- + +sub new { + my ($class, @args) = @_; + my $self = $class->SUPER::new(@args); + + $self->show_trace(1); + + return $self; +} + +#----------------------------------------------------------------------------- + +sub full_message { + my ( $self ) = @_; + + return + $self->short_class_name() + . q{: } + . $self->description() + . "\n\n" + . $self->message() + . "\n\n" + . gmtime $self->time() + . "\n\n"; +} + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords + +=head1 NAME + +Perl::Critic::Exception::Fatal - A problem that should cause L to stop running. + +=head1 DESCRIPTION + +Something went wrong and processing should not continue. You should +never specifically look for this exception or one of its subclasses. + +Note: the constructor invokes L to +force stack-traces to be included in the standard stringification. + +This is an abstract class. It should never be instantiated. + + +=head1 METHODS + +=over + +=item C + +Overrides L to include extra information. + + +=back + + +=head1 AUTHOR + +Elliot Shank + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Elliot Shank. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Fatal/Generic.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Fatal/Generic.pm new file mode 100644 index 0000000..b7c7958 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Fatal/Generic.pm @@ -0,0 +1,80 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Exception/Fatal/Generic.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Exception::Fatal::Generic; + +use 5.006001; +use strict; +use warnings; + +use Readonly; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +use Exception::Class ( + 'Perl::Critic::Exception::Fatal::Generic' => { + isa => 'Perl::Critic::Exception::Fatal', + description => 'A general problem was found.', + alias => 'throw_generic', + }, +); + +#----------------------------------------------------------------------------- + +Readonly::Array our @EXPORT_OK => qw< throw_generic >; + +#----------------------------------------------------------------------------- + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords + +=head1 NAME + +Perl::Critic::Exception::Fatal::Generic - A problem for which there is no specialized information. + +=head1 DESCRIPTION + +A general problem, e.g. I/O errors and problems that may or not be bugs. + + +=head1 METHODS + +Only inherited ones. + + +=head1 AUTHOR + +Elliot Shank + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Elliot Shank. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Fatal/Internal.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Fatal/Internal.pm new file mode 100644 index 0000000..0709955 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Fatal/Internal.pm @@ -0,0 +1,80 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Exception/Fatal/Internal.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Exception::Fatal::Internal; + +use 5.006001; +use strict; +use warnings; + +use Readonly; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +use Exception::Class ( + 'Perl::Critic::Exception::Fatal::Internal' => { + isa => 'Perl::Critic::Exception::Fatal', + description => 'A problem with the Perl::Critic code was found, a.k.a. a bug.', + alias => 'throw_internal', + }, +); + +#----------------------------------------------------------------------------- + +Readonly::Array our @EXPORT_OK => qw< throw_internal >; + +#----------------------------------------------------------------------------- + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords + +=head1 NAME + +Perl::Critic::Exception::Fatal::Internal - A problem with the L implementation, i.e. a bug. + +=head1 DESCRIPTION + +A representation of a bug found in the code of L. + + +=head1 METHODS + +Only inherited ones. + + +=head1 AUTHOR + +Elliot Shank + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Elliot Shank. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Fatal/PolicyDefinition.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Fatal/PolicyDefinition.pm new file mode 100644 index 0000000..b0b0d63 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Fatal/PolicyDefinition.pm @@ -0,0 +1,81 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Exception/Fatal/PolicyDefinition.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Exception::Fatal::PolicyDefinition; + +use 5.006001; +use strict; +use warnings; + +use Readonly; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +use Exception::Class ( + 'Perl::Critic::Exception::Fatal::PolicyDefinition' => { + isa => 'Perl::Critic::Exception::Fatal', + description => 'A bug in a policy was found.', + alias => 'throw_policy_definition', + }, +); + +#----------------------------------------------------------------------------- + +Readonly::Array our @EXPORT_OK => qw< throw_policy_definition >; + +#----------------------------------------------------------------------------- + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords + +=head1 NAME + +Perl::Critic::Exception::Fatal::PolicyDefinition - A bug in a policy. + +=head1 DESCRIPTION + +A bug in a policy was found, e.g. it didn't implement a method that it should +have. + + +=head1 METHODS + +Only inherited ones. + + +=head1 AUTHOR + +Elliot Shank + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Elliot Shank. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/IO.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/IO.pm new file mode 100644 index 0000000..8923b41 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/IO.pm @@ -0,0 +1,97 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Exception/IO.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Exception::IO; + +use 5.006001; +use strict; +use warnings; + +use Carp qw{ confess }; +use English qw(-no_match_vars); +use Readonly; + +use Perl::Critic::Utils qw{ :characters }; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +use Exception::Class ( + 'Perl::Critic::Exception::IO' => { + isa => 'Perl::Critic::Exception', + description => 'An input/output problem.', + fields => [ qw< file_name errno > ], + alias => 'throw_io', + }, +); + +#----------------------------------------------------------------------------- + +Readonly::Array our @EXPORT_OK => qw< throw_io >; + +#----------------------------------------------------------------------------- + +1; + +#----------------------------------------------------------------------------- + +__END__ + +=pod + +=for stopwords + +=head1 NAME + +Perl::Critic::Exception::IO - A problem with input or output. + +=head1 DESCRIPTION + +The outside world can do nasty things to your poor, innocent code. + + +=head1 METHODS + +=over + +=item C + +Returns the name of the file that the problem was found with, if available. + + +=item C + +The value of C<$ERRNO>/C<$!> at the time the problem was found. + + +=back + + +=head1 AUTHOR + +Elliot Shank + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Elliot Shank. 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. + +=cut + +############################################################################## +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Parse.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Parse.pm new file mode 100644 index 0000000..16895ef --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Exception/Parse.pm @@ -0,0 +1,92 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Exception/Parse.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Exception::Parse; + +use 5.006001; +use strict; +use warnings; + +use English qw< -no_match_vars >; +use Carp qw< confess >; +use Readonly; + +use Perl::Critic::Utils qw< :characters >; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +use Exception::Class ( + 'Perl::Critic::Exception::Parse' => { + isa => 'Perl::Critic::Exception', + description => 'A problem parsing source code.', + fields => [ qw< file_name > ], + alias => 'throw_parse', + }, +); + +#----------------------------------------------------------------------------- + +Readonly::Array our @EXPORT_OK => qw< throw_parse >; + +#----------------------------------------------------------------------------- + +1; + +#----------------------------------------------------------------------------- + +__END__ + +=pod + +=for stopwords + +=head1 NAME + +Perl::Critic::Exception::Parse - The code doesn't look like code. + +=head1 DESCRIPTION + +There was a problem with PPI parsing source code. + + +=head1 METHODS + +=over + +=item C + +Returns the name of the file that the problem was found with, if available. + + +=back + + +=head1 AUTHOR + +Elliot Shank + +=head1 COPYRIGHT + +Copyright (c) 2008 Elliot Shank. 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. + +=cut + +############################################################################## +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/OptionsProcessor.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/OptionsProcessor.pm new file mode 100644 index 0000000..8793309 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/OptionsProcessor.pm @@ -0,0 +1,291 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/OptionsProcessor.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::OptionsProcessor; + +use 5.006001; +use strict; +use warnings; + +use English qw(-no_match_vars); + +use Perl::Critic::Exception::AggregateConfiguration; +use Perl::Critic::Exception::Configuration::Option::Global::ExtraParameter; +use Perl::Critic::Utils qw< + :booleans :characters :severities :data_conversion $DEFAULT_VERBOSITY +>; +use Perl::Critic::Utils::Constants qw< $PROFILE_STRICTNESS_DEFAULT >; +use Perl::Critic::Utils::DataConversion qw< dor >; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +sub new { + my ($class, %args) = @_; + my $self = bless {}, $class; + $self->_init( %args ); + return $self; +} + +#----------------------------------------------------------------------------- + +sub _init { + my ( $self, %args ) = @_; + + # Multi-value defaults + my $exclude = dor(delete $args{exclude}, $EMPTY); + $self->{_exclude} = [ words_from_string( $exclude ) ]; + my $include = dor(delete $args{include}, $EMPTY); + $self->{_include} = [ words_from_string( $include ) ]; + + # Single-value defaults + $self->{_force} = dor(delete $args{force}, $FALSE); + $self->{_only} = dor(delete $args{only}, $FALSE); + $self->{_profile_strictness} = + dor(delete $args{'profile-strictness'}, $PROFILE_STRICTNESS_DEFAULT); + $self->{_single_policy} = dor(delete $args{'single-policy'}, $EMPTY); + $self->{_severity} = dor(delete $args{severity}, $SEVERITY_HIGHEST); + $self->{_theme} = dor(delete $args{theme}, $EMPTY); + $self->{_top} = dor(delete $args{top}, $FALSE); + $self->{_verbose} = dor(delete $args{verbose}, $DEFAULT_VERBOSITY); + $self->{_criticism_fatal} = dor(delete $args{'criticism-fatal'}, $FALSE); + + $self->{_color} = dor(delete $args{color}, dor(delete $args{colour}, $TRUE)); + + # If there's anything left, complain. + _check_for_extra_options(%args); + + return $self; +} + +#----------------------------------------------------------------------------- + +sub _check_for_extra_options { + my %args = @_; + + if ( my @remaining = sort keys %args ){ + my $errors = Perl::Critic::Exception::AggregateConfiguration->new(); + + foreach my $option_name (@remaining) { + $errors->add_exception( + Perl::Critic::Exception::Configuration::Option::Global::ExtraParameter->new( + option_name => $option_name, + ) + ) + } + + $errors->rethrow(); + } + + return; +} + +#----------------------------------------------------------------------------- +# Public ACCESSOR methods + +sub severity { + my ($self) = @_; + return $self->{_severity}; +} + +#----------------------------------------------------------------------------- + +sub theme { + my ($self) = @_; + return $self->{_theme}; +} + +#----------------------------------------------------------------------------- + +sub exclude { + my ($self) = @_; + return $self->{_exclude}; +} + +#----------------------------------------------------------------------------- + +sub include { + my ($self) = @_; + return $self->{_include}; +} + +#----------------------------------------------------------------------------- + +sub only { + my ($self) = @_; + return $self->{_only}; +} + +#----------------------------------------------------------------------------- + +sub profile_strictness { + my ($self) = @_; + return $self->{_profile_strictness}; +} + +#----------------------------------------------------------------------------- + +sub single_policy { + my ($self) = @_; + return $self->{_single_policy}; +} + +#----------------------------------------------------------------------------- + +sub verbose { + my ($self) = @_; + return $self->{_verbose}; +} + +#----------------------------------------------------------------------------- + +sub color { + my ($self) = @_; + return $self->{_color}; +} + +#----------------------------------------------------------------------------- + +sub criticism_fatal { + my ($self) = @_; + return $self->{_criticism_fatal}; +} + +#----------------------------------------------------------------------------- + +sub force { + my ($self) = @_; + return $self->{_force}; +} + +#----------------------------------------------------------------------------- + +sub top { + my ($self) = @_; + return $self->{_top}; +} + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::OptionsProcessor - The global configuration default values, combined with command-line values. + +=head1 DESCRIPTION + +This is a helper class that encapsulates the default parameters for +constructing a L object. There are no +user-serviceable parts here. + +=head1 CONSTRUCTOR + +=over 8 + +=item C< new( %DEFAULT_PARAMS ) > + +Returns a reference to a new C object. You +can override the coded defaults by passing in name-value pairs that +correspond to the methods listed below. + +This is usually only invoked by L, which +passes in the global values from a F<.perlcriticrc> file. This object +contains no information for individual Policies. + +=back + +=head1 METHODS + +=over 8 + +=item C< exclude() > + +Returns a reference to a list of the default exclusion patterns. If +there are no default exclusion patterns, then the list will be empty. + +=item C< force() > + +Returns the default value of the C flag (Either 1 or 0). + +=item C< include() > + +Returns a reference to a list of the default inclusion patterns. If +there are no default exclusion patterns, then the list will be empty. + +=item C< only() > + +Returns the default value of the C flag (Either 1 or 0). + +=item C< profile_strictness() > + +Returns the default value of C as an unvalidated +string. + +=item C< single_policy() > + +Returns the default C pattern. (As a string.) + +=item C< severity() > + +Returns the default C setting. (1..5). + +=item C< theme() > + +Returns the default C setting. (As a string). + +=item C< top() > + +Returns the default C setting. (Either 0 or a positive integer). + +=item C< verbose() > + +Returns the default C setting. (Either a number or format +string). + +=item C< color() > + +Returns the default C setting. (Either 1 or 0). + +=item C< criticism_fatal() > + +Returns the default C setting (Either 1 or 0). + +=back + +=head1 SEE ALSO + +L, L + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy.pm new file mode 100644 index 0000000..ef8ae9d --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy.pm @@ -0,0 +1,881 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy; + +use 5.006001; +use strict; +use warnings; + +use English qw< -no_match_vars >; +use Readonly; + +use File::Spec (); +use String::Format qw< stringf >; + +use overload ( q<""> => 'to_string', cmp => '_compare' ); + +use Perl::Critic::Utils qw< + :characters + :booleans + :severities + :data_conversion + interpolate + is_integer + policy_long_name + policy_short_name + severity_to_number +>; +use Perl::Critic::Utils::DataConversion qw< dor >; +use Perl::Critic::Utils::POD qw< + get_module_abstract_for_module + get_raw_module_abstract_for_module +>; +use Perl::Critic::Exception::AggregateConfiguration; +use Perl::Critic::Exception::Configuration; +use Perl::Critic::Exception::Configuration::Option::Policy::ExtraParameter; +use Perl::Critic::Exception::Configuration::Option::Policy::ParameterValue; +use Perl::Critic::Exception::Fatal::PolicyDefinition + qw< throw_policy_definition >; +use Perl::Critic::PolicyConfig qw<>; +use Perl::Critic::PolicyParameter qw<>; +use Perl::Critic::Violation qw<>; + +use Exception::Class; # this must come after "use P::C::Exception::*" + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $NO_LIMIT => 'no_limit'; + +#----------------------------------------------------------------------------- + +my $FORMAT = "%p\n"; #Default stringy format + +#----------------------------------------------------------------------------- + +sub new { + my ($class, %config) = @_; + + my $self = bless {}, $class; + + my $config_object; + if ($config{_config_object}) { + $config_object = $config{_config_object}; + } + else { + $config_object = + Perl::Critic::PolicyConfig->new( + $self->get_short_name(), + \%config, + ); + } + + $self->__set_config( $config_object ); + + my @parameters; + my $parameter_metadata_available = 0; + + if ( $class->can('supported_parameters') ) { + $parameter_metadata_available = 1; + @parameters = + map + { Perl::Critic::PolicyParameter->new($_) } + $class->supported_parameters(); + } + $self->{_parameter_metadata_available} = $parameter_metadata_available; + $self->{_parameters} = \@parameters; + + my $errors = Perl::Critic::Exception::AggregateConfiguration->new(); + foreach my $parameter ( @parameters ) { + eval { + $parameter->parse_and_validate_config_value( $self, $config_object ); + } + or do { + $errors->add_exception_or_rethrow($EVAL_ERROR); + }; + + $config_object->remove( $parameter->get_name() ); + } + + if ($parameter_metadata_available) { + $self->_validate_config_keys($errors, $config_object); + } + + if ( $errors->has_exceptions() ) { + $errors->rethrow(); + } + + return $self; +} + +#----------------------------------------------------------------------------- + +sub initialize_if_enabled { + return $TRUE; +} + +#----------------------------------------------------------------------------- + +sub _validate_config_keys { + my ( $self, $errors, $config ) = @_; + + for my $offered_param ( $config->get_parameter_names() ) { + $errors->add_exception( + Perl::Critic::Exception::Configuration::Option::Policy::ExtraParameter->new( + policy => $self->get_short_name(), + option_name => $offered_param, + source => undef, + ) + ); + } + + return; +} + +#----------------------------------------------------------------------------- + +sub __get_parameter_name { + my ( $self, $parameter ) = @_; + + return '_' . $parameter->get_name(); +} + +#----------------------------------------------------------------------------- + +sub __set_parameter_value { + my ( $self, $parameter, $value ) = @_; + + $self->{ $self->__get_parameter_name($parameter) } = $value; + + return; +} + +#----------------------------------------------------------------------------- + +sub __set_base_parameters { + my ($self) = @_; + + my $config = $self->__get_config(); + my $errors = Perl::Critic::Exception::AggregateConfiguration->new(); + + $self->_set_maximum_violations_per_document($errors); + + my $user_severity = $config->get_severity(); + if ( defined $user_severity ) { + my $normalized_severity = severity_to_number( $user_severity ); + $self->set_severity( $normalized_severity ); + } + + my $user_set_themes = $config->get_set_themes(); + if ( defined $user_set_themes ) { + my @set_themes = words_from_string( $user_set_themes ); + $self->set_themes( @set_themes ); + } + + my $user_add_themes = $config->get_add_themes(); + if ( defined $user_add_themes ) { + my @add_themes = words_from_string( $user_add_themes ); + $self->add_themes( @add_themes ); + } + + if ( $errors->has_exceptions() ) { + $errors->rethrow(); + } + + return; +} + +#----------------------------------------------------------------------------- + +sub _set_maximum_violations_per_document { + my ($self, $errors) = @_; + + my $config = $self->__get_config(); + + if ( $config->is_maximum_violations_per_document_unlimited() ) { + return; + } + + my $user_maximum_violations = + $config->get_maximum_violations_per_document(); + + if ( not is_integer($user_maximum_violations) ) { + $errors->add_exception( + new_parameter_value_exception( + 'maximum_violations_per_document', + $user_maximum_violations, + undef, + "does not look like an integer.\n" + ) + ); + + return; + } + elsif ( $user_maximum_violations < 0 ) { + $errors->add_exception( + new_parameter_value_exception( + 'maximum_violations_per_document', + $user_maximum_violations, + undef, + "is not greater than or equal to zero.\n" + ) + ); + + return; + } + + $self->set_maximum_violations_per_document( + $user_maximum_violations + ); + + return; +} + +#----------------------------------------------------------------------------- + +# Unparsed configuration, P::C::PolicyConfig. Compare with get_parameters(). +sub __get_config { + my ($self) = @_; + + return $self->{_config}; +} + +sub __set_config { + my ($self, $config) = @_; + + $self->{_config} = $config; + + return; +} + + #----------------------------------------------------------------------------- + +sub get_long_name { + my ($self) = @_; + + return policy_long_name(ref $self); +} + +#----------------------------------------------------------------------------- + +sub get_short_name { + my ($self) = @_; + + return policy_short_name(ref $self); +} + +#----------------------------------------------------------------------------- + +sub applies_to { + return qw(PPI::Element); +} + +#----------------------------------------------------------------------------- + +sub set_maximum_violations_per_document { + my ($self, $maximum_violations_per_document) = @_; + + $self->{_maximum_violations_per_document} = + $maximum_violations_per_document; + + return $self; +} + +#----------------------------------------------------------------------------- + +sub get_maximum_violations_per_document { + my ($self) = @_; + + return + exists $self->{_maximum_violations_per_document} + ? $self->{_maximum_violations_per_document} + : $self->default_maximum_violations_per_document(); +} + +#----------------------------------------------------------------------------- + +sub default_maximum_violations_per_document { + return; +} + +#----------------------------------------------------------------------------- + +sub set_severity { + my ($self, $severity) = @_; + $self->{_severity} = $severity; + return $self; +} + +#----------------------------------------------------------------------------- + +sub get_severity { + my ($self) = @_; + return $self->{_severity} || $self->default_severity(); +} + +#----------------------------------------------------------------------------- + +sub default_severity { + return $SEVERITY_LOWEST; +} + +#----------------------------------------------------------------------------- + +sub set_themes { + my ($self, @themes) = @_; + $self->{_themes} = [ sort @themes ]; + return $self; +} + +#----------------------------------------------------------------------------- + +sub get_themes { + my ($self) = @_; + return sort @{ $self->{_themes} } if defined $self->{_themes}; + return sort $self->default_themes(); +} + +#----------------------------------------------------------------------------- + +sub add_themes { + my ($self, @additional_themes) = @_; + #By hashifying the themes, we squish duplicates + my %merged = hashify( $self->get_themes(), @additional_themes); + $self->{_themes} = [ keys %merged]; + return $self; +} + +#----------------------------------------------------------------------------- + +sub default_themes { + return (); +} + +#----------------------------------------------------------------------------- + +sub get_abstract { + my ($self) = @_; + + return get_module_abstract_for_module( ref $self ); +} + +#----------------------------------------------------------------------------- + +sub get_raw_abstract { + my ($self) = @_; + + return get_raw_module_abstract_for_module( ref $self ); +} + +#----------------------------------------------------------------------------- + +sub parameter_metadata_available { + my ($self) = @_; + + return $self->{_parameter_metadata_available}; +} + +#----------------------------------------------------------------------------- + +sub get_parameters { + my ($self) = @_; + + return $self->{_parameters}; +} + +#----------------------------------------------------------------------------- + +sub violates { + my ($self) = @_; + + return throw_policy_definition + $self->get_short_name() . q/ does not implement violates()./; +} + +#----------------------------------------------------------------------------- + +sub violation { ##no critic(ArgUnpacking) + my ( $self, $desc, $expl, $elem ) = @_; + # HACK!! Use goto instead of an explicit call because P::C::V::new() uses caller() + my $sev = $self->get_severity(); + @_ = ('Perl::Critic::Violation', $desc, $expl, $elem, $sev ); + goto &Perl::Critic::Violation::new; +} + +#----------------------------------------------------------------------------- + +sub new_parameter_value_exception { + my ( $self, $option_name, $option_value, $source, $message_suffix ) = @_; + + return Perl::Critic::Exception::Configuration::Option::Policy::ParameterValue->new( + policy => $self->get_short_name(), + option_name => $option_name, + option_value => $option_value, + source => $source, + message_suffix => $message_suffix + ); +} + + +#----------------------------------------------------------------------------- + +## no critic (Subroutines::RequireFinalReturn) +sub throw_parameter_value_exception { + my ( $self, $option_name, $option_value, $source, $message_suffix ) = @_; + + $self->new_parameter_value_exception( + $option_name, $option_value, $source, $message_suffix + ) + ->throw(); +} +## use critic + + +#----------------------------------------------------------------------------- + +# Static methods. + +sub set_format { return $FORMAT = $_[0] } ##no critic(ArgUnpacking) +sub get_format { return $FORMAT } + +#----------------------------------------------------------------------------- + +sub to_string { + my ($self, @args) = @_; + + # Wrap the more expensive ones in sub{} to postpone evaluation + my %fspec = ( + 'P' => sub { $self->get_long_name() }, + 'p' => sub { $self->get_short_name() }, + 'a' => sub { dor($self->get_abstract(), $EMPTY) }, + 'O' => sub { $self->_format_parameters(@_) }, + 'U' => sub { $self->_format_lack_of_parameter_metadata(@_) }, + 'S' => sub { $self->default_severity() }, + 's' => sub { $self->get_severity() }, + 'T' => sub { join $SPACE, $self->default_themes() }, + 't' => sub { join $SPACE, $self->get_themes() }, + 'V' => sub { dor( $self->default_maximum_violations_per_document(), $NO_LIMIT ) }, + 'v' => sub { dor( $self->get_maximum_violations_per_document(), $NO_LIMIT ) }, + ); + return stringf($FORMAT, %fspec); +} + +sub _format_parameters { + my ($self, $format) = @_; + + return $EMPTY if not $self->parameter_metadata_available(); + + my $separator; + if ($format) { + $separator = $EMPTY; + } else { + $separator = $SPACE; + $format = '%n'; + } + + return + join + $separator, + map { $_->to_formatted_string($format) } @{ $self->get_parameters() }; +} + +sub _format_lack_of_parameter_metadata { + my ($self, $message) = @_; + + return $EMPTY if $self->parameter_metadata_available(); + return interpolate($message) if $message; + + return + 'Cannot programmatically discover what parameters this policy takes.'; +} + +sub _get_source_file { + my ($self) = @_; + + my $relative_path = + File::Spec->catfile( split m/::/xms, ref $self ) . '.pm'; + + return $INC{$relative_path}; +} + + +#----------------------------------------------------------------------------- +# Apparently, some perls do not implicitly stringify overloading +# objects before doing a comparison. This causes a couple of our +# sorting tests to fail. To work around this, we overload C to +# do it explicitly. +# +# 20060503 - More information: This problem has been traced to +# Test::Simple versions <= 0.60, not perl itself. Upgrading to +# Test::Simple v0.62 will fix the problem. But rather than forcing +# everyone to upgrade, I have decided to leave this workaround in +# place. + +sub _compare { return "$_[0]" cmp "$_[1]" } + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy - Base class for all Policy modules. + + +=head1 DESCRIPTION + +Perl::Critic::Policy is the abstract base class for all Policy +objects. If you're developing your own Policies, your job is to +implement and override its methods in a subclass. To work with the +L engine, your implementation must behave as described +below. For a detailed explanation on how to make new Policy modules, +please see the L document included in this +distribution. + + +=head1 METHODS + +=over + +=item C<< new(key1 => value1, key2 => value2 ... ) >> + +Returns a reference to a new subclass of Perl::Critic::Policy. If your +Policy requires any special arguments, they will be passed in here as +key-value pairs. Users of L can specify these in their +config file. Unless you override the C method, the default +method simply returns a reference to an empty hash that has been +blessed into your subclass. However, you really should not override +this; override C instead. + +This constructor is always called regardless of whether the user has +enabled this Policy or not. + + +=item C<< initialize_if_enabled( { key1 => value1, key2 => value2 ... } ) >> + +This receives the same parameters as C, but as a reference to a +hash, and is only invoked if this Policy is enabled by the user. +Thus, this is the preferred place for subclasses to do any +initialization. + +Implementations of this method should return a boolean value +indicating whether the Policy should continue to be enabled. For most +subclasses, this will always be C<$TRUE>. Policies that depend upon +external modules or other system facilities that may or may not be +available should test for the availability of these dependencies and +return C<$FALSE> if they are not. + + +=item C< violates( $element, $document ) > + +Given a L and a L, returns one or more +L objects if the C<$element> violates this +Policy. If there are no violations, then it returns an empty list. +If the Policy encounters an exception, then it should C with an +error message and let the caller decide how to handle it. + +C is an abstract method and it will abort if you attempt +to invoke it directly. It is the heart of all Policy modules, and +your subclass B override this method. + + +=item C< violation( $description, $explanation, $element ) > + +Returns a reference to a new C object. The +arguments are a description of the violation (as string), an +explanation for the policy (as string) or a series of page numbers in +PBP (as an ARRAY ref), a reference to the L element that caused +the violation. + +These are the same as the constructor to L, +but without the severity. The Policy itself knows the severity. + + +=item C< new_parameter_value_exception( $option_name, $option_value, $source, $message_suffix ) > + +Create a +L +for this Policy. + + +=item C< throw_parameter_value_exception( $option_name, $option_value, $source, $message_suffix ) > + +Create and throw a +L. +Useful in parameter parser implementations. + + +=item C< get_long_name() > + +Return the full package name of this policy. + + +=item C< get_short_name() > + +Return the name of this policy without the "Perl::Critic::Policy::" +prefix. + + +=item C< applies_to() > + +Returns a list of the names of PPI classes that this Policy cares +about. By default, the result is C. Overriding this +method in Policy subclasses should lead to significant performance +increases. + + +=item C< default_maximum_violations_per_document() > + +Returns the default maximum number of violations for this policy to +report per document. By default, this not defined, but subclasses may +override this. + + +=item C< get_maximum_violations_per_document() > + +Returns the maximum number of violations this policy will report for a +single document. If this is not defined, then there is no limit. If +L has not been invoked, then +L is returned. + + +=item C< set_maximum_violations_per_document() > + +Specify the maximum violations that this policy should report for a +document. + + +=item C< default_severity() > + +Returns the default severity for violating this Policy. See the +C<$SEVERITY> constants in L for an enumeration of +possible severity values. By default, this method returns +C<$SEVERITY_LOWEST>. Authors of Perl::Critic::Policy subclasses +should override this method to return a value that they feel is +appropriate for their Policy. In general, Polices that are widely +accepted or tend to prevent bugs should have a higher severity than +those that are more subjective or cosmetic in nature. + + +=item C< get_severity() > + +Returns the severity of violating this Policy. If the severity has +not been explicitly defined by calling C, then the +C is returned. See the C<$SEVERITY> constants in +L for an enumeration of possible severity values. + + +=item C< set_severity( $N ) > + +Sets the severity for violating this Policy. Clients of +Perl::Critic::Policy objects can call this method to assign a +different severity to the Policy if they don't agree with the +C. See the C<$SEVERITY> constants in +L for an enumeration of possible values. + + +=item C< default_themes() > + +Returns a sorted list of the default themes associated with this +Policy. The default method returns an empty list. Policy authors +should override this method to return a list of themes that are +appropriate for their policy. + + +=item C< get_themes() > + +Returns a sorted list of the themes associated with this Policy. If +you haven't added themes or set the themes explicitly, this method +just returns the default themes. + + +=item C< set_themes( @THEME_LIST ) > + +Sets the themes associated with this Policy. Any existing themes are +overwritten. Duplicate themes will be removed. + + +=item C< add_themes( @THEME_LIST ) > + +Appends additional themes to this Policy. Any existing themes are +preserved. Duplicate themes will be removed. + + +=item C< get_abstract() > + +Retrieve the abstract for this policy (the part of the NAME section of +the POD after the module name), if it is available. + + +=item C< get_raw_abstract() > + +Retrieve the abstract for this policy (the part of the NAME section of +the POD after the module name), if it is available, in the unparsed +form. + + +=item C< parameter_metadata_available() > + +Returns whether information about the parameters is available. + + +=item C< get_parameters() > + +Returns a reference to an array containing instances of +L. + +Note that this will return an empty list if the parameters for this +policy are unknown. In order to differentiate between this +circumstance and the one where this policy does not take any +parameters, it is necessary to call C. + + +=item C< get_parameter( $parameter_name ) > + +Returns the L with the specified name. + + +=item C + +Class method. Sets the format for all Policy objects when they are +evaluated in string context. The default is C<"%p\n">. See +L<"OVERLOADS"> for formatting options. + + +=item C + +Class method. Returns the current format for all Policy objects when +they are evaluated in string context. + + +=item C + +Returns a string representation of the policy. The content of the +string depends on the current value of the C<$FORMAT> package +variable. See L<"OVERLOADS"> for the details. + + +=back + + +=head1 DOCUMENTATION + +When your Policy module first Cs L, it +will try and extract the DESCRIPTION section of your Policy module's +POD. This information is displayed by Perl::Critic if the verbosity +level is set accordingly. Therefore, please include a DESCRIPTION +section in the POD for any Policy modules that you author. Thanks. + + +=head1 OVERLOADS + +Perl::Critic::Violation overloads the C<""> operator to produce neat +little messages when evaluated in string context. The format depends +on the current value of the C<$FORMAT> package variable. + +Formats are a combination of literal and escape characters similar to +the way C works. If you want to know the specific formatting +capabilities, look at L. Valid escape characters are: + + +=over + +=item C<%P> + +Name of the Policy module. + + +=item C<%p> + +Name of the Policy without the C prefix. + + +=item C<%a> + +The policy abstract. + + +=item C<%O> + +List of supported policy parameters. Takes an option of a format +string for L. +For example, this can be used like C<%{%n - %d\n}O> to get a list of +parameter names followed by their descriptions. + + +=item C<%U> + +A message stating that the parameters for the policy are unknown if +C returns false. Takes an option of +what the message should be, which defaults to "Cannot programmatically +discover what parameters this policy takes.". The value of this +option is interpolated in order to expand the standard escape +sequences (C<\n>, C<\t>, etc.). + + +=item C<%S> + +The default severity level of the policy. + + +=item C<%s> + +The current severity level of the policy. + + +=item C<%T> + +The default themes for the policy. + + +=item C<%t> + +The current themes for the policy. + + +=item C<%V> + +The default maximum number of violations per document of the policy. + + +=item C<%v> + +The current maximum number of violations per document of the policy. + + +=back + + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitBooleanGrep.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitBooleanGrep.pm new file mode 100644 index 0000000..fe1d8c9 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitBooleanGrep.pm @@ -0,0 +1,156 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitBooleanGrep.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::BuiltinFunctions::ProhibitBooleanGrep; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification hashify }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{"grep" used in boolean context}; +Readonly::Scalar my $EXPL => [71,72]; + +Readonly::Hash my %POSTFIX_CONDITIONALS => hashify( qw(if unless while until) ); +Readonly::Hash my %BOOLEAN_OPERATORS => hashify( qw(&& || ! not or and)); + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_LOW } +sub default_themes { return qw( core pbp performance ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + return if $elem ne 'grep'; + return if not is_function_call($elem); + return if not _is_in_boolean_context($elem); + + return $self->violation( $DESC, $EXPL, $elem ); +} + +#----------------------------------------------------------------------------- + +sub _is_in_boolean_context { + my ($token) = @_; + + return _does_prev_sibling_cause_boolean($token) || _does_parent_cause_boolean($token); +} + +sub _does_prev_sibling_cause_boolean { + my ($token) = @_; + + my $prev = $token->sprevious_sibling; + return if !$prev; + return 1 if $prev->isa('PPI::Token::Word') and $POSTFIX_CONDITIONALS{$prev}; + return if not ($prev->isa('PPI::Token::Operator') and $BOOLEAN_OPERATORS{$prev}); + my $next = $token->snext_sibling; + return 1 if not $next; # bizarre: grep with no arguments + + # loose heuristic: unparenthesized grep has no following non-boolean operators + return 1 if not $next->isa('PPI::Structure::List'); + + $next = $next->snext_sibling; + return 1 if not $next; + return 1 if $next->isa('PPI::Token::Operator') and $BOOLEAN_OPERATORS{$next}; + return; +} + +sub _does_parent_cause_boolean { + my ($token) = @_; + + my $prev = $token->sprevious_sibling; + return if $prev; + my $parent = $token->statement->parent; + for (my $node = $parent; $node; $node = $node->parent) { ##no critic 'CStyleForLoop' + next if $node->isa('PPI::Structure::List'); + return 1 if $node->isa('PPI::Structure::Condition'); + } + + return; +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::BuiltinFunctions::ProhibitBooleanGrep - Use C instead of C in boolean context. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Using C in boolean context is a common idiom for checking if any +elements in a list match a condition. This works because boolean context is a +subset of scalar context, and grep returns the number of matches in scalar +context. A non-zero number of matches means a match. + +But consider the case of a long array where the first element is a match. +Boolean C still checks all of the rest of the elements needlessly. +Instead, a better solution is to use the C function from +L, which short-circuits after the first successful match to +save time. + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 CAVEATS + +The algorithm for detecting boolean context takes a LOT of shortcuts. There +are lots of known false negatives. But, I was conservative in writing this, +so I hope there are no false positives. + +=head1 AUTHOR + +Chris Dolan + +=head1 CREDITS + +Initial development of this policy was supported by a grant from the Perl +Foundation. + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Chris Dolan. Many 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitComplexMappings.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitComplexMappings.pm new file mode 100644 index 0000000..845c53d --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitComplexMappings.pm @@ -0,0 +1,146 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitComplexMappings.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::BuiltinFunctions::ProhibitComplexMappings; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Map blocks should have a single statement}; +Readonly::Scalar my $EXPL => [ 113 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { + return ( + { + name => 'max_statements', + description => + 'The maximum number of statements to allow within a map block.', + default_string => '1', + behavior => 'integer', + integer_minimum => 1, + }, + ); +} + +sub default_severity { return $SEVERITY_MEDIUM } +sub default_themes { return qw( core pbp maintenance complexity) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + return if $elem ne 'map'; + return if ! is_function_call($elem); + + my $sib = $elem->snext_sibling(); + return if !$sib; + + my $arg = $sib; + if ( $arg->isa('PPI::Structure::List') ) { + $arg = $arg->schild(0); + # Forward looking: PPI might change in v1.200 so schild(0) is a PPI::Statement::Expression + if ( $arg && $arg->isa('PPI::Statement::Expression') ) { + $arg = $arg->schild(0); + } + } + # If it's not a block, it's an expression-style map, which is only one statement by definition + return if !$arg; + return if !$arg->isa('PPI::Structure::Block'); + + # If we get here, we found a sort with a block as the first arg + return if $self->{_max_statements} >= $arg->schildren() + && 0 == grep {$_->isa('PPI::Statement::Compound')} $arg->schildren(); + + # more than one child statements + return $self->violation( $DESC, $EXPL, $elem ); +} + +1; + +#----------------------------------------------------------------------------- + +__END__ + +=pod + +=head1 NAME + +Perl::Critic::Policy::BuiltinFunctions::ProhibitComplexMappings - Map blocks should have a single statement. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +The map function can be confusing to novices in the best of +circumstances. Mappings with multiple statements are even worse. +They're also a maintainer's nightmare because any added complexity +decreases readability precipitously. Why? Because map is +traditionally a one-liner converting one array to another. Trying to +cram lots of functionality into a one-liner is a bad idea in general. + +The best solutions to a complex mapping are: 1) write a subroutine +that performs the manipulation and call that from map; 2) rewrite the +map as a for loop. + +=head1 CAVEATS + +This policy currently misses some compound statements inside of the +map. For example, the following code incorrectly does not trigger a +violation: + + map { do { foo(); bar() } } @list + +=head1 CONFIGURATION + +By default this policy flags any mappings with more than one +statement. While we do not recommend it, you can increase this limit +as follows in a F<.perlcriticrc> file: + + [BuiltinFunctions::ProhibitComplexMappings] + max_statements = 2 + +=head1 AUTHOR + +Chris Dolan + +=head1 CREDITS + +Initial development of this policy was supported by a grant from the Perl Foundation. + +=head1 COPYRIGHT + +Copyright (C) 2007 Chris Dolan. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitLvalueSubstr.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitLvalueSubstr.pm new file mode 100644 index 0000000..973618d --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitLvalueSubstr.pm @@ -0,0 +1,100 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitLvalueSubstr.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::BuiltinFunctions::ProhibitLvalueSubstr; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Lvalue form of "substr" used}; +Readonly::Scalar my $EXPL => [ 165 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_MEDIUM } +sub default_themes { return qw( core maintenance pbp ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ($self, $elem, undef) = @_; + + return if $elem ne 'substr'; + return if ! is_function_call($elem); + + my $sib = $elem; + while ($sib = $sib->snext_sibling()) { + if ( $sib->isa( 'PPI::Token::Operator') && $sib eq q{=} ) { + return $self->violation( $DESC, $EXPL, $sib ); + } + } + return; #ok! +} + +1; + +#----------------------------------------------------------------------------- + +__END__ + +=pod + +=head1 NAME + +Perl::Critic::Policy::BuiltinFunctions::ProhibitLvalueSubstr - Use 4-argument C instead of writing C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Conway discourages the use of C as an lvalue, instead +recommending that the 4-argument version of C be used instead. + + substr($something, 1, 2) = $newvalue; # not ok + substr($something, 1, 2, $newvalue); # ok + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 AUTHOR + +Graham TerMarsch + +=head1 COPYRIGHT + +Copyright (C) 2005-2007 Graham TerMarsch. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitReverseSortBlock.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitReverseSortBlock.pm new file mode 100644 index 0000000..cdb4f5e --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitReverseSortBlock.pm @@ -0,0 +1,135 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitReverseSortBlock.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::BuiltinFunctions::ProhibitReverseSortBlock; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Forbid $b before $a in sort blocks}; ## no critic (Interpolation) +Readonly::Scalar my $EXPL => [ 152 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_LOWEST } +sub default_themes { return qw(core pbp cosmetic) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ($self, $elem, $doc) = @_; + + return if $elem ne 'sort'; + return if ! is_function_call($elem); + + my $sib = $elem->snext_sibling(); + return if !$sib; + + my $arg = $sib; + if ( $arg->isa('PPI::Structure::List') ) { + $arg = $arg->schild(0); + # Forward looking: PPI might change in v1.200 so schild(0) is a PPI::Statement::Expression + if ( $arg && $arg->isa('PPI::Statement::Expression') ) { + $arg = $arg->schild(0); + } + } + return if !$arg || !$arg->isa('PPI::Structure::Block'); + + # If we get here, we found a sort with a block as the first arg + + # Look at each statement in the block separately. + # $a is +1, $b is -1, sum should always be >= 0. + # This may go badly if there are conditionals or loops or other + # sub-statements... + for my $statement ($arg->children) { + my @sort_vars = $statement =~ m/\$([ab])\b/gxms; + my $count = 0; + for my $sort_var (@sort_vars) { + if ($sort_var eq 'a') { + $count++; + } else { + $count--; + if ($count < 0) { + # Found too many C<$b>s too early + my $sev = $self->get_severity(); + return $self->violation( $DESC, $EXPL, $elem, $sev ); + } + } + } + } + return; #ok +} + +1; + +#----------------------------------------------------------------------------- + +__END__ + +=pod + +=head1 NAME + +Perl::Critic::Policy::BuiltinFunctions::ProhibitReverseSortBlock - Forbid $b before $a in sort blocks. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Conway says that it is much clearer to use C than to flip C<$a> and +C<$b> around in a C block. He also suggests that, in newer perls, +C is specifically looked for and optimized, and in the case of a +simple reversed string C, using C with a C with no block +is faster even in old perls. + + my @foo = sort { $b cmp $a } @bar; #not ok + my @foo = reverse sort @bar; #ok + + my @foo = sort { $b <=> $a } @bar; #not ok + my @foo = reverse sort { $a <=> $b } @bar; #ok + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 AUTHOR + +Chris Dolan + +=head1 COPYRIGHT + +Copyright (C) 2006 Chris Dolan. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitSleepViaSelect.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitSleepViaSelect.pm new file mode 100644 index 0000000..ca68916 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitSleepViaSelect.pm @@ -0,0 +1,110 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitSleepViaSelect.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::BuiltinFunctions::ProhibitSleepViaSelect; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification :ppi }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{"select" used to emulate "sleep"}; +Readonly::Scalar my $EXPL => [168]; +Readonly::Scalar my $UNDEFS_IN_SLEEP_SELECT => 3; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_HIGHEST } +sub default_themes { return qw( core pbp bugs ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ($self, $elem, undef) = @_; + + return if ($elem ne 'select'); + return if ! is_function_call($elem); + + if ( + $UNDEFS_IN_SLEEP_SELECT + == grep { $_->[0] eq 'undef' } parse_arg_list($elem) + ) { + return $self->violation( $DESC, $EXPL, $elem ); + } + return; #ok! +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::BuiltinFunctions::ProhibitSleepViaSelect - Use L instead of something like C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Conway discourages the use of C for performing non-integer +sleeps. Although documented in L, it's something that +generally requires the reader to read C to figure +out what it should be doing. Instead, Conway recommends that you use +the C module when you want to sleep. + + select undef, undef, undef, 0.25; # not ok + + use Time::HiRes; + sleep( 0.25 ); # ok + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 SEE ALSO + +L. + +=head1 AUTHOR + +Graham TerMarsch + +=head1 COPYRIGHT + +Copyright (C) 2005-2007 Graham TerMarsch. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitStringyEval.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitStringyEval.pm new file mode 100644 index 0000000..cb56bb4 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitStringyEval.pm @@ -0,0 +1,106 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitStringyEval.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification :ppi }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Expression form of "eval"}; +Readonly::Scalar my $EXPL => [ 161 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_HIGHEST } +sub default_themes { return qw( core pbp bugs ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + return if $elem ne 'eval'; + return if ! is_function_call($elem); + + my $arg = first_arg($elem); + return if !$arg; + return if $arg->isa('PPI::Structure::Block'); + + return $self->violation( $DESC, $EXPL, $elem ); +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval - Write C instead of C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +The string form of C is recompiled every time it is executed, +whereas the block form is only compiled once. Also, the string form +doesn't give compile-time warnings. + + eval "print $foo"; #not ok + eval {print $foo}; #ok + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 SEE ALSO + +L + +L + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitStringySplit.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitStringySplit.pm new file mode 100644 index 0000000..d7217d7 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitStringySplit.pm @@ -0,0 +1,116 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitStringySplit.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::BuiltinFunctions::ProhibitStringySplit; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :characters :severities :classification :ppi }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{String delimiter used with "split"}; +Readonly::Scalar my $EXPL => q{Express it as a regex instead}; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_LOW } +sub default_themes { return qw(core pbp cosmetic) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + return if $elem ne 'split'; + return if ! is_function_call($elem); + + my @args = parse_arg_list($elem); + my $pattern = @args ? $args[0]->[0] : return; + + if ( $pattern->isa('PPI::Token::Quote') && $pattern->string() ne $SPACE ) { + return $self->violation( $DESC, $EXPL, $elem ); + } + + return; #ok +} + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::BuiltinFunctions::ProhibitStringySplit - Write C instead of C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +The C function always interprets the PATTERN argument as a +regular expression, even if you specify it as a string. This causes +much confusion if the string contains regex metacharacters. So for +clarity, always express the PATTERN argument as a regex. + + $string = 'Fred|Barney'; + @names = split '|', $string; #not ok, is ('F', 'r', 'e', 'd', '|', 'B', 'a' ...) + @names = split m/[|]/, $string; #ok, is ('Fred', Barney') + +When the PATTERN is a single space the C function has special +behavior, so Perl::Critic forgives that usage. See C<"perldoc -f +split"> for more information. + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 SEE ALSO + +L + +L + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitUniversalCan.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitUniversalCan.pm new file mode 100644 index 0000000..b44d3d9 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitUniversalCan.pm @@ -0,0 +1,107 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitUniversalCan.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalCan; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{UNIVERSAL::can should not be used as a function}; +Readonly::Scalar my $EXPL => q{Use eval{$obj->can($pkg)} instead}; ##no critic 'RequireInterp'; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_MEDIUM } +sub default_themes { return qw( core maintenance ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + return if !($elem eq 'can' || $elem eq 'UNIVERSAL::can'); + return if ! is_function_call($elem); # this also permits 'use UNIVERSAL::can;' + + return $self->violation( $DESC, $EXPL, $elem ); +} + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalCan - Write C<< eval { $foo->can($name) } >> instead of C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + + print UNIVERSAL::can($obj, 'Foo::Bar') ? 'yes' : 'no'; #not ok + print eval { $obj->can('Foo::Bar') } ? 'yes' : 'no'; #ok + +As of Perl 5.9.3, the use of UNIVERSAL::can as a function has been +deprecated and the method form is preferred instead. Formerly, the +functional form was recommended because it gave valid results even +when the object was C or an unblessed scalar. However, the +functional form makes it impossible for packages to override C, +a technique which is crucial for implementing mock objects and some +facades. + +See the CPAN module L for a more thorough discussion +of this topic. + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +Chris Dolan + +=head1 COPYRIGHT + +Copyright (c) 2006-2008 Chris Dolan. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitUniversalIsa.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitUniversalIsa.pm new file mode 100644 index 0000000..8363ce2 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitUniversalIsa.pm @@ -0,0 +1,110 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitUniversalIsa.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalIsa; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{UNIVERSAL::isa should not be used as a function}; +Readonly::Scalar my $EXPL => q{Use eval{$obj->isa($pkg)} instead}; ##no critic 'RequireInterp'; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_MEDIUM } +sub default_themes { return qw( core maintenance ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + return if !($elem eq 'isa' || $elem eq 'UNIVERSAL::isa'); + return if ! is_function_call($elem); # this also permits 'use UNIVERSAL::isa;' + + return $self->violation( $DESC, $EXPL, $elem ); +} + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalIsa - Write C<< eval { $foo->isa($pkg) } >> instead of C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + + print UNIVERSAL::isa($obj, 'Foo::Bar') ? 'yes' : 'no'; #not ok + print eval { $obj->isa('Foo::Bar') } ? 'yes' : 'no'; #ok + +As of Perl 5.9.3, the use of C as a function has been +deprecated and the method form is preferred instead. Formerly, the +functional form was recommended because it gave valid results even +when the object was C or an unblessed scalar. However, the +functional form makes it impossible for packages to override C, +a technique which is crucial for implementing mock objects and some +facades. + +Another alternative to UNIVERSAL::isa is the C<_INSTANCE> method of +Param::Util, which is faster. + +See the CPAN module L for an incendiary discussion of +this topic. + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +Chris Dolan + +=head1 COPYRIGHT + +Copyright (c) 2006-2008 Chris Dolan. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitVoidGrep.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitVoidGrep.pm new file mode 100644 index 0000000..03561fc --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitVoidGrep.pm @@ -0,0 +1,104 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitVoidGrep.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidGrep; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification is_in_void_context }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{"grep" used in void context}; +Readonly::Scalar my $EXPL => q{Use a "for" loop instead}; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_MEDIUM } +sub default_themes { return qw( core maintenance ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + return if $elem ne 'grep'; + return if not is_function_call($elem); + return if not is_in_void_context($elem); + + return $self->violation( $DESC, $EXPL, $elem ); +} + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidGrep - Don't use C in void contexts. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +C and C are intended to be pure functions, not mutators. +If you want to iterate with side-effects, then you should use a proper +C or C loop. + + grep{ print frobulate($_) } @list; #not ok + print map{ frobulate($_) } @list; #ok + + grep{ $_ = lc $_ } @list; #not ok + for( @list ){ $_ = lc $_ }; #ok + + map{ push @frobbed, frobulate($_) } @list; #not ok + @frobbed = map { frobulate($_) } @list; #ok + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitVoidMap.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitVoidMap.pm new file mode 100644 index 0000000..a58eef9 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitVoidMap.pm @@ -0,0 +1,104 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitVoidMap.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidMap; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification is_in_void_context }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{"map" used in void context}; +Readonly::Scalar my $EXPL => q{Use a "for" loop instead}; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_MEDIUM } +sub default_themes { return qw( core maintenance ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + return if $elem ne 'map'; + return if not is_function_call($elem); + return if not is_in_void_context($elem); + + return $self->violation( $DESC, $EXPL, $elem ); +} + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidMap - Don't use C in void contexts. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +C and C are intended to be pure functions, not mutators. +If you want to iterate with side-effects, then you should use a proper +C or C loop. + + grep{ print frobulate($_) } @list; #not ok + print map{ frobulate($_) } @list; #ok + + grep{ $_ = lc $_ } @list; #not ok + for( @list ){ $_ = lc $_ }; #ok + + map{ push @frobbed, frobulate($_) } @list; #not ok + @frobbed = map { frobulate($_) } @list; #ok + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/RequireBlockGrep.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/RequireBlockGrep.pm new file mode 100644 index 0000000..082d349 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/RequireBlockGrep.pm @@ -0,0 +1,113 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/BuiltinFunctions/RequireBlockGrep.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::BuiltinFunctions::RequireBlockGrep; + +# DEVELOPER NOTE: this module is used as an example in DEVELOPER.pod. +# If you make changes in here, please reflect those changes in the +# examples. + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification :ppi }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Expression form of "grep"}; +Readonly::Scalar my $EXPL => [ 169 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_HIGH } +sub default_themes { return qw( core bugs pbp ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + return if $elem ne 'grep'; + return if ! is_function_call($elem); + + my $arg = first_arg($elem); + return if !$arg; + return if $arg->isa('PPI::Structure::Block'); + + return $self->violation( $DESC, $EXPL, $elem ); +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::BuiltinFunctions::RequireBlockGrep - Write C instead of C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +The expression forms of C and C are awkward and hard to read. +Use the block forms instead. + + @matches = grep /pattern/, @list; #not ok + @matches = grep { /pattern/ } @list; #ok + + @mapped = map transform($_), @list; #not ok + @mapped = map { transform($_) } @list; #ok + + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 SEE ALSO + +L + +L + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/RequireBlockMap.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/RequireBlockMap.pm new file mode 100644 index 0000000..397a598 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/RequireBlockMap.pm @@ -0,0 +1,109 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/BuiltinFunctions/RequireBlockMap.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::BuiltinFunctions::RequireBlockMap; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification :ppi }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Expression form of "map"}; +Readonly::Scalar my $EXPL => [ 169 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_HIGH } +sub default_themes { return qw( core bugs pbp ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + return if $elem ne 'map'; + return if ! is_function_call($elem); + + my $arg = first_arg($elem); + return if !$arg; + return if $arg->isa('PPI::Structure::Block'); + + return $self->violation( $DESC, $EXPL, $elem ); +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::BuiltinFunctions::RequireBlockMap - Write C instead of C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +The expression forms of C and C are awkward and hard to read. +Use the block forms instead. + + @matches = grep /pattern/, @list; #not ok + @matches = grep { /pattern/ } @list; #ok + + @mapped = map transform($_), @list; #not ok + @mapped = map { transform($_) } @list; #ok + + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 SEE ALSO + +L + +L + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/RequireGlobFunction.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/RequireGlobFunction.pm new file mode 100644 index 0000000..d5243af --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/RequireGlobFunction.pm @@ -0,0 +1,97 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/BuiltinFunctions/RequireGlobFunction.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::BuiltinFunctions::RequireGlobFunction; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $GLOB_RX => qr{ [*?] }mx; +Readonly::Scalar my $DESC => q{Glob written as <...>}; +Readonly::Scalar my $EXPL => [ 167 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_HIGHEST } +sub default_themes { return qw( core pbp bugs ) } +sub applies_to { return 'PPI::Token::QuoteLike::Readline' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + if ( $elem =~ $GLOB_RX ) { + return $self->violation( $DESC, $EXPL, $elem ); + } + return; #ok! +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::BuiltinFunctions::RequireGlobFunction - Use C instead of <*>. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Conway discourages the use of the C< <..> > construct for globbing, as +it is easily confused with the angle bracket file input operator. +Instead, he recommends the use of the C function as it makes +it much more obvious what you're attempting to do. + + @files = <*.pl>; # not ok + @files = glob( "*.pl" ); # ok + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 AUTHOR + +Graham TerMarsch + +=head1 COPYRIGHT + +Copyright (C) 2005-2007 Graham TerMarsch. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/RequireSimpleSortBlock.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/RequireSimpleSortBlock.pm new file mode 100644 index 0000000..ae8b945 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/BuiltinFunctions/RequireSimpleSortBlock.pm @@ -0,0 +1,116 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/BuiltinFunctions/RequireSimpleSortBlock.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::BuiltinFunctions::RequireSimpleSortBlock; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Sort blocks should have a single statement}; +Readonly::Scalar my $EXPL => [ 149 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_MEDIUM } +sub default_themes { return qw( core pbp maintenance complexity) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + return if $elem ne 'sort'; + return if ! is_function_call($elem); + + my $sib = $elem->snext_sibling(); + return if !$sib; + + my $arg = $sib; + if ( $arg->isa('PPI::Structure::List') ) { + $arg = $arg->schild(0); + # Forward looking: PPI might change in v1.200 so schild(0) is a PPI::Statement::Expression + if ( $arg && $arg->isa('PPI::Statement::Expression') ) { + $arg = $arg->schild(0); + } + } + return if !$arg || !$arg->isa('PPI::Structure::Block'); + + # If we get here, we found a sort with a block as the first arg + return if ( 1 >= $arg->schildren() ); + + # more than one child statements + return $self->violation( $DESC, $EXPL, $elem ); +} + +1; + +#----------------------------------------------------------------------------- + +__END__ + +=pod + +=head1 NAME + +Perl::Critic::Policy::BuiltinFunctions::RequireSimpleSortBlock - Sort blocks should have a single statement. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Conway advises that sort functions should be simple. Any complicated +operations on list elements should be computed and cached (perhaps via +a Schwartzian Transform) before the sort, rather than computed inside +the sort block, because the sort block is called C times +instead of just C times. + +This policy prohibits the most blatant case of complicated sort +blocks: multiple statements. Future policies may wish to examine the +sort block in more detail -- looking for subroutine calls or large +numbers of operations. + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 AUTHOR + +Chris Dolan + +=head1 COPYRIGHT + +Copyright (C) 2006 Chris Dolan. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ClassHierarchies/ProhibitAutoloading.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ClassHierarchies/ProhibitAutoloading.pm new file mode 100644 index 0000000..c62fed7 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ClassHierarchies/ProhibitAutoloading.pm @@ -0,0 +1,97 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/ClassHierarchies/ProhibitAutoloading.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::ClassHierarchies::ProhibitAutoloading; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{AUTOLOAD method declared}; +Readonly::Scalar my $EXPL => [ 393 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_MEDIUM } +sub default_themes { return qw( core maintenance pbp ) } +sub applies_to { return 'PPI::Statement::Sub' } + +#----------------------------------------------------------------------------- + +sub violates { + my ($self, $elem, undef) = @_; + + if( $elem->name eq 'AUTOLOAD' ) { + return $self->violation( $DESC, $EXPL, $elem ); + } + return; #ok! +} + +1; + +#----------------------------------------------------------------------------- + +__END__ + +=pod + +=head1 NAME + +Perl::Critic::Policy::ClassHierarchies::ProhibitAutoloading - AUTOLOAD methods should be avoided. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Declaring a subroutine with the name C<"AUTOLOAD"> will violate this +Policy. The C mechanism is an easy way to generate methods +for your classes, but unless they are carefully written, those classes +are difficult to inherit from. And over time, the C method +will become more and more complex as it becomes responsible for +dispatching more and more functions. You're better off writing +explicit accessor methods. Editor macros can help make this a little +easier. + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (C) 2006 Jeffrey Ryan Thalhammer. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ClassHierarchies/ProhibitExplicitISA.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ClassHierarchies/ProhibitExplicitISA.pm new file mode 100644 index 0000000..2b638f9 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ClassHierarchies/ProhibitExplicitISA.pm @@ -0,0 +1,93 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/ClassHierarchies/ProhibitExplicitISA.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::ClassHierarchies::ProhibitExplicitISA; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{@ISA used instead of "use base"}; ##no critic; #for @ in string +Readonly::Scalar my $EXPL => [ 360 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_MEDIUM } +sub default_themes { return qw( core maintenance pbp ) } +sub applies_to { return 'PPI::Token::Symbol' } + +#----------------------------------------------------------------------------- + +sub violates { + my ($self, $elem, undef) = @_; + + if( $elem eq q{@ISA} ) { ##no critic; #for @ in string + return $self->violation( $DESC, $EXPL, $elem ); + } + return; #ok! +} + +1; + +#----------------------------------------------------------------------------- + +__END__ + +=pod + +=head1 NAME + +Perl::Critic::Policy::ClassHierarchies::ProhibitExplicitISA - Employ C instead of C<@ISA>. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Conway recommends employing C instead of the usual +C because the former happens at compile time and +the latter at runtime. The C pragma also automatically loads +C for you so you save a line of easily-forgotten code. + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 AUTHOR + +Chris Dolan + +=head1 COPYRIGHT + +Copyright (C) 2006 Chris Dolan. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ClassHierarchies/ProhibitOneArgBless.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ClassHierarchies/ProhibitOneArgBless.pm new file mode 100644 index 0000000..3cb5729 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ClassHierarchies/ProhibitOneArgBless.pm @@ -0,0 +1,101 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/ClassHierarchies/ProhibitOneArgBless.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::ClassHierarchies::ProhibitOneArgBless; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :booleans :severities :classification :ppi }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{One-argument "bless" used}; +Readonly::Scalar my $EXPL => [ 365 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_HIGHEST } +sub default_themes { return qw( core pbp bugs ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ($self, $elem, undef) = @_; + + return if $elem ne 'bless'; + return if ! is_function_call($elem); + + if( scalar parse_arg_list($elem) == 1 ) { + return $self->violation( $DESC, $EXPL, $elem ); + } + return; #ok! +} + +1; + +#----------------------------------------------------------------------------- + +__END__ + +=pod + +=head1 NAME + +Perl::Critic::Policy::ClassHierarchies::ProhibitOneArgBless - Write C instead of just C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Always use the two-argument form of C because it allows +subclasses to inherit your constructor. + + sub new { + my $class = shift; + my $self = bless {}; # not ok + my $self = bless {}, $class; # ok + return $self; + } + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (C) 2005-2007 Jeffrey Ryan Thalhammer. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/ProhibitHardTabs.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/ProhibitHardTabs.pm new file mode 100644 index 0000000..feeb7b8 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/ProhibitHardTabs.pm @@ -0,0 +1,133 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/CodeLayout/ProhibitHardTabs.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::CodeLayout::ProhibitHardTabs; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :booleans :severities }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Hard tabs used}; +Readonly::Scalar my $EXPL => [ 20 ]; + +my $DEFAULT_ALLOW_LEADING_TABS = $TRUE; + +#----------------------------------------------------------------------------- + +sub supported_parameters { + return ( + { + name => 'allow_leading_tabs', + description => 'Allow hard tabs before first non-whitespace character.', + default_string => '1', + behavior => 'boolean', + }, + ); +} + +sub default_severity { return $SEVERITY_MEDIUM } +sub default_themes { return qw( core cosmetic ) } +sub applies_to { return 'PPI::Token' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + $elem =~ m{ \t }mx || return; + + # The __DATA__ element is exempt + return if $elem->parent->isa('PPI::Statement::Data'); + + # Permit leading tabs, if allowed + return if $self->_allow_leading_tabs() && $elem->location->[1] == 1; + + # Must be a violation... + return $self->violation( $DESC, $EXPL, $elem ); +} + +#----------------------------------------------------------------------------- + +sub _allow_leading_tabs { + my ( $self ) = @_; + + return $self->{_allow_leading_tabs}; +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=head1 NAME + +Perl::Critic::Policy::CodeLayout::ProhibitHardTabs - Use spaces instead of tabs. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Putting hard tabs in your source code (or POD) is one of the worst +things you can do to your co-workers and colleagues, especially if +those tabs are anywhere other than a leading position. Because +various applications and devices represent tabs differently, they can +cause you code to look vastly different to other people. Any decent +editor can be configured to expand tabs into spaces. L +also does this for you. + +This Policy catches all tabs in your source code, including POD, +quotes, and HEREDOCs. The contents of the C<__DATA__> section are not +examined. + +=head1 CONFIGURATION + +Tabs in a leading position are allowed, but if you want to forbid all tabs +everywhere, put this to your F<.perlcriticrc> file: + + [CodeLayout::ProhibitHardTabs] + allow_leading_tabs = 0 + +=head1 NOTES + +Beware that Perl::Critic may report the location of the string that +contains the tab, not the actual location of the tab, so you may need +to do some hunting. I'll try and fix this in the future. + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +############################################################################## +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/ProhibitParensWithBuiltins.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/ProhibitParensWithBuiltins.pm new file mode 100644 index 0000000..aae5f3c --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/ProhibitParensWithBuiltins.pm @@ -0,0 +1,237 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/CodeLayout/ProhibitParensWithBuiltins.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::CodeLayout::ProhibitParensWithBuiltins; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ + :booleans :severities :data_conversion :classification :language +}; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Array my @ALLOW => qw( my our local return ); +Readonly::Hash my %ALLOW => hashify( @ALLOW ); + +Readonly::Scalar my $DESC => q{Builtin function called with parentheses}; +Readonly::Scalar my $EXPL => [ 13 ]; + +Readonly::Scalar my $PRECENDENCE_OF_LIST => precedence_of(q{>>}) + 1; +Readonly::Scalar my $PRECEDENCE_OF_COMMA => precedence_of(q{,}); + +#----------------------------------------------------------------------------- +# These are all the functions that are considered named unary +# operators. These frequently require parentheses because they have lower +# precedence than ordinary function calls. + +Readonly::Array my @NAMED_UNARY_OPS => qw( + alarm glob rand + caller gmtime readlink + chdir hex ref + chroot int require + cos lc return + defined lcfirst rmdir + delete length scalar + do localtime sin + eval lock sleep + exists log sqrt + exit lstat srand + getgrp my stat + gethostbyname oct uc + getnetbyname ord ucfirst + getprotobyname quotemeta umask + undef +); +Readonly::Hash my %NAMED_UNARY_OPS => hashify( @NAMED_UNARY_OPS ); + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_LOWEST } +sub default_themes { return qw( core pbp cosmetic ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + return if exists $ALLOW{$elem}; + return if not is_perl_builtin($elem); + return if not is_function_call($elem); + + my $sibling = $elem->snext_sibling(); + return if not $sibling; + if ( $sibling->isa('PPI::Structure::List') ) { + my $elem_after_parens = $sibling->snext_sibling(); + + return if _is_named_unary_exemption($elem, $elem_after_parens); + return if _is_precedence_exemption($elem_after_parens); + return if _is_equals_exemption($sibling); + return if _is_sort_exemption($elem, $sibling); + + # If we get here, it must be a violation + return $self->violation( $DESC, $EXPL, $elem ); + } + return; #ok! +} + +#----------------------------------------------------------------------------- + +# EXCEPTION 1: If the function is a named unary and there is an +# operator with higher precedence right after the parentheses. +# Example: int( 1.5 ) + 0.5; + +sub _is_named_unary_exemption { + my ($elem, $elem_after_parens) = @_; + + if ( _is_named_unary( $elem ) && $elem_after_parens ){ + # Smaller numbers mean higher precedence + my $precedence = precedence_of( $elem_after_parens ); + return $TRUE if defined $precedence && $precedence < $PRECENDENCE_OF_LIST; + } + + return $FALSE; +} + +sub _is_named_unary { + my ($elem) = @_; + + return exists $NAMED_UNARY_OPS{$elem->content}; +} + +#----------------------------------------------------------------------------- + +# EXCEPTION 2, If there is an operator immediately after the +# parentheses, and that operator has precedence greater than +# or equal to a comma. +# Example: join($delim, @list) . "\n"; + +sub _is_precedence_exemption { + my ($elem_after_parens) = @_; + + if ( $elem_after_parens ){ + # Smaller numbers mean higher precedence + my $precedence = precedence_of( $elem_after_parens ); + return $TRUE if defined $precedence && $precedence <= $PRECEDENCE_OF_COMMA; + } + + return $FALSE; +} + +# EXCEPTION 3: If the first operator within the parentheses is '=' +# Example: chomp( my $foo = ); + +sub _is_equals_exemption { + my ($sibling) = @_; + + if ( my $first_op = $sibling->find_first('PPI::Token::Operator') ){ + return $TRUE if $first_op eq q{=}; + } + + return $FALSE; +} + +# EXCEPTION 4: sort with default comparator but a function for the list data +# Example: sort(foo(@x)) + +sub _is_sort_exemption { + my ($elem, $sibling) = @_; + + if ( $elem eq 'sort' ) { + my $first_arg = $sibling->schild(0); + if ( $first_arg && $first_arg->isa('PPI::Statement::Expression') ) { + $first_arg = $first_arg->schild(0); + } + if ( $first_arg && $first_arg->isa('PPI::Token::Word') ) { + my $next_arg = $first_arg->snext_sibling; + return $TRUE if $next_arg && $next_arg->isa('PPI::Structure::List'); + } + } + + return $FALSE; +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords disambiguates + +=head1 NAME + +Perl::Critic::Policy::CodeLayout::ProhibitParensWithBuiltins - Write C instead of C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Conway suggests that all built-in functions be called without +parentheses around the argument list. This reduces visual clutter and +disambiguates built-in functions from user functions. Exceptions are +made for C, C, and C which require parentheses when +called with multiple arguments. + + open($handle, '>', $filename); #not ok + open $handle, '>', $filename; #ok + + split(/$pattern/, @list); #not ok + split /$pattern/, @list; #ok + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 NOTES + +Coding with parentheses can sometimes lead to verbose and awkward +constructs, so I think the intent of Conway's guideline is to remove +only the F parentheses. This policy makes exceptions for +some common situations where parentheses are usually required. +However, you may find other situations where the parentheses are +necessary to enforce precedence, but they cause still violations. In +those cases, consider using the '## no critic' comments to silence +Perl::Critic. + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/ProhibitQuotedWordLists.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/ProhibitQuotedWordLists.pm new file mode 100644 index 0000000..20fca3f --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/ProhibitQuotedWordLists.pm @@ -0,0 +1,163 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/CodeLayout/ProhibitQuotedWordLists.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::CodeLayout::ProhibitQuotedWordLists; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :characters :severities }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{List of quoted literal words}; +Readonly::Scalar my $EXPL => q{Use 'qw()' instead}; + +#----------------------------------------------------------------------------- + +sub supported_parameters { + return ( + { + name => 'min_elements', + description => 'The minimum number of words in a list that will be complained about.', + default_string => '2', + behavior => 'integer', + integer_minimum => 1, + }, + ); +} + +sub default_severity { return $SEVERITY_LOW } +sub default_themes { return qw( core cosmetic ) } +sub applies_to { return 'PPI::Structure::List' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + #Don't worry about subroutine calls + my $sib = $elem->sprevious_sibling(); + return if !$sib; + return if $sib->isa('PPI::Token::Word'); + return if $sib->isa('PPI::Token::Symbol'); + + #Get the list elements + my $expr = $elem->schild(0); + return if !$expr; + my @children = $expr->schildren(); + return if !@children; + + my $count = 0; + for my $child ( @children ) { + next if $child->isa('PPI::Token::Operator') && $child eq $COMMA; + + #All elements must be literal strings, + #of non-zero length, with no whitespace + + return if ! _is_literal($child); + + my $string = $child->string(); + return if $string =~ m{ \s }mx; + return if $string eq $EMPTY; + $count++; + } + + #Were there enough? + return if $count < $self->{_min_elements}; + + #If we get here, then all elements were literals + return $self->violation( $DESC, $EXPL, $elem ); +} + +sub _is_literal { + my $elem = shift; + return $elem->isa('PPI::Token::Quote::Single') + || $elem->isa('PPI::Token::Quote::Literal'); +} + +1; + +__END__ + +=pod + +=head1 NAME + +Perl::Critic::Policy::CodeLayout::ProhibitQuotedWordLists - Write C instead of C<('foo', 'bar', 'baz')>. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Conway doesn't mention this, but I think C is an underused +feature of Perl. Whenever you need to declare a list of one-word +literals, the C operator is wonderfully concise, and makes +it easy to add to the list in the future. + + @list = ('foo', 'bar', 'baz'); #not ok + @list = qw(foo bar baz); #ok + +=head1 CONFIGURATION + +This policy can be configured to only pay attention to word lists with +at least a particular number of elements. By default, this value is 2, +which means that lists containing zero or one elements are ignored. +The minimum list size to be looked at can be specified by giving a +value for C in F<.perlcriticrc> like this: + + [CodeLayout::ProhibitQuotedWordLists] + min_elements = 4 + +This would cause this policy to only complain about lists containing +four or more words. + +=head1 NOTES + +In the PPI parlance, a "list" is almost anything with parentheses. +I've tried to make this Policy smart by targeting only "lists" that +could be sensibly expressed with C. However, there may be some +edge cases that I haven't covered. If you find one, send me a note. + +=head1 IMPORTANT CHANGES + +This policy was formerly called C which seemed a +little counter-intuitive. If you get lots of "Cannot load policy +module" errors, then you probably need to change C +to C in your F<.perlcriticrc> file. + + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. All rights reserved. + +=head1 COPYRIGHT + +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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/ProhibitTrailingWhitespace.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/ProhibitTrailingWhitespace.pm new file mode 100644 index 0000000..fde3324 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/ProhibitTrailingWhitespace.pm @@ -0,0 +1,148 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/CodeLayout/ProhibitTrailingWhitespace.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace; + +use 5.006001; +use strict; +use warnings; +use English qw(-no_match_vars); +use Readonly; + +use charnames qw{}; + +use PPI::Token::Whitespace; +use Perl::Critic::Utils qw{ :characters :severities }; + +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $EXPL => q{Don't use whitespace at the end of lines}; + +## no critic (RequireInterpolationOfMetachars) +Readonly::Hash my %C_STYLE_ESCAPES => + ( + ord "\t" => q{\t}, + ord "\n" => q{\n}, + ord "\r" => q{\r}, + ord "\f" => q{\f}, + ord "\b" => q{\b}, + ord "\a" => q{\a}, + ord "\e" => q{\e}, + ); +## use critic + +#----------------------------------------------------------------------------- + +sub supported_parameters { return qw{ } } +sub default_severity { return $SEVERITY_LOWEST } +sub default_themes { return qw( core maintenance ) } +sub applies_to { return 'PPI::Token::Whitespace' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $token, undef ) = @_; + + # There is at most one linefeed per Whitespace token, and it will always + # be the last character, if present. If the code has two consecutive + # blank lines, PPI will produce two Whitespace tokens, each consisting + # of a single linefeed. Thus, any Whitespace token consisting of a single + # character cannot contain trailing whitespace. + my $content = $token->content(); + return if length($content) < 2; + return if qq{\n} ne chop $content; + + my $description = q{Found "}; + $description .= join $EMPTY, map { _escape($_) } split $EMPTY, $content; + $description .= q{" at the end of the line}; + + return $self->violation( $description, $EXPL, $token ); +} + +sub _escape { + my $character = shift; + my $ordinal = ord $character; + + if (my $c_escape = $C_STYLE_ESCAPES{$ordinal}) { + return $c_escape; + } + + + # Apparently, the charnames.pm that ships with older perls does not + # support the C function, and newer versions of the module are + # not distributed separately from perl itself So if the C method + # is not supported, then just substitute something. + + + ## no critic (RequireInterpolationOfMetachars) + if ( charnames->can( 'viacode' ) ) { + return q/\N{/ . charnames::viacode($ordinal) . q/}/; + } + else { + return '\N{WHITESPACE CHAR}'; + } +} + +1; + +#----------------------------------------------------------------------------- + +__END__ + +=pod + +=for stopwords + +=head1 NAME + +Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace - Don't use whitespace at the end of lines. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Anything that is not readily visually detectable is a bad thing in +general, and more specifically, as different people edit the same +code, their editors may automatically strip out trailing whitespace, +causing spurious differences between different versions of the same +file (i.e. code in a source control system). + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 AUTHOR + +Elliot Shank C<< >> + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Elliot Shank. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/RequireConsistentNewlines.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/RequireConsistentNewlines.pm new file mode 100644 index 0000000..c718eeb --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/RequireConsistentNewlines.pm @@ -0,0 +1,125 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/CodeLayout/RequireConsistentNewlines.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::CodeLayout::RequireConsistentNewlines; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities }; +use PPI::Token::Whitespace; +use English qw(-no_match_vars); +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +Readonly::Scalar my $LINE_END => qr/\015{1,2}\012|\012|\015/mxs; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Use the same newline through the source}; +Readonly::Scalar my $EXPL => q{Change your newlines to be the same throughout}; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_HIGH } +sub default_themes { return qw( core bugs ) } +sub applies_to { return 'PPI::Document' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, undef, $doc ) = @_; + + my $filename = $doc->filename(); + return if !$filename; + + my $fh; + return if !open $fh, '<', $filename; + local $RS = undef; + my $source = <$fh>; + close $fh or return; + + my $newline; # undef until we find the first one + my $line = 1; + my @v; + while ( $source =~ m/\G([^\012\015]*)($LINE_END)/cgmxs ) { + my $code = $1; + my $nl = $2; + my $col = length $code; + $newline ||= $nl; + if ( $nl ne $newline ) { + my $token = PPI::Token::Whitespace->new( $nl ); + $token->{_location} = [$line, $col, $col]; + push @v, $self->violation( $DESC, $EXPL, $token ); + } + $line++; + } + return @v; +} + +1; + +#----------------------------------------------------------------------------- + +__END__ + +=pod + +=for stopwords GnuPG + +=head1 NAME + +Perl::Critic::Policy::CodeLayout::RequireConsistentNewlines - Use the same newline through the source. + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 CAVEAT + +This policy works outside of PPI because PPI automatically normalizes +source code to local newline conventions. So, this will only work if +we know the filename of the source code. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Source code files are divided into lines with line endings of C<\r>, +C<\n> or C<\r\n>. Mixing these different line endings causes problems +in many text editors and, notably, Module::Signature and GnuPG. + +=head1 AUTHOR + +Chris Dolan + +=head1 COPYRIGHT + +Copyright (C) 2006 Chris Dolan. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/RequireTidyCode.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/RequireTidyCode.pm new file mode 100644 index 0000000..6e3a13e --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/RequireTidyCode.pm @@ -0,0 +1,193 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/CodeLayout/RequireTidyCode.pm $ +# $Date: 2008-07-04 10:33:13 -0500 (Fri, 04 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2490 $ +############################################################################## + +package Perl::Critic::Policy::CodeLayout::RequireTidyCode; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use English qw(-no_match_vars); +use Perl::Critic::Utils qw{ :booleans :characters :severities }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Code is not tidy}; +Readonly::Scalar my $EXPL => [ 33 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { + return ( + { + name => 'perltidyrc', + description => 'The Perl::Tidy configuration file to use, if any.', + default_string => undef, + }, + ); +} + +sub default_severity { return $SEVERITY_LOWEST } +sub default_themes { return qw(core pbp cosmetic) } +sub applies_to { return 'PPI::Document' } + +#----------------------------------------------------------------------------- + +sub initialize_if_enabled { + my ($self, $config) = @_; + + # workaround for Test::Without::Module v0.11 + local $EVAL_ERROR = undef; + + # If Perl::Tidy is missing, bow out. + eval { require Perl::Tidy; } or return $FALSE; + + #Set configuration if defined + if (defined $self->{_perltidyrc} && $self->{_perltidyrc} eq $EMPTY) { + $self->{_perltidyrc} = \$EMPTY; + } + + return $TRUE; +} + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, $doc ) = @_; + + # Perl::Tidy seems to produce slightly different output, depending + # on the trailing whitespace in the input. As best I can tell, + # Perl::Tidy will truncate any extra trailing newlines, and if the + # input has no trailing newline, then it adds one. But when you + # re-run it through Perl::Tidy here, that final newline gets lost, + # which causes the policy to insist that the code is not tidy. + # This only occurs when Perl::Tidy is writing the output to a + # scalar, but does not occur when writing to a file. I may + # investigate further, but for now, this seems to do the trick. + + my $source = $doc->serialize(); + $source =~ s{ \s+ \Z}{\n}mx; + + # Remove the shell fix code from the top of program, if applicable + ## no critic(ProhibitComplexRegexes) + my $shebang_re = qr< [#]! [^\015\012]+ [\015\012]+ >xms; + my $shell_re = qrxms; + $source =~ s/\A ($shebang_re) $shell_re /$1/xms; + + my $dest = $EMPTY; + my $stderr = $EMPTY; + + + # Perl::Tidy gets confused if @ARGV has arguments from + # another program. Also, we need to override the + # stdout and stderr redirects that the user may have + # configured in their .perltidyrc file. + local @ARGV = qw(-nst -nse); ## no critic + + # Trap Perl::Tidy errors, just in case it dies + my $eval_worked = eval { + Perl::Tidy::perltidy( + source => \$source, + destination => \$dest, + stderr => \$stderr, + defined $self->{_perltidyrc} ? (perltidyrc => $self->{_perltidyrc}) : (), + ); + 1; + }; + + if ($stderr or not $eval_worked) { + # Looks like perltidy had problems + return $self->violation( 'perltidy had errors!!', $EXPL, $elem ); + } + + if ( $source ne $dest ) { + return $self->violation( $DESC, $EXPL, $elem ); + } + + return; #ok! +} + +1; + +#----------------------------------------------------------------------------- + +__END__ + +=pod + +=head1 NAME + +Perl::Critic::Policy::CodeLayout::RequireTidyCode - Must run code through L. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Conway does make specific recommendations for whitespace and +curly-braces in your code, but the most important thing is to adopt a +consistent layout, regardless of the specifics. And the easiest way +to do that is to use L. This policy will complain if +you're code hasn't been run through Perl::Tidy. + +=head1 CONFIGURATION + +This policy can be configured to tell Perl::Tidy to use a particular +F file or no configuration at all. By default, Perl::Tidy is told +to look in its default location for configuration. Perl::Critic can be told to +tell Perl::Tidy to use a specific configuration file by putting an entry in a +F<.perlcriticrc> file like this: + + [CodeLayout::RequireTidyCode] + perltidyrc = /usr/share/perltidy.conf + +As a special case, setting C to the empty string tells +Perl::Tidy not to load any configuration file at all and just use +Perl::Tidy's own default style. + + [CodeLayout::RequireTidyCode] + perltidyrc = + +=head1 NOTES + +L is not included in the Perl::Critic distribution. The +latest version of Perl::Tidy can be downloaded from CPAN. If +Perl::Tidy is not installed, this policy is silently ignored. + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/RequireTrailingCommas.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/RequireTrailingCommas.pm new file mode 100644 index 0000000..164a28a --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/CodeLayout/RequireTrailingCommas.pm @@ -0,0 +1,126 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/CodeLayout/RequireTrailingCommas.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::CodeLayout::RequireTrailingCommas; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :characters :severities }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{List declaration without trailing comma}; +Readonly::Scalar my $EXPL => [ 17 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_LOWEST } +sub default_themes { return qw(core pbp cosmetic) } +sub applies_to { return 'PPI::Structure::List' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + $elem =~ m{ \n }mx || return; + + # Is it an assignment of some kind? + my $sib = $elem->sprevious_sibling(); + return if !$sib; + $sib->isa('PPI::Token::Operator') && $sib =~ m{ = }mx || return; + + # List elements are children of an expression + my $expr = $elem->schild(0); + return if !$expr; + + # Does the list have more than 1 element? + # This means list element, not PPI element. + my @children = $expr->schildren(); + return if 1 >= grep { $_->isa('PPI::Token::Operator') + && $_ eq $COMMA } @children; + + # Is the final element a comma? + my $final = $children[-1]; + if ( ! ($final->isa('PPI::Token::Operator') && $final eq $COMMA) ) { + return $self->violation( $DESC, $EXPL, $elem ); + } + + return; #ok! +} + +1; + +__END__ + +=pod + +=head1 NAME + +Perl::Critic::Policy::CodeLayout::RequireTrailingCommas - Put a comma at the end of every multi-line list declaration, including the last one. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Conway suggests that all elements in a multi-line list should be +separated by commas, including the last element. This makes it a +little easier to re-order the list by cutting and pasting. + + my @list = ($foo, + $bar, + $baz); #not ok + + my @list = ($foo, + $bar, + $baz,); #ok + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 NOTES + +In the PPI parlance, a "list" is almost anything with parentheses. +I've tried to make this Policy smart by targeting only "lists" that +have at least one element and are being assigned to something. +However, there may be some edge cases that I haven't covered. If you +find one, send me a note. + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitCStyleForLoops.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitCStyleForLoops.pm new file mode 100644 index 0000000..8520928 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitCStyleForLoops.pm @@ -0,0 +1,109 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/ControlStructures/ProhibitCStyleForLoops.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::ControlStructures::ProhibitCStyleForLoops; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :characters :severities }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{C-style "for" loop used}; +Readonly::Scalar my $EXPL => [ 100 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_LOW } +sub default_themes { return qw( core pbp maintenance ) } +sub applies_to { return 'PPI::Structure::ForLoop' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + if ( _is_cstyle($elem) ) { + return $self->violation( $DESC, $EXPL, $elem ); + } + return; #ok! +} + +sub _is_cstyle { + my $elem = shift; + my $nodes_ref = $elem->find('PPI::Token::Structure'); + return if !$nodes_ref; + my @semis = grep { $_ eq $SCOLON } @{$nodes_ref}; + return scalar @semis == 2; +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::ControlStructures::ProhibitCStyleForLoops - Write C instead of C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +The 3-part C loop that Perl inherits from C is butt-ugly, and only +really necessary if you need irregular counting. The very Perlish +C<..> operator is much more elegant and readable. + + for($i=0; $i<=$max; $i++){ #ick! + do_something($i); + } + + for(0..$max){ #very nice + do_something($_); + } + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitCascadingIfElse.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitCascadingIfElse.pm new file mode 100644 index 0000000..21fc1c2 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitCascadingIfElse.pm @@ -0,0 +1,133 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/ControlStructures/ProhibitCascadingIfElse.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::ControlStructures::ProhibitCascadingIfElse; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Cascading if-elsif chain}; +Readonly::Scalar my $EXPL => [ 117, 118 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { + return ( + { + name => 'max_elsif', + description => 'The maximum number of alternatives that will be allowed.', + default_string => '2', + behavior => 'integer', + integer_minimum => 1, + }, + ); +} + +sub default_severity { return $SEVERITY_MEDIUM } +sub default_themes { return qw( core pbp maintenance complexity ) } +sub applies_to { return 'PPI::Statement::Compound' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + return if ($elem->type() ne 'if'); + + if ( _count_elsifs($elem) > $self->{_max_elsif} ) { + return $self->violation( $DESC, $EXPL, $elem ); + } + return; #ok! +} + +sub _count_elsifs { + my $elem = shift; + return + grep { $_->isa('PPI::Token::Word') && $_ eq 'elsif' } $elem->schildren(); +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords lookup + +=head1 NAME + +Perl::Critic::Policy::ControlStructures::ProhibitCascadingIfElse - Don't write long "if-elsif-elsif-elsif-elsif...else" chains. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Long C chains are hard to digest, especially if they are +longer than a single page or screen. If testing for equality, use a +hash lookup instead. See L for another approach. + + if ($condition1) { #ok + $foo = 1; + } + elsif ($condition2) { #ok + $foo = 2; + } + elsif ($condition3) { #ok + $foo = 3; + } + elsif ($condition4) { #too many! + $foo = 4; + } + else { #ok + $foo = $default; + } + +=head1 CONFIGURATION + +This policy can be configured with a maximum number of C alternatives +to allow. The default is 2. This can be specified via a C item in +the F<.perlcriticrc> file: + + [ControlStructures::ProhibitCascadingIfElse] + max_elsif = 3 + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitDeepNests.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitDeepNests.pm new file mode 100644 index 0000000..f30dcb5 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitDeepNests.pm @@ -0,0 +1,124 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/ControlStructures/ProhibitDeepNests.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::ControlStructures::ProhibitDeepNests; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Code structure is deeply nested}; +Readonly::Scalar my $EXPL => q{Consider refactoring}; + +#----------------------------------------------------------------------------- + +sub supported_parameters { + return ( + { + name => 'max_nests', + description => 'The maximum number of nested constructs to allow.', + default_string => '5', + behavior => 'integer', + integer_minimum => 1, + }, + ); +} + +sub default_severity { return $SEVERITY_MEDIUM } +sub default_themes { return qw(core maintenance complexity) } +sub applies_to { return 'PPI::Statement::Compound' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + my $nest_count = 1; #For _this_ element + my $parent = $elem; + + while ( $parent = $parent->parent() ){ + if( $parent->isa('PPI::Statement::Compound') ) { + $nest_count++; + } + } + + if ( $nest_count > $self->{_max_nests} ) { + return $self->violation( $DESC, $EXPL, $elem ); + } + return; #ok! +} + + +1; + +__END__ + + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords refactored + +=head1 NAME + +Perl::Critic::Policy::ControlStructures::ProhibitDeepNests - Don't write deeply nested loops and conditionals. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 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". + + +=head1 CONFIGURATION + +The maximum number of nested control structures can be configured via a value +for C in a F<.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 F<.perlcriticrc> +file looks like this: + + [ControlStructures::ProhibitDeepNests] + max_nests = 3 + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitLabelsWithSpecialBlockNames.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitLabelsWithSpecialBlockNames.pm new file mode 100644 index 0000000..13c6fa9 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitLabelsWithSpecialBlockNames.pm @@ -0,0 +1,124 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/ControlStructures/ProhibitLabelsWithSpecialBlockNames.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames; + +use 5.006001; +use strict; +use warnings; + +use Readonly; + +use Perl::Critic::Utils qw{ :severities hashify }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +Readonly::Hash my %SPECIAL_BLOCK_NAMES => + hashify( qw< BEGIN END INIT CHECK UNITCHECK > ); + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q; +Readonly::Scalar my $EXPL => + q; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_HIGH } +sub default_themes { return qw< core bugs > } +sub applies_to { return qw< PPI::Token::Label > } + +#----------------------------------------------------------------------------- + +sub violates { + my ($self, $elem, undef) = @_; + + # Does the function call have enough arguments? + my $label = $elem->content(); + $label =~ s/ \s* : \z //xms; + return if not $SPECIAL_BLOCK_NAMES{ $label }; + + return $self->violation( $DESC, $EXPL, $elem ); +} + + +1; + +#----------------------------------------------------------------------------- + +__END__ + +=for stopwords Lauen O'Regan + +=pod + +=head1 NAME + +Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames - Don't use labels that are the same as the special block names. + + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +When using one of the special Perl blocks C, C, C, +C, and C, it is easy to mistakenly add a colon to the +end of the block name. E.g.: + + # a BEGIN block that gets executed at compile time. + BEGIN { <...code...> } + + # an ordinary labeled block that gets executed at run time. + BEGIN: { <...code...> } + +The labels "BEGIN:", "END:", etc. are probably errors. This policy +prohibits the special Perl block names from being used as labels. + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 SEE ALSO + +L +on this issue. + + +=head1 ACKNOWLEDGMENT + +Randy Lauen for identifying the problem. + + +=head1 AUTHOR + +Mike O'Regan + + +=head1 COPYRIGHT + +Copyright (c) 2008 Mike O'Regan. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitMutatingListFunctions.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitMutatingListFunctions.pm new file mode 100644 index 0000000..5f054be --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitMutatingListFunctions.pm @@ -0,0 +1,308 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/ControlStructures/ProhibitMutatingListFunctions.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::ControlStructures::ProhibitMutatingListFunctions; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use List::MoreUtils qw( none any ); + +use Perl::Critic::Utils qw{ + :booleans :characters :severities :data_conversion :classification :ppi +}; + +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Array my @BUILTIN_LIST_FUNCS => qw( map grep ); +Readonly::Array my @CPAN_LIST_FUNCS => _get_cpan_list_funcs(); + +#----------------------------------------------------------------------------- + +sub _get_cpan_list_funcs { + return qw( List::Util::first ), + map { 'List::MoreUtils::'.$_ } _get_list_moreutils_funcs(); +} + +#----------------------------------------------------------------------------- + +sub _get_list_moreutils_funcs { + return qw(any all none notall true false firstidx first_index + lastidx last_index insert_after insert_after_string); +} + +#----------------------------------------------------------------------------- + +sub _is_topic { + my $elem = shift; + return defined $elem + && $elem->isa('PPI::Token::Magic') + && $elem eq q{$_}; ##no critic (InterpolationOfMetachars) +} + + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Don't modify $_ in list functions}; ##no critic (InterpolationOfMetachars) +Readonly::Scalar my $EXPL => [ 114 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { + return ( + { + name => 'list_funcs', + description => 'The base set of functions to check.', + default_string => join ($SPACE, @BUILTIN_LIST_FUNCS, @CPAN_LIST_FUNCS ), + behavior => 'string list', + }, + { + name => 'add_list_funcs', + description => 'The set of functions to check, in addition to those given in list_funcs.', + default_string => $EMPTY, + behavior => 'string list', + }, + ); +} + +sub default_severity { return $SEVERITY_HIGHEST } +sub default_themes { return qw(core bugs pbp) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub initialize_if_enabled { + my ($self, $config) = @_; + + $self->{_all_list_funcs} = { + hashify keys %{ $self->{_list_funcs} }, keys %{ $self->{_add_list_funcs} } + }; + + return $TRUE; +} + +#----------------------------------------------------------------------------- + +sub violates { + my ($self, $elem, $doc) = @_; + + # Is this element a list function? + return if not $self->{_all_list_funcs}->{$elem}; + return if not is_function_call($elem); + + # Only the block form of list functions can be analyzed. + return if not my $first_arg = first_arg( $elem ); + return if not $first_arg->isa('PPI::Structure::Block'); + return if not _has_topic_side_effect( $first_arg ); + + # Must be a violation + return $self->violation( $DESC, $EXPL, $elem ); +} + +#----------------------------------------------------------------------------- + +sub _has_topic_side_effect { + my $node = shift; + + # Search through all significant elements in the block, + # testing each element to see if it mutates the topic. + my $tokens = $node->find( 'PPI::Token' ) || []; + for my $elem ( @{ $tokens } ) { + next if not $elem->significant(); + return 1 if _is_assignment_to_topic( $elem ); + return 1 if _is_topic_mutating_regex( $elem ); + return 1 if _is_topic_mutating_func( $elem ); + return 1 if _is_topic_mutating_substr( $elem ); + } + return; +} + +#----------------------------------------------------------------------------- + +sub _is_assignment_to_topic { + my $elem = shift; + return if not _is_topic( $elem ); + + my $sib = $elem->snext_sibling(); + if ($sib && $sib->isa('PPI::Token::Operator')) { + return 1 if _is_assignment_operator( $sib ); + } + + my $psib = $elem->sprevious_sibling(); + if ($psib && $psib->isa('PPI::Token::Operator')) { + return 1 if _is_increment_operator( $psib ); + } + + return; +} + +#----------------------------------------------------------------------------- + +sub _is_topic_mutating_regex { + my $elem = shift; + return if ! ( $elem->isa('PPI::Token::Regexp::Substitute') + || $elem->isa('PPI::Token::Regexp::Transliterate') ); + + # If the previous sibling does not exist, then + # the regex implicitly binds to $_ + my $prevsib = $elem->sprevious_sibling; + return 1 if not $prevsib; + + # If the previous sibling does exist, then it + # should be a binding operator. + return 1 if not _is_binding_operator( $prevsib ); + + # Check if the sibling before the biding operator + # is explicitly set to $_ + my $bound_to = $prevsib->sprevious_sibling; + return _is_topic( $bound_to ); +} + +#----------------------------------------------------------------------------- + +sub _is_topic_mutating_func { + my $elem = shift; + return if not $elem->isa('PPI::Token::Word'); + my @mutator_funcs = qw(chop chomp undef); + return if not any { $elem eq $_ } @mutator_funcs; + return if not is_function_call( $elem ); + + # If these functions have no argument, + # they default to mutating $_ + my $first_arg = first_arg( $elem ); + if (not defined $first_arg) { + # undef does not default to $_, unlike the others + return if $elem eq 'undef'; + return 1; + } + return _is_topic( $first_arg ); +} + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $MUTATING_SUBSTR_ARG_COUNT => 4; + +sub _is_topic_mutating_substr { + my $elem = shift; + return if $elem ne 'substr'; + return if not is_function_call( $elem ); + + # check and see if the first arg is $_ + my @args = parse_arg_list( $elem ); + return @args >= $MUTATING_SUBSTR_ARG_COUNT && _is_topic( $args[0]->[0] ); +} + +#----------------------------------------------------------------------------- + +{ + ##no critic(ArgUnpacking) + + my %assignment_ops = hashify qw( = *= /= += -= %= **= x= .= &= |= ^= &&= ||= ++ -- ); + sub _is_assignment_operator { return exists $assignment_ops{$_[0]} } + + my %increment_ops = hashify qw( ++ -- ); + sub _is_increment_operator { return exists $increment_ops{$_[0]} } + + my %binding_ops = hashify qw( =~ !~ ); + sub _is_binding_operator { return exists $binding_ops{$_[0]} } +} + +1; + +#----------------------------------------------------------------------------- + +__END__ + +=pod + +=head1 NAME + +Perl::Critic::Policy::ControlStructures::ProhibitMutatingListFunctions - Don't modify C<$_> in list functions. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +C, C and other list operators are intended to transform arrays into +other arrays by applying code to the array elements one by one. For speed, +the elements are referenced via a C<$_> alias rather than copying them. As a +consequence, if the code block of the C or C modify C<$_> in any +way, then it is actually modifying the source array. This IS technically +allowed, but those side effects can be quite surprising, especially when the +array being passed is C<@_> or perhaps C! Instead authors +should restrict in-place array modification to C +constructs instead, or use C. + +=head1 CONFIGURATION + +By default, this policy applies to the following list functions: + + map grep + List::Util qw(first) + List::MoreUtils qw(any all none notall true false firstidx first_index + lastidx last_index insert_after insert_after_string) + +This list can be overridden the F<.perlcriticrc> file like this: + + [ControlStructures::ProhibitMutatingListFunctions] + list_funcs = map grep List::Util::first + +Or, one can just append to the list like so: + + [ControlStructures::ProhibitMutatingListFunctions] + add_list_funcs = Foo::Bar::listmunge + +=head1 LIMITATIONS + +This policy deliberately does not apply to C or +C. + +Currently, the policy only detects explicit external module usage like this: + + my @out = List::MoreUtils::any {s/^foo//} @in; + +and not like this: + + use List::MoreUtils qw(any); + my @out = any {s/^foo//} @in; + +This policy looks only for modifications of C<$_>. Other naughtiness could +include modifying C<$a> and C<$b> in C and the like. That's beyond the +scope of this policy. + +=head1 AUTHOR + +Chris Dolan + +Michael Wolf + +=head1 COPYRIGHT + +Copyright (C) 2006 Chris Dolan. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : + diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.pm new file mode 100644 index 0000000..ddd4681 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.pm @@ -0,0 +1,208 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions; + +use 5.006001; +use strict; +use warnings; +use English qw(-no_match_vars); +use Readonly; + +use Perl::Critic::Utils qw< :characters :severities :classification hashify >; + +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $EXPL => [99]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return qw< > } +sub default_severity { return $SEVERITY_MEDIUM } +sub default_themes { return qw( core maintenance ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $token, undef ) = @_; + + return if $token ne 'until' && $token ne 'unless'; + + return if is_hash_key($token); + return if is_subroutine_name($token); + return if is_method_call($token); + return if is_included_module_name($token); + + return + map + { $self->_violation_for_operator( $_, $token ) } + _get_negative_operators( $token ); +} + +#----------------------------------------------------------------------------- + +sub _get_negative_operators { + my ($token) = @_; + + my @operators; + foreach my $element ( _get_condition_elements($token) ) { + if ( $element->isa('PPI::Node') ) { + my $operators = $element->find( \&_is_negative_operator ); + if ($operators) { + push @operators, @{$operators}; + } + } + else { + if ( _is_negative_operator( undef, $element ) ) { + push @operators, $element; + } + } + } + + return @operators; +} + +#----------------------------------------------------------------------------- + +sub _get_condition_elements { + my ($token) = @_; + + my $statement = $token->statement(); + return if not $statement; + + if ($statement->isa('PPI::Statement::Compound')) { + my $condition = $token->snext_sibling(); + + return if not $condition; + return if not $condition->isa('PPI::Structure::Condition'); + + return ( $condition ); + } + + my @condition_elements; + my $element = $token; + while ( + $element = $element->snext_sibling() + and $element ne $SCOLON + ) { + push @condition_elements, $element; + } + + return @condition_elements; +} + +#----------------------------------------------------------------------------- + +Readonly::Hash my %NEGATIVE_OPERATORS => hashify( + qw/ + ! not + !~ ne != + < > <= >= <=> + lt gt le ge cmp + / +); + +sub _is_negative_operator { + my (undef, $element) = @_; + + return + $element->isa('PPI::Token::Operator') + && $NEGATIVE_OPERATORS{$element}; +} + +#----------------------------------------------------------------------------- + +sub _violation_for_operator { + my ($self, $operator, $control_structure) = @_; + + return + $self->violation( + qq, + $EXPL, + $control_structure, + ); +} + +1; + +#----------------------------------------------------------------------------- + +__END__ + +=pod + +=for stopwords + +=head1 NAME + +Perl::Critic::Policy::ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions - Don't use operators like C, C, and C within C and C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + + until ($foo ne 'blah') { #not ok + ... + } + + while ($foo eq 'blah') { #ok + ... + } + +A number of people have problems figuring out the meaning of doubly +negated expressions. C and C are both negative +constructs, so any negative (e.g. C) or reversible operators (e.g. +C) included in their conditional expressions are double negations. +Conway considers the following operators to be difficult to understand +within C and C: + + ! not + !~ ne != + < > <= >= <=> + lt gt le ge cmp + + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +Elliot Shank C<< >> + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Elliot Shank. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitPostfixControls.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitPostfixControls.pm new file mode 100644 index 0000000..acf740d --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitPostfixControls.pm @@ -0,0 +1,191 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/ControlStructures/ProhibitPostfixControls.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::ControlStructures::ProhibitPostfixControls; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :characters :severities :data_conversion :classification }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Hash my %PAGES_OF => ( + if => [ 93, 94 ], + unless => [ 96, 97 ], + until => [ 96, 97 ], + for => [ 96 ], + foreach => [ 96 ], + while => [ 96 ], +); + +# These functions can have postfix 'if'. +my @DEFAULT_FLOW_CONTROL = qw( warn die carp croak cluck confess goto exit ); + +#----------------------------------------------------------------------------- + +sub supported_parameters { + return ( + { + name => 'allow', + description => 'The permitted postfix controls.', + default_string => $EMPTY, + behavior => 'enumeration', + enumeration_values => [ sort keys %PAGES_OF ], + enumeration_allow_multiple_values => 1, + }, + { + name => 'flowcontrol', + description => 'The exempt flow control functions.', + default_string => 'carp cluck confess croak die exit goto warn', + behavior => 'string list', + }, + ); +} + +sub default_severity { return $SEVERITY_LOW } +sub default_themes { return qw(core pbp cosmetic) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + my $expl = $PAGES_OF{$elem}; + return if not $expl; + + return if is_hash_key($elem); + return if is_method_call($elem); + return if is_subroutine_name($elem); + return if is_included_module_name($elem); + return if is_package_declaration($elem); + + # Skip controls that are allowed + return if exists $self->{_allow}->{$elem}; + + # Skip Compound variety (these are good) + my $stmnt = $elem->statement(); + return if !$stmnt; + return if $stmnt->isa('PPI::Statement::Compound'); + + # Handle special cases + if ( $elem eq 'if' ) { + # Postfix 'if' allowed with loop breaks, or other + # flow-controls like 'die', 'warn', and 'croak' + return if $stmnt->isa('PPI::Statement::Break'); + return if defined $self->{_flowcontrol}{ $stmnt->schild(0) }; + } + + # If we get here, it must be postfix. + my $desc = qq{Postfix control "$elem" used}; + return $self->violation( $desc, $expl, $elem ); +} + +1; + +__END__ + +=pod + +=for stopwords flowcontrol + +=head1 NAME + +Perl::Critic::Policy::ControlStructures::ProhibitPostfixControls - Write C instead of C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Conway discourages using postfix control structures (C, C, +C, C, C) because they hide control flow. The +C and C controls are particularly evil because they +lead to double-negatives that are hard to comprehend. The only +tolerable usage of a postfix C is when it follows a loop break +such as C, C, C, or C. + + do_something() if $condition; #not ok + if($condition){ do_something() } #ok + + do_something() while $condition; #not ok + while($condition){ do_something() } #ok + + do_something() unless $condition; #not ok + do_something() unless ! $condition; #really bad + if(! $condition){ do_something() } #ok + + do_something() until $condition; #not ok + do_something() until ! $condition; #really bad + while(! $condition){ do_something() } #ok + + do_something($_) for @list; #not ok + + LOOP: + for my $n (0..100){ + next if $condition; #ok + last LOOP if $other_condition; #also ok + } + +=head1 CONFIGURATION + +A set of constructs to be ignored by this policy can specified by +giving a value for 'allow' of a string of space-delimited keywords: +C, C, C, C, and/or C. An example of +specifying allowed flow-control structures in a F<.perlcriticrc> file: + + [ControlStructures::ProhibitPostfixControls] + allow = for if until + +By default, all postfix control keywords are prohibited. + +The set of flow-control functions that are exempt from the restriction +can also be configured with the 'flowcontrol' directive in your +F<.perlcriticrc> file: + + [ControlStructures::ProhibitPostfixControls] + flowcontrol = warn die carp croak cluck confess goto exit + +=head1 NOTES + +The C, C, and C functions are frequently used as +flow-controls just like C or C. So this Policy does +permit you to use a postfix C when the statement begins with one +of those functions. It is also pretty common to use C, C, +and C with a postfix C, so those are allowed too. + + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitUnlessBlocks.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitUnlessBlocks.pm new file mode 100644 index 0000000..6c60eff --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitUnlessBlocks.pm @@ -0,0 +1,103 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/ControlStructures/ProhibitUnlessBlocks.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::ControlStructures::ProhibitUnlessBlocks; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{"unless" block used}; +Readonly::Scalar my $EXPL => [ 97 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_LOW } +sub default_themes { return qw(core pbp cosmetic) } +sub applies_to { return 'PPI::Statement::Compound' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + if ( $elem->first_element() eq 'unless' ) { + return $self->violation( $DESC, $EXPL, $elem ); + } + return; #ok! +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::ControlStructures::ProhibitUnlessBlocks - Write C instead of C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Conway discourages using C because it leads to double-negatives +that are hard to understand. Instead, reverse the logic and use C. + + unless($condition) { do_something() } #not ok + unless(! $no_flag) { do_something() } #really bad + if( ! $condition) { do_something() } #ok + +This Policy only covers the block-form of C. For the postfix +variety, see C. + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitUnreachableCode.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitUnreachableCode.pm new file mode 100644 index 0000000..482b75d --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitUnreachableCode.pm @@ -0,0 +1,222 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/ControlStructures/ProhibitUnreachableCode.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::ControlStructures::ProhibitUnreachableCode; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :data_conversion :classification }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +Readonly::Array my @TERMINALS => qw( die exit croak confess ); +Readonly::Hash my %TERMINALS => hashify( @TERMINALS ); + +Readonly::Array my @CONDITIONALS => qw( if unless foreach while until for ); +Readonly::Hash my %CONDITIONALS => hashify( @CONDITIONALS ); + +Readonly::Array my @OPERATORS => qw( && || // and or err ? ); +Readonly::Hash my %OPERATORS => hashify( @OPERATORS ); + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Unreachable code}; +Readonly::Scalar my $EXPL => q{Consider removing it}; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_HIGH } +sub default_themes { return qw( core bugs ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + return if ! is_function_call($elem); + + my $stmnt = $elem->statement(); + return if !$stmnt; + return if ( !exists $TERMINALS{$elem} ) && + ( !$stmnt->isa('PPI::Statement::Break') ); + + # Scan the enclosing statement for conditional keywords or logical + # operators. If any are found, then this the folowing statements + # could _potentially_ be executed, so this policy is satisfied. + + # NOTE: When the first operand in an boolean expression is + # C or C, etc., the second operand is technically + # unreachable. But this policy doesn't catch that situation. + + for my $child ( $stmnt->schildren() ) { + return if $child->isa('PPI::Token::Operator') && exists $OPERATORS{$child}; + return if $child->isa('PPI::Token::Word') && exists $CONDITIONALS{$child}; + } + + # If we get here, then the statement contained an unconditional + # die or exit or return. Then all the subsequent sibling + # statements are unreachable, except for those that have labels, + # which could be reached from anywhere using C. Subroutine + # declarations are also exempt for the same reason. "use" and + # "our" statements are exempt because they happen at compile time. + + my @viols = (); + while ( $stmnt = $stmnt->snext_sibling() ) { + my @children = $stmnt->schildren(); + last if @children && $children[0]->isa('PPI::Token::Label'); + next if $stmnt->isa('PPI::Statement::Sub'); + next if $stmnt->isa('PPI::Statement::End'); + next if $stmnt->isa('PPI::Statement::Data'); + + next if $stmnt->isa('PPI::Statement::Include') && + $stmnt->type() ne 'require'; + + next if $stmnt->isa('PPI::Statement::Variable') && + $stmnt->type() eq 'our'; + + push @viols, $self->violation( $DESC, $EXPL, $stmnt ); + } + + return @viols; +} + +1; + +__END__ + +=pod + +=head1 NAME + +Perl::Critic::Policy::ControlStructures::ProhibitUnreachableCode - Don't write code after an unconditional C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +This policy prohibits code following a statement which unconditionally alters +the program flow. This includes calls to C, C, C, C, +C and C. Due to common usage, C and C from +L are also included. + +Code is reachable if any of the following conditions are true: + +=over 4 + +=item * Flow-altering statement has a conditional attached to it + +=item * Statement is on the right side of an operator C<&&>, C<||>, C, C, C, or C. + +=item * Code is prefixed with a label (can potentially be reached via C) + +=item * Code is a subroutine + +=back + +=head1 EXAMPLES + + # not ok + + exit; + print "123\n"; + + # ok + + exit if !$xyz; + print "123\n"; + + # not ok + + for ( 1 .. 10 ) { + next; + print 1; + } + + # ok + + for ( 1 .. 10 ) { + next if $_ == 5; + print 1; + } + + # not ok + + sub foo { + my $bar = shift; + return; + print 1; + } + + # ok + + sub foo { + my $bar = shift; + return if $bar->baz(); + print 1; + } + + + # not ok + + die; + print "123\n"; + + # ok + + die; + LABEL: print "123\n"; + + # not ok + + croak; + do_something(); + + # ok + + croak; + sub do_something {} + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +Peter Guzis + +=head1 COPYRIGHT + +Copyright (c) 2006-2008 Peter Guzis. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitUntilBlocks.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitUntilBlocks.pm new file mode 100644 index 0000000..77a5f9a --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ControlStructures/ProhibitUntilBlocks.pm @@ -0,0 +1,102 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/ControlStructures/ProhibitUntilBlocks.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::ControlStructures::ProhibitUntilBlocks; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{"until" block used}; +Readonly::Scalar my $EXPL => [ 97 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_LOW } +sub default_themes { return qw(core pbp cosmetic) } +sub applies_to { return 'PPI::Statement' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + if ( $elem->first_element() eq 'until' ) { + return $self->violation( $DESC, $EXPL, $elem ); + } + return; #ok! +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::ControlStructures::ProhibitUntilBlocks - Write C instead of C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Conway discourages using C because it leads to double-negatives +that are hard to understand. Instead, reverse the logic and use C. + + 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 C. For the postfix +variety, see C. + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Documentation/PodSpelling.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Documentation/PodSpelling.pm new file mode 100644 index 0000000..9460134 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Documentation/PodSpelling.pm @@ -0,0 +1,335 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/Documentation/PodSpelling.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::Documentation::PodSpelling; + +use 5.006001; +use strict; +use warnings; + +use English qw(-no_match_vars); +use Readonly; + +use File::Spec; +use File::Temp; +use List::MoreUtils qw(uniq); + +use Perl::Critic::Utils qw{ + :characters + :booleans + :severities + words_from_string +}; +use Perl::Critic::Exception::Fatal::Generic qw{ throw_generic }; + +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $POD_RX => qr{\A = (?: for|begin|end ) }mx; +Readonly::Scalar my $DESC => q{Check the spelling in your POD}; +Readonly::Scalar my $EXPL => [148]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { + return ( + { + name => 'spell_command', + description => 'The command to invoke to check spelling.', + default_string => 'aspell list', + behavior => 'string', + }, + { + name => 'stop_words', + description => 'The words to not consider as misspelled.', + default_string => $EMPTY, + behavior => 'string list', + }, + ); +} + +sub default_severity { return $SEVERITY_LOWEST } +sub default_themes { return qw( core cosmetic pbp ) } +sub applies_to { return 'PPI::Document' } + +#----------------------------------------------------------------------------- + +my $got_sigpipe = 0; +sub got_sigpipe { + return $got_sigpipe; +} + +#----------------------------------------------------------------------------- + +sub initialize_if_enabled { + my ( $self, $config ) = @_; + + eval { + require File::Which; + require Text::ParseWords; + require Pod::Spell; + require IO::String; + } + or return $FALSE; + + return $FALSE if not $self->_derive_spell_command_line(); + + return $FALSE if not $self->_run_spell_command( <<'END_TEST_CODE' ); +=pod + +=head1 Test The Spell Command + +=cut +END_TEST_CODE + + return $TRUE; +} + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, $doc ) = @_; + + my $code = $doc->serialize(); + + my $words = $self->_run_spell_command($code); + + return if not $words; # error running spell command + + return if not @{$words}; # no problems found + + return $self->violation( "$DESC: @{$words}", $EXPL, $doc ); +} + +#----------------------------------------------------------------------------- + +sub _derive_spell_command_line { + my ($self) = @_; + + my @words = Text::ParseWords::shellwords($self->_get_spell_command()); + if (!@words) { + return; + } + if (! File::Spec->file_name_is_absolute($words[0])) { + $words[0] = File::Which::which($words[0]); + } + if (! $words[0] || ! -x $words[0]) { + return; + } + $self->_set_spell_command_line(\@words); + + return $self->_get_spell_command_line(); +} + +#----------------------------------------------------------------------------- + +sub _get_spell_command { + my ( $self ) = @_; + + return $self->{_spell_command}; +} + +sub _set_spell_command { + my ( $self, $spell_command ) = @_; + + $self->{_spell_command} = $spell_command; + + return; +} + +#----------------------------------------------------------------------------- + +sub _get_spell_command_line { + my ( $self ) = @_; + + return $self->{_spell_command_line}; +} + +sub _set_spell_command_line { + my ( $self, $spell_command_line ) = @_; + + $self->{_spell_command_line} = $spell_command_line; + + return; +} + +#----------------------------------------------------------------------------- + +sub _get_stop_words { + my ( $self ) = @_; + + return $self->{_stop_words}; +} + +sub _set_stop_words { + my ( $self, $stop_words ) = @_; + + $self->{_stop_words} = $stop_words; + + return; +} + +#----------------------------------------------------------------------------- + +sub _run_spell_command { + my ($self, $code) = @_; + + my $infh = IO::String->new( $code ); + + my $outfh = File::Temp->new() + or throw_generic "Unable to create tempfile: $OS_ERROR"; + + my $outfile = $outfh->filename(); + my @words; + + local $EVAL_ERROR = undef; + + eval { + # temporarily add our special wordlist to this annoying global + local %Pod::Wordlist::Wordlist = ##no critic(ProhibitPackageVars) + %{ $self->_get_stop_words() }; + + Pod::Spell->new()->parse_from_filehandle($infh, $outfh); + close $outfh or throw_generic "Failed to close pod temp file: $OS_ERROR"; + return if not -s $outfile; # Bail out if no words to spellcheck + + # run spell command and fetch output + local $SIG{PIPE} = sub { $got_sigpipe = 1; }; + my $command_line = join $SPACE, @{$self->_get_spell_command_line()}; + open my $aspell_out_fh, q{-|}, "$command_line < $outfile" ## Is this portable?? + or throw_generic "Failed to open handle to spelling program: $OS_ERROR"; + + @words = uniq( <$aspell_out_fh> ); + close $aspell_out_fh + or throw_generic "Failed to close handle to spelling program: $OS_ERROR"; + + for (@words) { + chomp; + } + + # Why is this extra step needed??? + @words = grep { not exists $Pod::Wordlist::Wordlist{$_} } @words; ## no critic(ProhibitPackageVars) + 1; + } + or do { + # Eat anything we did ourselves above, propagate anything else. + if ( + $EVAL_ERROR + and not ref Perl::Critic::Exception::Fatal::Generic->caught() + ) { + ref $EVAL_ERROR ? $EVAL_ERROR->rethrow() : die $EVAL_ERROR; ## no critic (ErrorHandling::RequireCarping) + } + + return; + }; + + return [ @words ]; +} + +#----------------------------------------------------------------------------- + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords Hmm stopwords + +=head1 NAME + +Perl::Critic::Policy::Documentation::PodSpelling - Check your spelling. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Did you write the documentation? Check. + +Did you document all of the public methods? Check. + +Is your documentation readable? Hmm... + +Ideally, we'd like Perl::Critic to tell you when your documentation is +inadequate. That's hard to code, though. So, inspired by +L, this module checks the spelling of your POD. It +does this by pulling the prose out of the code and passing it to an +external spell checker. It skips over words you flagged to ignore. +If the spell checker returns any misspelled words, this policy emits a +violation. + +If anything else goes wrong -- you don't have Pod::Spell installed or +we can't locate the spell checking program or (gasp!) your module has +no POD -- then this policy passes. + +To add exceptions on a module-by-module basis, add "stopwords" as +described in L. For example: + + =for stopword gibbles + + =head1 Gibble::Manip -- manipulate your gibbles + + =cut + +=head1 CONFIGURATION + +This policy can be configured to tell which spell checker to use or to +set a global list of spelling exceptions. To do this, put entries in +a F<.perlcriticrc> file like this: + + [Documentation::PodSpelling] + spell_command = aspell list + stop_words = gibbles foobar + +The default spell command is C and it is interpreted as a +shell command. We parse the individual arguments via +L so feel free to use quotes around your arguments. +If the executable path is an absolute file name, it is used as-is. If +it is a relative file name, we employ L to convert it to +an absolute path via the C environment variable. As described +in Pod::Spell and Test::Spelling, the spell checker must accept text +on STDIN and print misspelled words one per line on STDOUT. + +=head1 NOTES + +L is not included with Perl::Critic, nor is a spell +checking program. + +=head1 CREDITS + +Initial development of this policy was supported by a grant from the Perl Foundation. + +=head1 AUTHOR + +Chris Dolan + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Chris Dolan. Many 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 + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Documentation/RequirePackageMatchesPodName.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Documentation/RequirePackageMatchesPodName.pm new file mode 100644 index 0000000..4c7ee6c --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Documentation/RequirePackageMatchesPodName.pm @@ -0,0 +1,115 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/Documentation/RequirePackageMatchesPodName.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::Documentation::RequirePackageMatchesPodName; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $PKG_RX => qr{ [[:alpha:]](?:[\w:\']*\w)? }mx; +Readonly::Scalar my $DESC => q{Pod NAME does not match the package declaration}; +Readonly::Scalar my $EXPL => q{}; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_LOWEST } +sub default_themes { return qw( core cosmetic ) } +sub applies_to { return 'PPI::Document' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, $doc ) = @_; + + # No POD means no violation + my $pods_ref = $doc->find('PPI::Token::Pod'); + return if !$pods_ref; + + for my $pod (@{$pods_ref}) { + my $content = $pod->content; + + next if $content !~ m{^=head1 [ \t]+ NAME [ \t]*$ \s*}cgxms; + + my ($pod_pkg) = $content =~ m{\G (\S+) }cgxms; + + if (!$pod_pkg) { + return $self->violation( $DESC, q{Empty name declaration}, $elem ); + } + + # idea: force NAME to match the file name in scripts? + return if is_script($doc); # mismatch is normal in program entry points + + # idea: worry about POD escapes? + $pod_pkg =~ s{\A [CL]<(.*)>\z}{$1}gxms; # unwrap + $pod_pkg =~ s{\'}{::}gxms; # perl4 -> perl5 + + my $pkgs = $doc->find('PPI::Statement::Package'); + # no package statement means no possible match + my $pkg = $pkgs ? $pkgs->[0]->namespace : q{}; + $pkg =~ s{\'}{::}gxms; + + return if $pkg eq $pod_pkg; + return $self->violation( $DESC, $EXPL, $pod ); + } + return; # no NAME section found +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::Documentation::RequirePackageMatchesPodName - The C<=head1 NAME> section should match the package. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + +=head1 DESCRIPTION + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + +=head1 AUTHOR + +Chris Dolan + +=head1 COPYRIGHT + +Copyright (c) 2008 Chris Dolan + +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 + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Documentation/RequirePodAtEnd.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Documentation/RequirePodAtEnd.pm new file mode 100644 index 0000000..9500b0e --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Documentation/RequirePodAtEnd.pm @@ -0,0 +1,131 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/Documentation/RequirePodAtEnd.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::Documentation::RequirePodAtEnd; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use List::Util qw(first); + +use Perl::Critic::Utils qw{ :severities }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $POD_RX => qr{\A = (?: for|begin|end ) }mx; +Readonly::Scalar my $DESC => q{POD before __END__}; +Readonly::Scalar my $EXPL => [139, 140]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_LOWEST } +sub default_themes { return qw( core cosmetic pbp ) } +sub applies_to { return 'PPI::Document' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, $doc ) = @_; + + # No POD means no violation + my $pods_ref = $doc->find('PPI::Token::Pod'); + return if !$pods_ref; + + # Look for first POD tag that isn't =for, =begin, or =end + my $pod = first { $_ !~ $POD_RX} @{ $pods_ref }; + return if !$pod; + + my $end = $doc->find_first('PPI::Statement::End'); + if ($end) { # No __END__ means definite violation + my $pod_loc = $pod->location(); + my $end_loc = $end->location(); + if ( $pod_loc->[0] > $end_loc->[0] ) { + # POD is after __END__, or relative position couldn't be determined + return; + } + } + + return $self->violation( $DESC, $EXPL, $pod ); +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::Documentation::RequirePodAtEnd - All POD should be after C<__END__>. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Perl stops processing code when it sees an C<__END__> statement. So, +to save processing time, it's faster to put +documentation after the C<__END__>. Also, writing all the POD in one +place usually leads to a more cohesive document, rather than being +forced to follow the layout of your code. This policy issues +violations if any POD is found before an C<__END__>. + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 NOTES + +Some folks like to use C<=for>, and C<=begin>, and C<=end> tags to +create block comments in-line with their code. Since those tags aren't +usually part of the documentation, this Policy does allows them to +appear before the C<__END__> statement. + + =begin comments + + frobulate() + Accepts: A list of things to frobulate + Returns: True if succesful + + =end comments + + sub frobulate { ... } + +=head1 AUTHOR + +Chris Dolan + +=head1 COPYRIGHT + +Copyright (c) 2006-2008 Chris Dolan. 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 + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Documentation/RequirePodSections.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Documentation/RequirePodSections.pm new file mode 100644 index 0000000..b0438d9 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Documentation/RequirePodSections.pm @@ -0,0 +1,477 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/Documentation/RequirePodSections.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::Documentation::RequirePodSections; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :booleans :characters :severities :classification }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $EXPL => [133, 138]; + +Readonly::Scalar my $BOOK => 'book'; +Readonly::Scalar my $BOOK_FIRST_EDITION => 'book_first_edition'; +Readonly::Scalar my $MODULE_STARTER_PBP => 'module_starter_pbp'; +Readonly::Scalar my $M_S_PBP_0_0_3 => 'module_starter_pbp_0_0_3'; + +Readonly::Scalar my $DEFAULT_SOURCE => $BOOK_FIRST_EDITION; + +my %SOURCE_TRANSLATION = ( + $BOOK => $BOOK_FIRST_EDITION, + $BOOK_FIRST_EDITION => $BOOK_FIRST_EDITION, + $MODULE_STARTER_PBP => $M_S_PBP_0_0_3, + $M_S_PBP_0_0_3 => $M_S_PBP_0_0_3, +); + +Readonly::Scalar my $EN_AU => 'en_AU'; +Readonly::Scalar my $EN_US => 'en_US'; +Readonly::Scalar my $ORIGINAL_MODULE_VERSION => 'original'; + +Readonly::Hash my %SOURCE_DEFAULT_LANGUAGE => ( + $BOOK_FIRST_EDITION => $ORIGINAL_MODULE_VERSION, + $M_S_PBP_0_0_3 => $EN_AU, +); + +Readonly::Scalar my $BOOK_FIRST_EDITION_US_LIB_SECTIONS => + [ + 'NAME', + 'VERSION', + 'SYNOPSIS', + 'DESCRIPTION', + 'SUBROUTINES/METHODS', + 'DIAGNOSTICS', + 'CONFIGURATION AND ENVIRONMENT', + 'DEPENDENCIES', + 'INCOMPATIBILITIES', + 'BUGS AND LIMITATIONS', + 'AUTHOR', + 'LICENSE AND COPYRIGHT', + ]; + +Readonly::Hash my %DEFAULT_LIB_SECTIONS => ( + $BOOK_FIRST_EDITION => { + $ORIGINAL_MODULE_VERSION => $BOOK_FIRST_EDITION_US_LIB_SECTIONS, + $EN_AU => [ + 'NAME', + 'VERSION', + 'SYNOPSIS', + 'DESCRIPTION', + 'SUBROUTINES/METHODS', + 'DIAGNOSTICS', + 'CONFIGURATION AND ENVIRONMENT', + 'DEPENDENCIES', + 'INCOMPATIBILITIES', + 'BUGS AND LIMITATIONS', + 'AUTHOR', + 'LICENCE AND COPYRIGHT', + ], + $EN_US => $BOOK_FIRST_EDITION_US_LIB_SECTIONS, + }, + $M_S_PBP_0_0_3 => { + $EN_AU => [ + 'NAME', + 'VERSION', + 'SYNOPSIS', + 'DESCRIPTION', + 'INTERFACE', + 'DIAGNOSTICS', + 'CONFIGURATION AND ENVIRONMENT', + 'DEPENDENCIES', + 'INCOMPATIBILITIES', + 'BUGS AND LIMITATIONS', + 'AUTHOR', + 'LICENCE AND COPYRIGHT', + 'DISCLAIMER OF WARRANTY', + ], + $EN_US => [ + 'NAME', + 'VERSION', + 'SYNOPSIS', + 'DESCRIPTION', + 'INTERFACE', + 'DIAGNOSTICS', + 'CONFIGURATION AND ENVIRONMENT', + 'DEPENDENCIES', + 'INCOMPATIBILITIES', + 'BUGS AND LIMITATIONS', + 'AUTHOR', + 'LICENSE AND COPYRIGHT', + 'DISCLAIMER OF WARRANTY' + ], + }, +); + +Readonly::Hash my %DEFAULT_SCRIPT_SECTIONS => ( + $BOOK_FIRST_EDITION => { + $ORIGINAL_MODULE_VERSION => [ + 'NAME', + 'USAGE', + 'DESCRIPTION', + 'REQUIRED ARGUMENTS', + 'OPTIONS', + 'DIAGNOSTICS', + 'EXIT STATUS', + 'CONFIGURATION', + 'DEPENDENCIES', + 'INCOMPATIBILITIES', + 'BUGS AND LIMITATIONS', + 'AUTHOR', + 'LICENSE AND COPYRIGHT', + ], + $EN_AU => [ + 'NAME', + 'VERSION', + 'USAGE', + 'REQUIRED ARGUMENTS', + 'OPTIONS', + 'DESCRIPTION', + 'DIAGNOSTICS', + 'CONFIGURATION AND ENVIRONMENT', + 'DEPENDENCIES', + 'INCOMPATIBILITIES', + 'BUGS AND LIMITATIONS', + 'AUTHOR', + 'LICENCE AND COPYRIGHT', + ], + $EN_US => [ + 'NAME', + 'VERSION', + 'USAGE', + 'REQUIRED ARGUMENTS', + 'OPTIONS', + 'DESCRIPTION', + 'DIAGNOSTICS', + 'CONFIGURATION AND ENVIRONMENT', + 'DEPENDENCIES', + 'INCOMPATIBILITIES', + 'BUGS AND LIMITATIONS', + 'AUTHOR', + 'LICENSE AND COPYRIGHT', + ], + }, + $M_S_PBP_0_0_3 => { + $EN_AU => [ + 'NAME', + 'VERSION', + 'USAGE', + 'REQUIRED ARGUMENTS', + 'OPTIONS', + 'DESCRIPTION', + 'DIAGNOSTICS', + 'CONFIGURATION AND ENVIRONMENT', + 'DEPENDENCIES', + 'INCOMPATIBILITIES', + 'BUGS AND LIMITATIONS', + 'AUTHOR', + 'LICENCE AND COPYRIGHT', + 'DISCLAIMER OF WARRANTY', + ], + $EN_US => [ + 'NAME', + 'VERSION', + 'USAGE', + 'REQUIRED ARGUMENTS', + 'OPTIONS', + 'DESCRIPTION', + 'DIAGNOSTICS', + 'CONFIGURATION AND ENVIRONMENT', + 'DEPENDENCIES', + 'INCOMPATIBILITIES', + 'BUGS AND LIMITATIONS', + 'AUTHOR', + 'LICENSE AND COPYRIGHT', + 'DISCLAIMER OF WARRANTY', + ], + }, +); + +#----------------------------------------------------------------------------- + +sub supported_parameters { + return ( + { + name => 'lib_sections', + description => 'The sections to require for modules (separated by qr/\s* [|] \s*/xm).', + default_string => $EMPTY, + parser => \&_parse_lib_sections, + }, + { + name => 'script_sections', + description => 'The sections to require for programs (separated by qr/\s* [|] \s*/xm).', + default_string => $EMPTY, + parser => \&_parse_script_sections, + }, + { + name => 'source', + description => 'The origin of sections to use.', + default_string => $DEFAULT_SOURCE, + behavior => 'enumeration', + enumeration_values => [ keys %SOURCE_TRANSLATION ], + }, + { + name => 'language', + description => 'The spelling of sections to use.', + default_string => $EMPTY, + behavior => 'enumeration', + enumeration_values => [ $EN_AU, $EN_US ], + }, + ); +} + +sub default_severity { return $SEVERITY_LOW } +sub default_themes { return qw(core pbp maintenance) } +sub applies_to { return 'PPI::Document' } + +#----------------------------------------------------------------------------- + +sub _parse_sections { + my $config_string = shift; + + my @sections = split m{ \s* [|] \s* }mx, $config_string; + + return map { uc $_ } @sections; # Normalize CaSe! +} + +sub _parse_lib_sections { + my ($self, $parameter, $config_string) = @_; + + if ( defined $config_string ) { + $self->{_lib_sections} = [ _parse_sections( $config_string ) ]; + } + + return; +} + +sub _parse_script_sections { + my ($self, $parameter, $config_string) = @_; + + if ( defined $config_string ) { + $self->{_script_sections} = [ _parse_sections( $config_string ) ]; + } + + return; +} + +#----------------------------------------------------------------------------- + +sub initialize_if_enabled { + my ($self, $config) = @_; + + my $source = $self->{_source}; + if ( not defined $source or not defined $DEFAULT_LIB_SECTIONS{$source} ) { + $source = $DEFAULT_SOURCE; + } + + my $language = $self->{_language}; + if ( + not defined $language + or not defined $DEFAULT_LIB_SECTIONS{$source}{$language} + ) { + $language = $SOURCE_DEFAULT_LANGUAGE{$source}; + } + + if ( not $self->_sections_specified('_lib_sections') ) { + $self->{_lib_sections} = $DEFAULT_LIB_SECTIONS{$source}{$language}; + } + if ( not $self->_sections_specified('_script_sections') ) { + $self->{_script_sections} = + $DEFAULT_SCRIPT_SECTIONS{$source}{$language}; + } + + return $TRUE; +} + +sub _sections_specified { + my ( $self, $sections_key ) = @_; + + my $sections = $self->{$sections_key}; + + return 0 if not defined $sections; + + return scalar @{ $sections }; +} + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, $doc ) = @_; + + # This policy does not apply unless there is some real code in the + # file. For example, if this file is just pure POD, then + # presumably this file is ancillary documentation and you can use + # whatever headings you want. + return if ! $doc->schild(0); + + my %found_sections = (); + my @violations = (); + + my @required_sections = is_script($doc) ? @{ $self->{_script_sections} } + : @{ $self->{_lib_sections} }; + + my $pods_ref = $doc->find('PPI::Token::Pod'); + return if not $pods_ref; + + # Round up the names of all the =head1 sections + for my $pod ( @{ $pods_ref } ) { + for my $found ( $pod =~ m{ ^ =head1 \s+ ( .+? ) \s* $ }gmx ) { + #Leading/trailing whitespace is already removed + $found_sections{ uc $found } = 1; + } + } + + # Compare the required sections against those we found + for my $required ( @required_sections ) { + if ( not exists $found_sections{$required} ) { + my $desc = qq{Missing "$required" section in POD}; + push @violations, $self->violation( $desc, $EXPL, $doc ); + } + } + + return @violations; +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords licence + +=head1 NAME + +Perl::Critic::Policy::Documentation::RequirePodSections - Organize your POD into the customary sections. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +This Policy requires your POD to contain certain C<=head1> sections. +If the file doesn't contain any POD at all, then this Policy does not +apply. Tools like L make it really easy to ensure +that every module has the same documentation framework, and they can +save you lots of keystrokes. + +=head1 DEFAULTS + +Different POD sections are required, depending on whether the file is +a library or program (which is determined by the presence or absence +of a perl shebang line). + + Default Required POD Sections + + Perl Libraries Perl Programs + ------------------------------------------------------ + NAME NAME + VERSION + SYNOPSIS USAGE + DESCRIPTION DESCRIPTION + SUBROUTINES/METHODS REQUIRED ARGUMENTS + OPTIONS + DIAGNOSTICS DIAGNOSTICS + EXIT STATUS + CONFIGURATION AND ENVIRONMENT CONFIGURATION + DEPENDENCIES DEPENDENCIES + INCOMPATIBILITIES INCOMPATIBILITIES + BUGS AND LIMITATIONS BUGS AND LIMITATIONS + AUTHOR AUTHOR + LICENSE AND COPYRIGHT LICENSE AND COPYRIGHT + +=head1 CONFIGURATION + +The default sections above are derived from Damian Conway's I book. Since the book has been published, Conway has +released L, which has different names for some +of the sections, and adds some more. Also, the book and module use +Australian spelling, while the authors of this module have previously +used American spelling. To sort this all out, there are a couple of +options that can be used: C and C. + +The C option has two generic values, C and +C, and two version-specific values, +C and C. Currently, the +generic values map to the corresponding version-specific values, but +may change as new versions of the book and module are released, so use +these if you want to keep up with the latest and greatest. If you +want things to remain stable, use the version-specific values. + +The C option has a default, unnamed value but also accepts +values of C and C. The reason the unnamed value exists +is because the default values for programs don't actually match the +book, even taking spelling into account, i.e. C instead +of C, the removal of C, and +the addition of C. To get precisely the sections as +specified in the book, put the following in your F<.perlcriticrc> +file: + + [Documentation::RequirePodSections] + source = book_first_edition + language = en_AU + +If you want to use + + [Documentation::RequirePodSections] + source = module_starter_pbp + language = en_US + +you will need to modify your F<~/.module-starter/PBP/Module.pm> +template because it is generated using Australian spelling. + +Presently, the difference between C and C is in how the +word "licence" is spelled. + +The sections required for modules and programs can be independently +customized, overriding any values for C and C, by +giving values for C and C of a string +of pipe-delimited required POD section names. An example of entries +in a F<.perlcriticrc> file: + + [Documentation::RequirePodSections] + lib_sections = NAME | SYNOPSIS | BUGS AND LIMITATIONS | AUTHOR + script_sections = NAME | USAGE | OPTIONS | EXIT STATUS | AUTHOR + +=head1 LIMITATIONS + +Currently, this Policy does not look for the required POD sections +below the C<=head1> level. Also, it does not require the sections to +appear in any particular order. + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2006-2008 Jeffrey Ryan Thalhammer. 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 + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ErrorHandling/RequireCarping.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ErrorHandling/RequireCarping.pm new file mode 100644 index 0000000..259c6fa --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ErrorHandling/RequireCarping.pm @@ -0,0 +1,430 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/ErrorHandling/RequireCarping.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::ErrorHandling::RequireCarping; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ + :booleans :characters :severities :classification :data_conversion +}; +use Perl::Critic::Utils::PPI qw{ is_ppi_expression_or_generic_statement }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $EXPL => [ 283 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { + return ( + { + name => 'allow_messages_ending_with_newlines', + description => q{Don't complain about die or warn if the message ends in a newline.}, + default_string => '1', + behavior => 'boolean', + }, + ); +} + +sub default_severity { return $SEVERITY_MEDIUM } +sub default_themes { return qw( core pbp maintenance ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + my $alternative; + if ( $elem eq 'warn' ) { + $alternative = 'carp'; + } + elsif ( $elem eq 'die' ) { + $alternative = 'croak'; + } + else { + return; + } + + return if ! is_function_call($elem); + + if ($self->{_allow_messages_ending_with_newlines}) { + return if _last_flattened_argument_list_element_ends_in_newline($elem); + } + + my $desc = qq{"$elem" used instead of "$alternative"}; + return $self->violation( $desc, $EXPL, $elem ); +} + +#----------------------------------------------------------------------------- + +sub _last_flattened_argument_list_element_ends_in_newline { + my $die_or_warn = shift; + + my $last_flattened_argument = + _find_last_flattened_argument_list_element($die_or_warn); + if ( + $last_flattened_argument + and ( + $last_flattened_argument->isa('PPI::Token::Quote::Double') + or $last_flattened_argument->isa('PPI::Token::Quote::Interpolate') + ) + ) { + return $TRUE if $last_flattened_argument =~ m{ [\\] n . \z }xmso; + } + + return $FALSE +} + +#----------------------------------------------------------------------------- +# Here starts the fun. Explanation by example: +# +# Let's say we've got the following (contrived) statement: +# +# die q{Isn't }, ( $this, ( " fun?\n" ) , ) if "It isn't Monday."; +# +# This statement should pass because the last parameter that die is going to +# get is C<" fun?\n">. +# +# The approach is to first find the last non-flattened parameter. If this +# is a simple token, we're done. Else, it's some aggregate thing. We can't +# tell what C is going to do, so we give up on +# anything other than a PPI::Structure::List. +# +# There are three possible scenarios for the children of a List: +# +# * No children of the List, i.e. the list looks like C< ( ) >. +# * One PPI::Statement::Expression element. +# * One PPI::Statement element. That's right, an instance of the base +# statement class and not some subclass. *sigh* +# +# In the first case, we're done. The latter two cases get treated +# identically. We get the last child of the Statement and start the search +# all over again. +# +# Back to our example. The PPI tree for this expression is +# +# PPI::Document +# PPI::Statement +# PPI::Token::Word 'die' +# PPI::Token::Quote::Literal 'q{Isn't }' +# PPI::Token::Operator ',' +# PPI::Structure::List ( ... ) +# PPI::Statement::Expression +# PPI::Token::Symbol '$this' +# PPI::Token::Operator ',' +# PPI::Structure::List ( ... ) +# PPI::Statement::Expression +# PPI::Token::Quote::Double '" fun?\n"' +# PPI::Token::Operator ',' +# PPI::Token::Word 'if' +# PPI::Token::Quote::Double '"It isn't Monday.\n"' +# PPI::Token::Structure ';' +# +# We're starting with the Word containing 'die' (it could just as well be +# 'warn') because the earlier parts of validate() have taken care of any +# other possibility. We're going to scan forward through 'die's siblings +# until we reach what we think the end of its parameters are. So we get +# +# 1. A Literal. A perfectly good argument. +# 2. A comma operator. Looks like we've got more to go. +# 3. A List. Another argument. +# 4. The Word 'if'. Oops. That's a postfix operator. +# +# Thus, the last parameter is the List. So, we've got to scan backwards +# through the components of the List; again, the goal is to find the last +# value in the flattened list. +# +# Before decending into the List, we check that it isn't a subroutine call by +# looking at its prior sibling. In this case, the prior sibling is a comma +# operator, so it's fine. +# +# The List has one Expression element as we expect. We grab the Expression's +# last child and start all over again. +# +# 1. The last child is a comma operator, which Perl will ignore, so we +# skip it. +# 2. The comma's prior sibling is a List. This is the last significant +# part of the outer list. +# 3. The List's prior sibling isn't a Word, so we can continue because the +# List is not a parameter list. +# 4. We go through the child Expression and find that the last child of +# that is a PPI::Token::Quote::Double, which is a simple, non-compound +# token. We return that and we're done. + +sub _find_last_flattened_argument_list_element { + my $die_or_warn = shift; + + # Zoom forward... + my $current_candidate = + _find_last_element_in_subexpression($die_or_warn); + + # ... scan back. + while ( + $current_candidate + and not _is_simple_list_element_token( $current_candidate ) + and not _is_complex_expression_token( $current_candidate ) + ) { + if ( $current_candidate->isa('PPI::Structure::List') ) { + $current_candidate = + _determine_if_list_is_a_plain_list_and_get_last_child( + $current_candidate, + $die_or_warn + ); + } elsif ( not $current_candidate->isa('PPI::Token') ) { + return; + } else { + $current_candidate = $current_candidate->sprevious_sibling(); + } + } + + return if not $current_candidate; + return if _is_complex_expression_token( $current_candidate ); + + my $penultimate_element = $current_candidate->sprevious_sibling(); + if ($penultimate_element) { + # Bail if we've got a Word in front of the Element that isn't + # the original 'die' or 'warn' or anything else that isn't + # a comma or dot operator. + if ( $penultimate_element->isa('PPI::Token::Operator') ) { + if ( + $penultimate_element ne $COMMA + and $penultimate_element ne $PERIOD + ) { + return; + } + } elsif ( $penultimate_element != $die_or_warn ) { + return + } + } + + return $current_candidate; +} + +#----------------------------------------------------------------------------- +# This is the part where we scan forward from the 'die' or 'warn' to find +# the last argument. + +sub _find_last_element_in_subexpression { + my $die_or_warn = shift; + + my $last_following_sibling; + my $next_sibling = $die_or_warn; + while ( + $next_sibling = $next_sibling->snext_sibling() + and not _is_postfix_operator( $next_sibling ) + ) { + $last_following_sibling = $next_sibling; + } + + return $last_following_sibling; +} + +#----------------------------------------------------------------------------- +# Ensure that the list isn't a parameter list. Find the last element of it. + +sub _determine_if_list_is_a_plain_list_and_get_last_child { + my ($list, $die_or_warn) = @_; + + my $prior_sibling = $list->sprevious_sibling(); + + if ( $prior_sibling ) { + # Bail if we've got a Word in front of the List that isn't + # the original 'die' or 'warn' or anything else that isn't + # a comma operator. + if ( $prior_sibling->isa('PPI::Token::Operator') ) { + if ( $prior_sibling ne $COMMA ) { + return; + } + } elsif ( $prior_sibling != $die_or_warn ) { + return + } + } + + my @list_children = $list->schildren(); + + # If zero children, nothing to look for. + # If multiple children, then PPI is not giving us + # anything we understand. + return if scalar (@list_children) != 1; + + my $list_child = $list_children[0]; + + # If the child isn't an Expression or it is some other subclass + # of Statement, we again don't understand PPI's output. + return if not is_ppi_expression_or_generic_statement($list_child); + + my @statement_children = $list_child->schildren(); + return if scalar (@statement_children) < 1; + + return $statement_children[-1]; +} + + +#----------------------------------------------------------------------------- +Readonly::Hash my %POSTFIX_OPERATORS => + hashify qw{ if unless while until for foreach }; + +sub _is_postfix_operator { + my $element = shift; + + if ( + $element->isa('PPI::Token::Word') + and $POSTFIX_OPERATORS{$element} + ) { + return $TRUE; + } + + return $FALSE; +} + + +Readonly::Array my @SIMPLE_LIST_ELEMENT_TOKEN_CLASSES => + qw{ + PPI::Token::Number + PPI::Token::Word + PPI::Token::DashedWord + PPI::Token::Symbol + PPI::Token::Quote + }; + +sub _is_simple_list_element_token { + my $element = shift; + + return $FALSE if not $element->isa('PPI::Token'); + + foreach my $class (@SIMPLE_LIST_ELEMENT_TOKEN_CLASSES) { + return $TRUE if $element->isa($class); + } + + return $FALSE; +} + + +#----------------------------------------------------------------------------- +# Tokens that can't possibly be part of an expression simple +# enough for us to examine. + +Readonly::Array my @COMPLEX_EXPRESSION_TOKEN_CLASSES => + qw{ + PPI::Token::ArrayIndex + PPI::Token::QuoteLike + PPI::Token::Regexp + PPI::Token::HereDoc + PPI::Token::Cast + PPI::Token::Label + PPI::Token::Separator + PPI::Token::Data + PPI::Token::End + PPI::Token::Prototype + PPI::Token::Attribute + PPI::Token::Unknown + }; + +sub _is_complex_expression_token { + my $element = shift; + + return $FALSE if not $element->isa('PPI::Token'); + + foreach my $class (@COMPLEX_EXPRESSION_TOKEN_CLASSES) { + return $TRUE if $element->isa($class); + } + + return $FALSE; +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::ErrorHandling::RequireCarping - Use functions from L instead of C or C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +The C and C functions both report the file and line number +where the exception occurred. But if someone else is using your +subroutine, they usually don't care where B code blew up. +Instead, they want to know where B code invoked the subroutine. +The L module provides alternative methods that report the +exception from the caller's file and line number. + +By default, this policy will not complain about C or C, if +it can determine that the message will always result in a terminal +newline. Since perl suppresses file names and line numbers in this +situation, it is assumed that no stack traces are desired either and +none of the L functions are necessary. + + die "oops" if $explosion; #not ok + warn "Where? Where?!" if $tiger; #not ok + + open my $mouth, '<', 'food' + or die 'of starvation'; #not ok + + if (! $dentist_appointment) { + warn "You have bad breath!\n"; #ok + } + + die "$clock not set.\n" if $no_time; #ok + + my $message = "$clock not set.\n"; + die $message if $no_time; #not ok, not obvious + + +=head1 CONFIGURATION + +If you give this policy an C +option in your F<.perlcriticrc> with a false value, then this policy +will disallow all uses of C and C. + + [ErrorHandling::RequireCarping] + allow_messages_ending_with_newlines = 0 + + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ErrorHandling/RequireCheckingReturnValueOfEval.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ErrorHandling/RequireCheckingReturnValueOfEval.pm new file mode 100644 index 0000000..f17d256 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/ErrorHandling/RequireCheckingReturnValueOfEval.pm @@ -0,0 +1,374 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/ErrorHandling/RequireCheckingReturnValueOfEval.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::ErrorHandling::RequireCheckingReturnValueOfEval; + +use 5.006001; +use strict; +use warnings; + +use Readonly; + +use Scalar::Util qw< refaddr >; + +use Perl::Critic::Utils qw< :booleans :characters :severities hashify >; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => 'Return value of eval not tested.'; +## no critic (RequireInterpolationOfMetachars) +Readonly::Scalar my $EXPL => + q; +## use critic + +Readonly::Hash my %BOOLEAN_OPERATORS => hashify qw< || && // or and >; +Readonly::Hash my %POSTFIX_OPERATORS => + hashify qw< for foreach if unless while until >; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_MEDIUM } +sub default_themes { return qw( core bugs ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + return if $elem->content() ne 'eval'; + + my $evaluated = $elem->snext_sibling() or return; # Nothing to eval! + my $following = $evaluated->snext_sibling(); + + return if _is_in_right_hand_side_of_assignment($elem); + return if _is_in_postfix_expression($elem); + return if + _is_in_correct_position_in_a_condition_or_foreach_loop_collection( + $elem, + $following, + ); + + if ( + $following + and $following->isa('PPI::Token::Operator') + and $BOOLEAN_OPERATORS{ $following->content() } + ) { + return; + } + + return $self->violation($DESC, $EXPL, $elem); +} + +#----------------------------------------------------------------------------- + +sub _is_in_right_hand_side_of_assignment { + my ($elem) = @_; + + my $previous = $elem->sprevious_sibling(); + + if (not $previous) { + $previous = + _grandparent_for_is_in_right_hand_side_of_assignment($elem); + } + + while ($previous) { + my $base_previous = $previous; + + EQUALS_SCAN: + while ($previous) { + if ( $previous->isa('PPI::Token::Operator') ) { + return $TRUE if $previous->content() eq q<=>; + last EQUALS_SCAN if _is_effectively_a_comma($previous); + } + $previous = $previous->sprevious_sibling(); + } + + $previous = + _grandparent_for_is_in_right_hand_side_of_assignment($base_previous); + } + + return; +} + +sub _grandparent_for_is_in_right_hand_side_of_assignment { + my ($elem) = @_; + + my $parent = $elem->parent() or return; + $parent->isa('PPI::Statement') or return; + + my $grandparent = $parent->parent() or return; + + if ( + $grandparent->isa('PPI::Structure::Constructor') + or $grandparent->isa('PPI::Structure::List') + ) { + return $grandparent; + } + + return; +} + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $CONDITION_POSITION_IN_C_STYLE_FOR_LOOP => 1; + +sub _is_in_correct_position_in_a_condition_or_foreach_loop_collection { + my ($elem, $following) = @_; + + my $parent = $elem->parent(); + while ($parent) { + if ( $parent->isa('PPI::Structure::Condition') ) { + return + _is_in_correct_position_in_a_structure_condition( + $elem, $parent, $following, + ); + } + + if ( $parent->isa('PPI::Structure::ForLoop') ) { + my @for_loop_components = $parent->schildren(); + + return $TRUE if 1 == @for_loop_components; + my $condition = + $for_loop_components[$CONDITION_POSITION_IN_C_STYLE_FOR_LOOP] + or return; + + return _descendant_of($elem, $condition); + } + + $parent = $parent->parent(); + } + + return; +} + +sub _is_in_correct_position_in_a_structure_condition { + my ($elem, $parent, $following) = @_; + + my $level = $elem; + while ($level and refaddr $level != $parent) { + my $cursor = refaddr $elem == refaddr $level ? $following : $level; + + IS_FINAL_EXPRESSION_AT_DEPTH: + while ($cursor) { + if ( _is_effectively_a_comma($cursor) ) { + $cursor = $cursor->snext_sibling(); + while ( _is_effectively_a_comma($cursor) ) { + $cursor = $cursor->snext_sibling(); + } + + # Semicolon would be a syntax error here. + return if $cursor; + last IS_FINAL_EXPRESSION_AT_DEPTH; + } + + $cursor = $cursor->snext_sibling(); + } + + my $statement = $level->parent(); + return $TRUE if not $statement; # Shouldn't happen. + return $TRUE if not $statement->isa('PPI::Statement'); # Shouldn't happen. + + $level = $statement->parent(); + if ( + not $level + or ( + not $level->isa('PPI::Structure::List') + and not $level->isa('PPI::Structure::Condition') + ) + ) { + # Shouldn't happen. + return $TRUE; + } + } + + return $TRUE; +} + +# Replace with PPI implementation once it is released. +sub _descendant_of { + my ($cursor, $potential_ancestor) = @_; + + return $EMPTY if not $potential_ancestor; + + while ( refaddr $cursor != refaddr $potential_ancestor ) { + $cursor = $cursor->parent() or return $EMPTY; + } + + return 1; +} + +#----------------------------------------------------------------------------- + +sub _is_in_postfix_expression { + my ($elem) = @_; + + my $previous = $elem->sprevious_sibling(); + while ($previous) { + if ( + $previous->isa('PPI::Token::Word') + and $POSTFIX_OPERATORS{ $previous->content() } + ) { + return $TRUE + } + $previous = $previous->sprevious_sibling(); + } + + return; +} + +#----------------------------------------------------------------------------- + +sub _is_effectively_a_comma { + my ($elem) = @_; + + return if not $elem; + + return + $elem->isa('PPI::Token::Operator') + && ( + $elem->content() eq $COMMA + || $elem->content() eq $FATCOMMA + ); +} + +#----------------------------------------------------------------------------- + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords destructors + +=head1 NAME + +Perl::Critic::Policy::ErrorHandling::RequireCheckingReturnValueOfEval - You can't depend upon the value of C<$@>/C<$EVAL_ERROR> to tell whether an C failed. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +A common idiom in perl for dealing with possible errors is to use +C followed by a check of C<$@>/C<$EVAL_ERROR>: + + eval { + ... + }; + if ($EVAL_ERROR) { + ... + } + +There's a problem with this: the value of C<$EVAL_ERROR> can change +between the end of the C and the C statement. The issue is +object destructors: + + package Foo; + + ... + + sub DESTROY { + ... + eval { ... }; + ... + } + + package main; + + eval { + my $foo = Foo->new(); + ... + }; + if ($EVAL_ERROR) { + ... + } + +Assuming there are no other references to C<$foo> created, when the +C block in C
is exited, C will be invoked, +regardless of whether the C finished normally or not. If the +C in C
fails, but the C in C +succeeds, then C<$EVAL_ERROR> will be empty by the time that the C +is executed. Additional issues arise if you depend upon the exact +contents of C<$EVAL_ERROR> and both Cs fail, because the +messages from both will be concatenated. + +Even if there isn't an C directly in the C method +code, it may invoke code that does use C or otherwise affects +C<$EVAL_ERROR>. + +The solution is to ensure that, upon normal exit, an C returns a +true value and to test that value: + + # Constructors are no problem. + my $object = eval { Class->new() }; + + # To cover the possiblity that an operation may correctly return a + # false value, end the block with "1": + if ( eval { something(); 1 } ) { + ... + } + + eval { + ... + 1; + } + or do { + # Error handling here + }; + +Unfortunately, you can't use the C function to test the +result; C returns an empty string on failure. + +"But we don't use DESTROY() anywhere in our code!" you say. That may +be the case, but do any of the third-party modules you use have them? +What about any you may use in the future or updated versions of the +ones you already use? + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 SEE ALSO + +See thread on perl5-porters starting here: +L. + + +=head1 AUTHOR + +Elliot Shank C<< >> + +=head1 COPYRIGHT + +Copyright (c) 2008 Elliot Shank. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitBacktickOperators.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitBacktickOperators.pm new file mode 100644 index 0000000..4f6cd82 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitBacktickOperators.pm @@ -0,0 +1,143 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/InputOutput/ProhibitBacktickOperators.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::InputOutput::ProhibitBacktickOperators; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities is_in_void_context }; + +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $EXPL => q{Use IPC::Open3 instead}; +Readonly::Scalar my $DESC => q{Backtick operator used}; + +Readonly::Scalar my $VOID_EXPL => q{Assign result to a variable or use system() instead}; +Readonly::Scalar my $VOID_DESC => q{Backtick operator used in void context}; + +#----------------------------------------------------------------------------- + +sub supported_parameters { + return ( + { + name => 'only_in_void_context', + description => 'Allow backticks everywhere except in void contexts.', + behavior => 'boolean', + }, + ); +} + +sub default_severity { return $SEVERITY_MEDIUM } +sub default_themes { return qw(core maintenance) } +sub applies_to { return qw(PPI::Token::QuoteLike::Backtick + PPI::Token::QuoteLike::Command ) } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + if ( $self->{_only_in_void_context} ) { + return if not is_in_void_context( $elem ); + + return $self->violation( $VOID_DESC, $VOID_EXPL, $elem ); + } + + return $self->violation( $DESC, $EXPL, $elem ); +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::InputOutput::ProhibitBacktickOperators - Discourage stuff like C<@files = `ls $directory`>. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Backticks are super-convenient, especially for CGI programs, but I +find that they make a lot of noise by filling up STDERR with messages +when they fail. I think its better to use IPC::Open3 to trap all the +output and let the application decide what to do with it. + + use IPC::Open3 'open3'; + $SIG{CHLD} = 'IGNORE'; + + @output = `some_command`; #not ok + + my ($writer, $reader, $err); + open3($writer, $reader, $err, 'some_command'); #ok; + @output = <$reader>; #Output here + @errors = <$err>; #Errors here, instead of the console + + +=head1 CONFIGURATION + +Alternatively, if you do want to use backticks, you can restrict +checks to void contexts by adding the following to your +F<.perlcriticrc> file: + + [InputOutput::ProhibitBacktickOperators] + only_in_void_context = 1 + +The purpose of backticks is to capture the output of an external +command. Use of them in a void context is likely a bug. If the +output isn't actually required, C should be used. Otherwise +assign the result to a variable. + + `some_command`; #not ok + $output = `some_command`; #ok + @output = `some_command`; #ok + + +=head1 NOTES + +This policy also prohibits the generalized form of backticks seen as +C. + +See L for more discussion on using C instead of +C<$SIG{CHLD} = 'IGNORE'>. + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitBarewordFileHandles.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitBarewordFileHandles.pm new file mode 100644 index 0000000..08c1cd1 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitBarewordFileHandles.pm @@ -0,0 +1,119 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/InputOutput/ProhibitBarewordFileHandles.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::InputOutput::ProhibitBarewordFileHandles; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification :ppi }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Bareword file handle opened}; +Readonly::Scalar my $EXPL => [ 202, 204 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_HIGHEST } +sub default_themes { return qw( core pbp bugs ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ($self, $elem, undef) = @_; + + return if $elem ne 'open'; + return if ! is_function_call($elem); + + my $first_arg = ( parse_arg_list($elem) )[0]; + return if !$first_arg; + my $first_token = $first_arg->[0]; + return if !$first_token; + + if ( $first_token->isa('PPI::Token::Word') ) { + if ( ($first_token ne 'my') && ($first_token !~ m/^STD(?:IN|OUT|ERR)$/mx ) ) { + return $self->violation( $DESC, $EXPL, $elem ); + } + } + return; #ok! +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::InputOutput::ProhibitBarewordFileHandles - Write C instead of C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 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 Cizing 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 L or +L or L 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. + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 SEE ALSO + +L + +L + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (C) 2005-2007 Jeffrey Ryan Thalhammer. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitExplicitStdin.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitExplicitStdin.pm new file mode 100644 index 0000000..8a2ceac --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitExplicitStdin.pm @@ -0,0 +1,126 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/InputOutput/ProhibitExplicitStdin.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::InputOutput::ProhibitExplicitStdin; + +use 5.006001; +use strict; +use warnings; +use Readonly; +use List::MoreUtils qw(any); + +use Perl::Critic::Utils qw{ :severities :classification &parse_arg_list }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Use "<>" or "" or a prompting module instead of ""}; +Readonly::Scalar my $EXPL => [216,220,221]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_HIGH } +sub default_themes { return qw( core pbp maintenance ) } +sub applies_to { return 'PPI::Token::QuoteLike::Readline' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + return if $elem ne ''; + return $self->violation( $DESC, $EXPL, $elem ); +} + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::InputOutput::ProhibitExplicitStdin - Use "<>" or "" or a prompting module instead of "". + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Perl has a useful magic filehandle called C<*ARGV> that checks the +command line and if there are any arguments, opens and reads those as +files. If there are no arguments, C<*ARGV> behaves like C<*STDIN> +instead. This behavior is almost always what you want if you want to +create a program that reads from C. This is often written in +one of the following two equivalent forms: + + while () { + # ... do something with each input line ... + } + # or, equivalently: + while (<>) { + # ... do something with each input line ... + } + +If you want to prompt for user input, try special purpose modules like +L. + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 CAVEATS + +Due to a bug in the current version of PPI (v1.119_03) and earlier, +the readline operator is often misinterpreted as less-than and +greater-than operators after a comma. Therefore, this policy misses important cases like + + my $content = join '', ; + +because it interprets that line as the nonsensical statement: + + my $content = join '', < STDIN >; + +When that PPI bug is fixed, this policy should start catching those +violations automatically. + +=head1 CREDITS + +Initial development of this policy was supported by a grant from the Perl Foundation. + +=head1 AUTHOR + +Chris Dolan + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Chris Dolan. Many 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 + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitInteractiveTest.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitInteractiveTest.pm new file mode 100644 index 0000000..66d23e5 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitInteractiveTest.pm @@ -0,0 +1,89 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/InputOutput/ProhibitInteractiveTest.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Use IO::Interactive::is_interactive() instead of -t}; +Readonly::Scalar my $EXPL => [ 218 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_HIGHEST } +sub default_themes { return qw( core pbp bugs ) } +sub applies_to { return 'PPI::Token::Operator' } + +#----------------------------------------------------------------------------- + +sub violates { + my ($self, $elem, $doc) = @_; + return if $elem ne '-t'; + return $self->violation( $DESC, $EXPL, $elem ); +} + +1; + +#----------------------------------------------------------------------------- + +__END__ + +=pod + +=head1 NAME + +Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest - Use prompt() instead of -t. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +The C<-t> operator is fragile and complicated. When you are testing +whether C is interactive, It's much more robust to use +well-tested CPAN modules like L. + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 AUTHOR + +Chris Dolan + +=head1 COPYRIGHT + +Copyright (C) 2006 Chris Dolan. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitJoinedReadline.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitJoinedReadline.pm new file mode 100644 index 0000000..0dbe4a0 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitJoinedReadline.pm @@ -0,0 +1,119 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/InputOutput/ProhibitJoinedReadline.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::InputOutput::ProhibitJoinedReadline; + +use 5.006001; +use strict; +use warnings; +use Readonly; +use List::MoreUtils qw(any); + +use Perl::Critic::Utils qw{ :severities :classification parse_arg_list }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Use "local $/ = undef" or File::Slurp instead of joined readline}; ##no critic qw(Interpolation) +Readonly::Scalar my $EXPL => [213]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_MEDIUM } +sub default_themes { return qw( core pbp performance ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + return if $elem ne 'join'; + return if ! is_function_call($elem); + my @args = parse_arg_list($elem); + shift @args; # ignore separator string + + if (any { any { $_->isa('PPI::Token::QuoteLike::Readline') } @{$_} } @args) { + return $self->violation( $DESC, $EXPL, $elem ); + } + + return; # OK +} + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::InputOutput::ProhibitJoinedReadline - Use C or L instead of joined readline. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +It's really easy to slurp a whole filehandle in at once with C>, but that's inefficient -- Perl goes to the trouble of +splitting the file into lines only to have that work thrown away. + +To save performance, either slurp the filehandle without splitting like so: + + do { local $/ = undef; <$fh> } + +or use L, which is even faster. + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 CAVEATS + +Due to a bug in the current version of PPI (v1.119_03) and earlier, +the readline operator is often misinterpreted as less-than and +greater-than operators after a comma. Therefore, this policy only +works well on the empty filehandle, C<<>>. When PPI is fixed, this +should just start working. + +=head1 CREDITS + +Initial development of this policy was supported by a grant from the Perl Foundation. + +=head1 AUTHOR + +Chris Dolan + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Chris Dolan. Many 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 + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitOneArgSelect.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitOneArgSelect.pm new file mode 100644 index 0000000..bc4e2e5 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitOneArgSelect.pm @@ -0,0 +1,108 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/InputOutput/ProhibitOneArgSelect.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::InputOutput::ProhibitOneArgSelect; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification :ppi }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{One-argument "select" used}; +Readonly::Scalar my $EXPL => [ 224 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_HIGH } +sub default_themes { return qw( core bugs pbp ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ($self, $elem, undef) = @_; + + return if $elem ne 'select'; + return if ! is_function_call($elem); + + if( scalar parse_arg_list($elem) == 1 ) { + return $self->violation( $DESC, $EXPL, $elem ); + } + return; #ok! +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::InputOutput::ProhibitOneArgSelect - Never write C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Conway discourages the use of a raw C when setting +autoflushes. We'll extend that further by simply prohibiting the +one-argument form of C entirely; if you really need it you +should know when/where/why that is. For performing autoflushes, +Conway recommends the use of C instead. + + select((select($fh), $|=1)[0]); # not ok + select $fh; # not ok + + use IO::Handle; + $fh->autoflush(); # ok + *STDOUT->autoflush(); # ok + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 SEE ALSO + +L. + +=head1 AUTHOR + +Graham TerMarsch + +=head1 COPYRIGHT + +Copyright (C) 2005-2007 Graham TerMarsch. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitReadlineInForLoop.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitReadlineInForLoop.pm new file mode 100644 index 0000000..9ee8ed2 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitReadlineInForLoop.pm @@ -0,0 +1,99 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/InputOutput/ProhibitReadlineInForLoop.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::InputOutput::ProhibitReadlineInForLoop; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Readline inside "for" loop}; +Readonly::Scalar my $EXPL => [ 211 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_HIGH } +sub default_themes { return qw( core bugs pbp ) } +sub applies_to { return qw( PPI::Structure::ForLoop) } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + if ( my $rl = $elem->find_first('PPI::Token::QuoteLike::Readline') ) { + return $self->violation( $DESC, $EXPL, $rl ); + } + + return; #ok! +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::InputOutput::ProhibitReadlineInForLoop - Write C<< while( $line = <> ){...} >> instead of C<< for(<>){...} >>. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Using the readline operator in a C or C loop is very +slow. The iteration list of the loop creates a list context, +which causes the readline operator to read the entire input stream +before iteration even starts. Instead, just use a C loop, +which only reads one line at a time. + + for my $line ( <$file_handle> ){ do_something($line) } #not ok + while ( my $line = <$file_handle> ){ do_something($line) } #ok + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitTwoArgOpen.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitTwoArgOpen.pm new file mode 100644 index 0000000..d561cc6 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/ProhibitTwoArgOpen.pm @@ -0,0 +1,140 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/InputOutput/ProhibitTwoArgOpen.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen; + +use 5.006001; +use strict; +use warnings; + +use Readonly; + +use version; + +use Perl::Critic::Utils qw{ :severities :classification :ppi }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $STDIO_HANDLES_RX => qr/\b STD (?: IN | OUT | ERR \b)/mx; +Readonly::Scalar my $DESC => q{Two-argument "open" used}; +Readonly::Scalar my $EXPL => [ 207 ]; + +Readonly::Scalar my $MINIMUM_VERSION => version->new(5.006); + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_HIGHEST } +sub default_themes { return qw(core pbp bugs security) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ($self, $elem, $document) = @_; + + return if $elem ne 'open'; + return if ! is_function_call($elem); + + my $version = $document->highest_explicit_perl_version(); + return if $version and $version < $MINIMUM_VERSION; + + my @args = parse_arg_list($elem); + + if ( scalar @args == 2 ) { + # When opening STDIN, STDOUT, or STDERR, the + # two-arg form is the only option you have. + return if $args[1]->[0] =~ $STDIO_HANDLES_RX; + return $self->violation( $DESC, $EXPL, $elem ); + } + + return; # ok! +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen - Write C<< open $fh, q{<}, $filename; >> instead of C<< open $fh, "<$filename"; >>. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +The three-argument form of C (introduced in Perl 5.6) prevents +subtle bugs that occur when the filename starts with funny characters +like '>' or '<'. The L module provides a nice +object-oriented interface to filehandles, which I think is more +elegant anyway. + + open( $fh, '>output.txt' ); # not ok + open( $fh, q{>}, 'output.txt' ); # ok + + use IO::File; + my $fh = IO::File->new( 'output.txt', q{>} ); # even better! + +It's also more explicitly clear to define the input mode of the +file, as in the difference between these two: + + open( $fh, 'foo.txt' ); # BAD: Reader must think what default mode is + open( $fh, '<', 'foo.txt' ); # GOOD: Reader can see open mode + +This policy will not complain if the file explicitly states that it is +compatible with a version of perl prior to 5.6 via an include +statement, e.g. by having C in it. + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 NOTES + +The only time you should use the two-argument form is when you re-open +STDIN, STDOUT, or STDERR. But for now, this Policy doesn't provide +that loophole. + +=head1 SEE ALSO + +L + +L + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (C) 2005-2007 Jeffrey Ryan Thalhammer. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireBracedFileHandleWithPrint.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireBracedFileHandleWithPrint.pm new file mode 100644 index 0000000..8bd969f --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireBracedFileHandleWithPrint.pm @@ -0,0 +1,143 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/InputOutput/RequireBracedFileHandleWithPrint.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification :data_conversion }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Array my @POSTFIX_WORDS => qw( if unless for ); +Readonly::Hash my %POSTFIX_WORDS => hashify( @POSTFIX_WORDS ); + +Readonly::Scalar my $DESC => q{File handle for "print" is not braced}; +Readonly::Scalar my $EXPL => [ 217 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_LOWEST } +sub default_themes { return qw( core pbp cosmetic ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + return if $elem ne 'print'; + return if ! is_function_call($elem); + + my @sib; + + $sib[0] = $elem->snext_sibling(); + return if !$sib[0]; + + # Deal with situations where 'print' is called with parentheses + if ( $sib[0]->isa('PPI::Structure::List') ) { + my $expr = $sib[0]->schild(0); + return if !$expr; + $sib[0] = $expr->schild(0); + return if !$sib[0]; + } + + $sib[1] = $sib[0]->next_sibling(); + return if !$sib[1]; + $sib[2] = $sib[1]->next_sibling(); + return if !$sib[2]; + + # First token must be a scalar symbol or bareword; + return if !( ($sib[0]->isa('PPI::Token::Symbol') && $sib[0] =~ m/\A \$/mx) + || $sib[0]->isa('PPI::Token::Word') ); + + # First token must not be a builtin function or control + return if is_perl_builtin($sib[0]); + return if exists $POSTFIX_WORDS{ $sib[0] }; + + # Second token must be white space + return if !$sib[1]->isa('PPI::Token::Whitespace'); + + # Third token must not be an operator + return if $sib[2]->isa('PPI::Token::Operator'); + + # Special case for postfix controls + return if exists $POSTFIX_WORDS{ $sib[2] }; + + return if $sib[0]->isa('PPI::Structure::Block'); + + return $self->violation( $DESC, $EXPL, $elem ); +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint - Write C instead of C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +The C function has a unique syntax that supports an optional +file handle argument. Conway suggests wrapping this argument in +braces to make it visually stand out from the other arguments. When +you put braces around any of the special package-level file handles +like C, C, and C, you must the C<'*'> sigil or +else it won't compile under C. + + print $FH "Mary had a little lamb\n"; #not ok + print {$FH} "Mary had a little lamb\n"; #ok + + print STDERR $foo, $bar, $baz; #not ok + print {STDERR} $foo, $bar, $baz; #won't compile under 'strict' + print {*STDERR} $foo, $bar, $baz; #perfect! + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 AUTHOR + +Jeffrey Ryan Thalhammer + +=head1 COPYRIGHT + +Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireBriefOpen.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireBriefOpen.pm new file mode 100644 index 0000000..5ff8c5b --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireBriefOpen.pm @@ -0,0 +1,310 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/InputOutput/RequireBriefOpen.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::InputOutput::RequireBriefOpen; + +use 5.006001; +use strict; +use warnings; + +use Readonly; + +use List::MoreUtils qw(any); + +use Perl::Critic::Utils qw{ :severities :classification :booleans parse_arg_list }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q; +Readonly::Scalar my $EXPL => [209]; + +Readonly::Scalar my $SCALAR_SIGIL => q<$>; ## no critic (InterpolationOfLiterals) +Readonly::Scalar my $GLOB_SIGIL => q<*>; + +#----------------------------------------------------------------------------- + +sub supported_parameters { + return ( + { + name => 'lines', + description => 'The maximum number of lines between an open() and a close().', + default_string => '9', + behavior => 'integer', + integer_minimum => 1, + }, + ); +} + +sub default_severity { return $SEVERITY_HIGH } +sub default_themes { return qw< core pbp maintenance > } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + # Is it a call to open? + return if $elem ne 'open'; + return if ! is_function_call($elem); + my @open_args = parse_arg_list($elem); + return if 2 > @open_args; # not a valid call to open() + + my ($is_lexical, $fh) = _get_opened_fh($open_args[0]); + return if not $fh; + return if $fh =~ m< \A [*]? STD (?: IN|OUT|ERR ) \z >xms; + + for my $close_token ($self->_find_close_invocations_or_return($elem)) { + # The $close_token might be a close() or a return() + # It doesn't matter which -- both satisfy this policy + if (is_function_call($close_token)) { + my @close_args = parse_arg_list($close_token); + + my $close_parameter = $close_args[0]; + if ('ARRAY' eq ref $close_parameter) { + $close_parameter = ${$close_parameter}[0]; + } + if ( $close_parameter ) { + $close_parameter = "$close_parameter"; + return if $fh eq $close_parameter; + + if ( any { m< \A [*] >xms } ($fh, $close_parameter) ) { + (my $stripped_fh = $fh) =~ s< \A [*] ><>xms; + (my $stripped_parameter = $close_parameter) =~ + s< \A [*] ><>xms; + + return if $stripped_fh eq $stripped_parameter; + } + } + } + elsif ($is_lexical && is_method_call($close_token)) { + my $tok = $close_token->sprevious_sibling->sprevious_sibling; + return if $fh eq $tok; + } + } + + return $self->violation( $DESC, $EXPL, $elem ); +} + +sub _find_close_invocations_or_return { + my ($self, $elem) = @_; + + my $parent = _get_scope($elem); + return if !$parent; # I can't think of a scenario where this would happen + + my $open_loc = $elem->location; + # we don't actually allow _lines to be zero or undef, but maybe we will + my $end_line = $self->{_lines} ? $open_loc->[0] + $self->{_lines} : undef; + + my $closes = $parent->find(sub { + ##no critic (ProhibitExplicitReturnUndef) + my ($parent, $candidate) = @_; + return undef if $candidate->isa('PPI::Statement::Sub'); + my $candidate_loc = $candidate->location; + return undef if !defined $candidate_loc->[0]; + return 0 if $candidate_loc->[0] < $open_loc->[0]; + return 0 if $candidate_loc->[0] == $open_loc->[0] && $candidate_loc->[1] <= $open_loc->[1]; + return undef if defined $end_line && $candidate_loc->[0] > $end_line; + return 0 if !$candidate->isa('PPI::Token::Word'); + return 1 if $candidate eq 'close' || $candidate eq 'return'; + return 0; + }); + return @{$closes || []}; +} + +sub _get_scope { + my ($elem) = @_; + + while ($elem = $elem->parent) { + return $elem if $elem->scope; + } + return; # should never happen if we are in a PPI::Document +} + +sub _get_opened_fh { + my ($tokens) = shift; + + my $is_lexical; + my $fh; + + if ( 2 == @{$tokens} ) { + if ('my' eq $tokens->[0] && + $tokens->[1]->isa('PPI::Token::Symbol') && + $SCALAR_SIGIL eq $tokens->[1]->raw_type) { + + $is_lexical = 1; + $fh = $tokens->[1]; + } + } + elsif (1 == @{$tokens}) { + my $argument = _unwrap_block( $tokens->[0] ); + if ( $argument->isa('PPI::Token::Symbol') ) { + my $sigil = $argument->raw_type(); + if ($SCALAR_SIGIL eq $sigil) { + $is_lexical = 1; + $fh = $argument; + } + elsif ($GLOB_SIGIL eq $sigil) { + $is_lexical = 0; + $fh = $argument; + } + } + elsif ($argument->isa('PPI::Token::Word') && $argument eq uc $argument) { + $is_lexical = 0; + $fh = $argument; + } + } + + return ($is_lexical, $fh); +} + +sub _unwrap_block { + my ($element) = @_; + + return $element if not $element->isa('PPI::Structure::Block'); + + my @children = $element->schildren(); + return $element if 1 != @children; + my $child = $children[0]; + + return $child if not $child->isa('PPI::Statement'); + + my @grandchildren = $child->schildren(); + return $element if 1 != @grandchildren; + + return $grandchildren[0]; +} + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords redeclared + +=head1 NAME + +Perl::Critic::Policy::InputOutput::RequireBriefOpen - Close filehandles as soon as possible after opening them. + + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +One way that production systems fail unexpectedly is by running out of +filehandles. Filehandles are a finite resource on every operating system that +I'm aware of, and running out of them is virtually impossible to recover from. +The solution is to not run out in the first place. What causes programs to +run out of filehandles? Usually, it's leaks: you open a filehandle and forget +to close it, or just wait a really long time before closing it. + +This problem is rarely exposed by test systems, because the tests rarely run +long enough or have enough load to hit the filehandle limit. So, the best way +to avoid the problem is 1) always close all filehandles that you open and 2) +close them as soon as is practical. + +This policy takes note of calls to C where there is no matching +C call within C lines of code. If you really need to do a lot of +processing on an open filehandle, then you can move that processing to another +method like this: + + sub process_data_file { + my ($self, $filename) = @_; + open my $fh, '<', $filename + or croak 'Failed to read datafile ' . $filename . '; ' . $OS_ERROR; + $self->_parse_input_data($fh); + close $fh; + return; + } + sub _parse_input_data { + my ($self, $fh) = @_; + while (my $line = <$fh>) { + ... + } + return; + } + +As a special case, this policy also allows code to return the filehandle after +the C instead of closing it. Just like the close, however, that +C has to be within the right number of lines. From there, you're on +your own to figure out whether the code is promptly closing the filehandle. + +The STDIN, STDOUT, and STDERR handles are exempt from this policy. + + +=head1 CONFIGURATION + +This policy allows C invocations to be up to C lines after their +corresponding C calls, where C defaults to 9. You can override +this to set it to a different number with the C setting. To do this, +put entries in a F<.perlcriticrc> file like this: + + [InputOutput::RequireBriefOpen] + lines = 5 + + +=head1 CAVEATS + +=head2 Cnew> + +This policy only looks for explicit C calls. It does not detect calls +to C or Cnew> or the like. + + +=head2 Is it the right lexical? + +We don't currently check for redeclared filehandles. So the following code +is false negative, for example, because the outer scoped filehandle is not closed: + + open my $fh, '<', $file1 or croak; + if (open my $fh, '<', $file2) { + print <$fh>; + close $fh; + } + +This is a contrived example, but it isn't uncommon for people to use C<$fh> +for the name of the filehandle every time. Perhaps it's time to think of +better variable names... + + +=head1 CREDITS + +Initial development of this policy was supported by a grant from the Perl Foundation. + + +=head1 AUTHOR + +Chris Dolan + + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Chris Dolan. Many 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 + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireCheckedClose.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireCheckedClose.pm new file mode 100644 index 0000000..3b64aaa --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireCheckedClose.pm @@ -0,0 +1,105 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/InputOutput/RequireCheckedClose.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::InputOutput::RequireCheckedClose; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Return value of "close" ignored}; +Readonly::Scalar my $EXPL => q{Check the return value of "close" for success}; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_LOW } +sub default_themes { return qw( core maintenance ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + return if $elem ne 'close'; + return if ! is_unchecked_call( $elem ); + + return $self->violation( $DESC, $EXPL, $elem ); + +} + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::InputOutput::RequireCheckedClose - Write C<< my $error = close $fh; >> instead of C<< close $fh; >>. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +The perl builtin I/O function C returns a false value on failure. That +value should be checked to ensure that the close was successful. + + + my $error = close $filehandle; # ok + close $filehandle or die "unable to close: $!"; # ok + close $filehandle; # not ok + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 AUTHOR + +Andrew Moore + +=head1 ACKNOWLEDGMENTS + +This policy module is based heavily on policies written by Jeffrey Ryan +Thalhammer . + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 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. + +=cut + +############################################################################## +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireCheckedOpen.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireCheckedOpen.pm new file mode 100644 index 0000000..4c65727 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireCheckedOpen.pm @@ -0,0 +1,105 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/InputOutput/RequireCheckedOpen.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::InputOutput::RequireCheckedOpen; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Return value of "open" ignored}; +Readonly::Scalar my $EXPL => q{Check the return value of "open" for success}; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_MEDIUM } +sub default_themes { return qw( core maintenance ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + return if $elem ne 'open'; + return if ! is_unchecked_call( $elem ); + + return $self->violation( $DESC, $EXPL, $elem ); + +} + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::InputOutput::RequireCheckedOpen - Write C<< my $error = open $fh, $mode, $filename; >> instead of C<< open $fh, $mode, $filename; >>. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +The perl builtin I/O function C 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 + + +=head1 CONFIGURATION + +This Policy is not configurable except for the standard options. + + +=head1 AUTHOR + +Andrew Moore + +=head1 ACKNOWLEDGMENTS + +This policy module is based heavily on policies written by Jeffrey Ryan +Thalhammer . + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 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. + +=cut + +############################################################################## +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireCheckedSyscalls.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireCheckedSyscalls.pm new file mode 100644 index 0000000..9a62133 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/InputOutput/RequireCheckedSyscalls.pm @@ -0,0 +1,190 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/InputOutput/RequireCheckedSyscalls.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :booleans :characters :severities :classification + hashify is_perl_bareword }; + +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Return value of flagged function ignored}; +Readonly::Scalar my $EXPL => [208, 278]; + +Readonly::Array my @DEFAULT_FUNCTIONS => qw( + open close print +); +# I created this list by searching for "return" in perlfunc +Readonly::Array my @BUILTIN_FUNCTIONS => qw( + accept bind binmode chdir chmod chown close closedir connect + dbmclose dbmopen exec fcntl flock fork ioctl kill link listen + mkdir msgctl msgget msgrcv msgsnd open opendir pipe print read + readdir readline readlink readpipe recv rename rmdir seek seekdir + semctl semget semop send setpgrp setpriority setsockopt shmctl + shmget shmread shutdown sleep socket socketpair symlink syscall + sysopen sysread sysseek system syswrite tell telldir truncate + umask unlink utime wait waitpid +); + +#----------------------------------------------------------------------------- + +sub supported_parameters { + return ( + { + name => 'functions', + description => 'The set of functions to require checking the return value of.', + default_string => join( $SPACE, @DEFAULT_FUNCTIONS ), + behavior => 'string list', + }, + ); +} + +sub default_severity { return $SEVERITY_LOWEST } +sub default_themes { return qw( core maintenance ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub initialize_if_enabled { + my ($self, $config) = @_; + + my @specified_functions = keys %{ $self->{_functions} }; + my @resulting_functions; + + foreach my $function (@specified_functions) { + if ( $function eq ':defaults' ) { + push @resulting_functions, @DEFAULT_FUNCTIONS; + } + elsif ( $function eq ':builtins' ) { + push @resulting_functions, @BUILTIN_FUNCTIONS; + } + else { + push @resulting_functions, $function; + } + } + + $self->{_functions} = { hashify(@resulting_functions) }; + + return $TRUE; +} + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + + return if $self->{_functions}->{':all'} ? is_perl_bareword($elem) : !$self->{_functions}->{$elem}; + return if ! is_unchecked_call( $elem ); + + return $self->violation( $DESC . ' - ' . $elem, $EXPL, $elem ); +} + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=for stopwords nyah + +=head1 NAME + +Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls - Return value of flagged function ignored. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +This performs identically to InputOutput::RequireCheckedOpen/Close +except that this is configurable to apply to any function, whether +core or user-defined. + +If your module uses L or C, then any +functions wrapped by those modules will not trigger this policy. For +example: + + use Fatal qw(open); + open my $fh, $filename; # no violation + close $fh; # yes violation + +=head1 CONFIGURATION + +This policy watches for a configurable list of function names. By +default, it applies to C, C and C. You can +override this to set it to a different list of functions with the +C setting. To do this, put entries in a F<.perlcriticrc> +file like this: + + [InputOutput::RequireCheckedSyscalls] + functions = open opendir read readline readdir close closedir + +We have defined a few shortcuts for creating this list + + [InputOutput::RequireCheckedSyscalls] + functions = :defaults opendir readdir closedir + + [InputOutput::RequireCheckedSyscalls] + functions = :builtins + + [InputOutput::RequireCheckedSyscalls] + functions = :all + +The C<:builtins> shortcut above represents all of the builtin +functions that have error conditions (about 65 of them, many of them +rather obscure). + +The C<:all> is the insane case: you must check the return value of +EVERY function call, even C and C. Yes, this "feature" +is overkill and is wasting CPU cycles on your computer by just +existing. Nyah nyah. I shouldn't code after midnight. + +=head1 CREDITS + +Initial development of this policy was supported by a grant from the +Perl Foundation. + +This policy module is based heavily on policies written by Andrew +Moore . + +=head1 AUTHOR + +Chris Dolan + +=head1 COPYRIGHT + +Copyright (c) 2007-2008 Chris Dolan. Many 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. + +=cut + +############################################################################## +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Miscellanea/ProhibitFormats.pm b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Miscellanea/ProhibitFormats.pm new file mode 100644 index 0000000..e76b558 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/lib/Perl/Critic/Policy/Miscellanea/ProhibitFormats.pm @@ -0,0 +1,95 @@ +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/Miscellanea/ProhibitFormats.pm $ +# $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $ +# $Author: clonezone $ +# $Revision: 2489 $ +############################################################################## + +package Perl::Critic::Policy::Miscellanea::ProhibitFormats; + +use 5.006001; +use strict; +use warnings; +use Readonly; + +use Perl::Critic::Utils qw{ :severities :classification }; +use base 'Perl::Critic::Policy'; + +our $VERSION = '1.088'; + +#----------------------------------------------------------------------------- + +Readonly::Scalar my $DESC => q{Format used}; +Readonly::Scalar my $EXPL => [ 449 ]; + +#----------------------------------------------------------------------------- + +sub supported_parameters { return () } +sub default_severity { return $SEVERITY_MEDIUM } +sub default_themes { return qw( core maintenance pbp ) } +sub applies_to { return 'PPI::Token::Word' } + +#----------------------------------------------------------------------------- + +sub violates { + my ( $self, $elem, undef ) = @_; + return if $elem ne 'format'; + return if ! is_function_call( $elem ); + return $self->violation( $DESC, $EXPL, $elem ); +} + + +1; + +__END__ + +#----------------------------------------------------------------------------- + +=pod + +=head1 NAME + +Perl::Critic::Policy::Miscellanea::ProhibitFormats - Do not use C. + +=head1 AFFILIATION + +This Policy is part of the core L distribution. + + +=head1 DESCRIPTION + +Formats are one of the oldest features of Perl. Unfortunately, they suffer +from several limitations. Formats are static and cannot be easily defined +at run time. Also, formats depend on several obscure global variables. + +For more modern reporting tools, consider using one of the template frameworks +like L