NAME

Enum::Declare::Common - A curated collection of commonly-needed enums

VERSION

Version 0.01

SYNOPSIS

use Enum::Declare::Common::HTTP;
use Enum::Declare::Common::Calendar;

# HTTP status codes
my $meta = StatusCode();
say OK;          # 200
say NotFound;    # 404

# HTTP methods
say GET;         # "get"

# Calendar
say Monday;      # 1
say January;     # 1

DESCRIPTION

Enum::Declare::Common provides a collection of frequently used enums built on Enum::Declare. Each submodule declares standard enums with proper constants, export support, and meta objects for introspection and exhaustive matching.

MODULES

USING WITH Object::Proto

Every enum in this collection is declared with the :Type attribute, which automatically registers it as an Object::Proto type at load time. This means you can use any enum name directly as a slot type:

use Enum::Declare::Common::HTTP qw(:StatusCode :Method);
use Enum::Declare::Common::LogLevel qw(:Level);
use Object::Proto;

object 'APIRequest',
    'method:Method:required',
    'status:StatusCode',
    'log_level:Level:default(' . Info . ')',
;

my $req = new APIRequest method => GET;
$req->status(OK);             # accepts valid enum value
$req->status(9999);           # dies — not a valid StatusCode

Enum types support coercion, so case-insensitive name lookups work automatically:

$req->status(200);            # coerces integer to OK

Note: Enum names must be unique across all loaded modules. For example, Enum::Declare::Common::Bool and Enum::Declare::Common::Permission both declare an enum named Bit, so loading both in the same program will cause a conflict. Import only the specific tags you need.

AUTHOR

LNATION <email@lnation.org>

LICENSE AND COPYRIGHT

This software is Copyright (c) 2026 by LNATION <email@lnation.org>.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

1 POD Error

The following errors were encountered while parsing the POD:

Around line 47:

Non-ASCII character seen before =encoding in '—'. Assuming UTF-8