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

Exporter::Constants - Declare constants and export it.

SYNOPSIS

package My::Constants;
# declare constants and push to @EXPORT
use parent qw/Exporter/;
our @EXPORT;
our @EXPORT_OK;

use Exporter::Constants (
    \@EXPORT => {
        'TYPE_A' => 4649,
        'TYPE_B' => 5963
    },
    \@EXPORT_OK => {
        'TYPE_C' => 1919,
        'TYPE_D' => 0721
    }
);

package main;
use My::Constants;

# constants are exported.
print TYPE_A, "\n";

DESCRIPTION

This module help to declare & export constants.

MOTIVATION

I want to declare My::Own::Constants package when writing applications. These class declares constants and export to other application classes.

I can do this task by Exporter.pm and constants.pm. But I want to do it at once.

AUTHOR

Tokuhiro Matsuno <tokuhirom AAJKLFJEF@ GMAIL COM>

LICENSE

Copyright (C) Tokuhiro Matsuno

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