Pragmatic directives: Difference between revisions
(Perl) |
m (→Utilization) |
||
Line 24: | Line 24: | ||
=== Utilization === |
=== Utilization === |
||
Pragmatic modules have local scope and are utilized using the use directive |
Pragmatic modules have local scope and are utilized using the use directive: |
||
For example: |
|||
<lang perl>use warnings; # use warnings pragma module |
<lang perl>use warnings; # use warnings pragma module |
Revision as of 20:33, 8 October 2011
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>