Aion-Enum
view release on metacpan or search on metacpan
lib/Aion/Enum.pm view on Meta::CPAN
my ($cls) = @_;
$cls = ref $cls || $cls;
my $alias_ref = $ALIAS{$cls};
return $alias_ref if $alias_ref;
my $alias_ref = $ALIAS{$cls} = {};
my $path = $INC{($cls =~ s!::!/!gr) . ".pm"};
die "$cls not loaded!" unless $path;
open my $f, "<:utf8", $path or die "$path: $!";
my $alias;
my $id = '[a-zA-Z_]\w*';
while(<$f>) {
$alias = $1 if /^# (\S.*?)\s*$/;
do {
$alias_ref->{$+{id}} = $alias;
undef $alias;
} if /^case \s+ (
(?<id>$id)
lib/Aion/Enum.pm view on Meta::CPAN
sub tryFromAlias {
my ($cls, $alias) = @_;
my ($case) = grep { $_->{alias} ~~ $alias } $cls->cases;
$case
}
1;
__END__
=encoding utf-8
=head1 NAME
Aion :: Enum - Listing in the style of OOP, when each renewal is an object
=head1 VERSION
0.0.3
=head1 SYNOPSIS
t/aion/enum.t view on Meta::CPAN
use common::sense; use open qw/:std :utf8/; use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//; use Test::More 0.98; BEGIN { $SIG{__DI...
# # NAME
#
# Aion::Enum - пеÑеÑиÑÐ»ÐµÐ½Ð¸Ñ Ð² ÑÑиле ÐÐÐ, когда каждое пеÑеÑÑление ÑвлÑеÑÑÑ Ð¾Ð±ÑекÑом
#
# # VERSION
#
# 0.0.2
#
# # SYNOPSIS
#
( run in 0.443 second using v1.01-cache-2.11-cpan-13bb782fe5a )