Pragmatic directives

From Rosetta Code
Pragmatic directives is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Pragmatic directives cause the language to operate in a specific manner, allowing support for operational variances within the program code (possibly by the loading of specific or alternative modules).

The task is to list any pragmatic directives supported by the language, demostrate how to activate and deactivate the pragmatic directives and to describe or demonstate the scope of effect that the pragmatic directives have within a program.

Perl

By convention pragmatic modules are named using lowercase letters.

List of pragmatic modules

  • diagnostics
  • english
  • feature
  • integer
  • lib
  • ops
  • sort
  • strict
  • switch
  • warnings

Utilization

Pragmatic modules have local scope and are utilized using the use directive:

<lang perl>use warnings; # use warnings pragma module use strict; # use strict pragma module</lang>

To disable behaviour of a pragmatic module:

<lang perl>no warnings; # disable warnings pragma module no strict; # disable strict pragma module</lang>