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.

Language features

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);

Other features

This also makes available a Log::Any instance in the $log package variable, and for OpenTelemetry support you get $tracer as an OpenTelemtry::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.

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.