Jeffrey Ryan Thalhammer > Perl-Critic-StricterSubs-0.03 > Perl::Critic::Policy::Subroutines::ProhibitQualifiedSubDeclarations

Download:
strictersubs/Perl-Critic-StricterSubs-0.03.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  13
Open  4
View/Report Bugs
Module Version: 0.03   Source  

NAME ^

Perl::Critic::Policy::Subroutines::ProhibitQualifiedSubDeclarations

AFFILIATION ^

This policy is part of Perl::Critic::StricterSubs.

DESCRIPTION ^

Perl permits you to declare subroutines into any package that you want. This can be downright dangerous if that package is already defined elsewhere.

  package Foo;

  sub Bar::frobulate {}  #not ok
  sub frobulate {}       #ok

Even if you declare a subroutine into the current package, using a fully-qualified name is just weird.

  package  Foo;

  sub Foo::frobulate {} #not ok
  sub frobulate {}      #ok

So this Policy catches any subroutine declaration that contains "::" in the subroutine's name.

CAVEATS ^

Overriding subroutines in other packages is a common testing technique. So you may want to disable this policy when critiquing test scripts.

AUTHOR ^

Jeffrey Ryan Thalhammer <thaljef@cpan.org>

COPYRIGHT ^

Copyright (c) 2007 Jeffrey Ryan Thalhammer. All rights reserved.

syntax highlighting: