Perl::Critic::Policy::ClassHierarchies::ProhibitOneArgBless3pm
Write "bless {}, $class;" instead of just "bless {};".
Affiliation
This Policy is part of the core Perl::Critic distribution.
Overview
Always use the two-argument form of "bless" because it allows subclasses to inherit your constructor.
sub new {my $class = shift;my $self = bless {}; # not okmy $self = bless {}, $class; # okreturn $self;}
Configuration
This Policy is not configurable except for the standard options.
Releases
10 releases since Debian 5.0 (Lenny); the text changed 9 times.