The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Perl::Critic::Policy::ValuesAndExpressions::ProhibitListsInMultiConstants - use a single-constant declaration for lists

AFFILIATION

This policy as a part of the Perl::Critic::PolicyBundle::SNEZ distribution.

DESCRIPTION

Constants can be lists, however, this can only work if a single constant is declared at a time.

  ## this is fine
  use constant MULTI  => ('one', 'two', 'three');
  use constant SINGLE => 1;
  #
  # produces two constants:
  # SINGLE = 1
  # MULTI  = ('one', 'two', 'three')

  ## this is not
  use constant {
      MULTI  => ('one', 'two', 'three'),
      SINGLE => 1,
  };
  #
  # produces three constants:
  # SINGLE = 1
  # MULTI  = 'one'
  # two    = 'three'

This policy detects raw lists in the hashref form of constant declaration.

CONFIGURATION

This Policy is not configurable except for the standard options.

COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.