The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Full::Pragmata - common pragmata for Perl scripts and modules

SYNOPSIS

 # in your script or module:
 use Full::Pragmata;
 # use strict, warnings, utf8 etc. are all now applied and in scope

DESCRIPTION

Perl has many modules and features, including some features which are somewhat discouraged in recent code.

This module attempts to provide a good set of functionality for writing code without too many lines of boilerplate. It has been extracted from Myriad::Class so that it can be used in other code without pulling in too many irrelevant dependencies.

The following Perl language features and modules are applied to the caller:

In addition, the following core features are enabled:

Constraints and checks

Data::Checks is imported with the following constraints available:

  • Defined

  • Object

  • Str

  • Num

  • StrEq

  • NumGT

  • NumGE

  • NumLE

  • NumLT

  • NumRange

  • NumEq

  • Isa

  • ArrayRef

  • HashRef

  • Callable

  • Maybe

  • Any

  • All

Note that Data::Checks provides the underlying support for constraints, but actual usage involves a combination of other modules:

Field constraints

These are supported through Object::Pad::FieldAttr::Checked:

 package Example;
 use Full::Class qw(:v2);
 field $checked :Checked(Str);

DESCRIPTION

The following Perl language features and modules are applied to the caller:

In addition, the following core features are enabled:

This also makes available a Log::Any instance in the $log package variable, and for OpenTracing::Any support you get $tracer as an OpenTracing::Tracer instance.

VERSIONING

A version tag is required:

 use Full::Pragmata qw(:v1);

Currently :v1 is the only version available. It's very likely that future versions will bring in new functionality or enable/disable a different featureset, or may remove functionality or behaviour that's no longer appropriate.

SEE ALSO

There are many modules which provide similar functionality. Here are a few examples, in no particular order:

AUTHOR

Original code can be found at https://github.com/deriv-com/perl-Myriad/tree/master/lib/Myriad/Class.pm, by Deriv Group Services Ltd. DERIV@cpan.org. This version has been split out as a way to provide similar functionality.

LICENSE

Released under the same terms as Perl itself.