NAME

    Const::Exporter - Declare constants for export.

REQUIREMENTS

    This module requires Perl v5.10 or newer, and the following non-core
    modules:

    Const::Fast

    Hash::Objectify (for testing)

    Package::Stash

    Test::Most (for testing)

SYNOPSIS

    Define a constants module:

      package MyApp::Constants;
    
      use Const::Fast;
    
      our $zoo => 1234;
    
      use Const::Exporter
    
         tag_a => [                  # use MyApp::Constants /:tag_a/;
            'foo'  => 1,             # exports "foo"
            '$bar' => 2,             # exports "$bar"
            '@baz' => [qw/ a b c /], # exports "@baz"
            '%bo'  => { a => 1 },    # exports "%bo"
         ],
    
         tag_b => [                  # use MyApp::Constants /:tag_b/;
            'foo',                   # exports "foo" (same as from ":tag_a")
            '$zoo',                  # exports "$zoo" (as defined above)
         ];
    
      # `use Const::Exporter` can be specified multiple times
    
      use Const::Exporter
    
         tag_b => [                 # we can add symbols to ":tab_b"
            'moo' => $bar,          # exports "moo" (same value as "$bar")
         ],
    
         enums => [
    
           [qw/ goo gab gub /] => 0, # exports enumerated symbols, from 0..2
    
         ],
    
         default => [qw/ fo $bar /]; # exported by default

    and use that module:

      package MyApp;
    
      use MyApp::Constants qw/ $zoo :tag_a /;
    
      ...

DESCRIPTION

    This module allows you to declare constants that can be exported to
    other modules.

SEE ALSO

    See Exporter for a discussion of export tags.

 Similar Modules

    Exporter::Constants

      This module only allows you to declare function symbol constants,
      akin to the constant module, without tags.

    Constant::Exporter

      This module only allows you to declare function symbol constants,
      akin to the constant module, although you can specify tags.

    Constant::Export::Lazy

      This module only allows you to declare function symbol constants,
      akin to the constant module by defining functions that are only
      called as needed. The interface is rather complex.

AUTHOR

    Robert Rothenberg, <rrwo at cpan.org>

LICENSE AND COPYRIGHT

    Copyright 2014-2015 Robert Rothenberg.

    This program is free software; you can redistribute it and/or modify it
    under the terms of the the Artistic License (2.0). You may obtain a
    copy of the full license at:

    http://www.perlfoundation.org/artistic_license_2_0

