Neil Bowers

NAME

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

SYNOPSIS

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

 1;

And then to use the constants:

 use MyConstants;

 print "The answer = $ANSWER\n";

DESCRIPTION

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.

SEE ALSO

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

REPOSITORY

https://github.com/neilb/Const-Fast-Exporter

AUTHOR

Neil Bowers <neilb@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Neil Bowers <neilb@cpan.org>.

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