Const::Fast::Exporter - create a module that exports Const::Fast immutable variables


Create your module that defines the constants:

 package MyConstants;
 use Const::Fast::Exporter;

 const our $ANSWER => 42;
 const our @COLORS => qw/ red green blue /;
 const our %ORIGIN => { x => 0, y => 0 };


And then to use the constants:

 use MyConstants;

 print "The answer = $ANSWER\n";


This module is helpful if you want to create a module that defines Const::Fast immutable variables, which are then exported. The SYNOPSIS provides just about everything you need to know. When you use Const::Fast::Exporter, it loads Const::Fast for you, which is why there isn't a use Const::Fast line in the SYNOPSIS.

Note: the interface should be considered unstable. At the moment it is very simple -- it just exports all symbols. Possibly there should be an option to specify whether everything is an optional export, with a -all switch. Maybe you'd do something like:

 use Const::Fast::Exporter -requested;

Which says that people have to specifically request the constants they want, rather than getting all of them by default.

If you want to define tags, then you should probably just use Exporter or similar.


Const::Fast - lets you define read-only scalars, hashes, and arrays.

Const::Exporter - another module you can use to create your own module that exports constant and immutable variables.

Exporter::Constants - declare and export function-based constants, similar to those declared with the constant pragma.

Constant::Exporter - declare and export function-based constants.

Constant::Export::Lazy - create a module that exports constants, where the value is only generated the first time its used.



Neil Bowers <>


This software is copyright (c) 2017 by Neil Bowers <>.

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