Keyword-Declare
view release on metacpan or search on metacpan
lib/Keyword/Declare.pm view on Meta::CPAN
if (${^H}{"Keyword::Declare debug"}) {
my $msg = ("#" x 50) . "\n"
. " Installed keytype at $keytype_info{location}:\n\n$keytype_info{syntax}\n\n"
. ("#" x 50) . "\n";
$msg =~ s{^}{###}gm;
warn $msg;
}
# Install the lexical type definition...
$$src_ref
= qq{BEGIN{\$^H{q{Keyword::Declare keytype:$keytype_info{newtype}=$keytype_info{oldtype}}} = 1;}}
. $sigil_decl
. $$src_ref;
};
# Install the 'keyword' (meta-)keyword...
Keyword::Simple::define 'keyword', sub {
# Unpack trailing code...
my ($src_ref) = @_;
# Where was this keyword declared???
lib/Keyword/Declare.pm view on Meta::CPAN
. " Uninstalled keyword macro: $keyword_info{keyword}(...)\n"
. " at $file line $line\n"
. ("#" x 50) . "\n";
$msg =~ s{^}{###}gm;
warn $msg;
}
# How to remove the Keyword::Simple keyword (with workaround for earlier versions)...
my $keyword_defn = q{Keyword::Simple::undefine( 'KEYWORD' );};
if ($Keyword::Simple::VERSION < 0.04) {
$keyword_defn .= "\$^H{'Keyword::Simple/keywords'} =~ s{ KEYWORD:-?\\d*}{}g;" ;
}
# How to remove the Keyword::Declare keywords...
$keyword_defn .= q{
delete @^H{ grep m{^ Keyword::Declare \s+ active:KEYWORD:}xms, keys %^H };
};
$keyword_defn =~ s{KEYWORD}{$keyword_info{keyword}}g;
# Uninstall the keyword, exporting it as well if it's in an import() or unimport() sub...
$$src_ref = qq{ if (((caller 0)[3]//q{}) =~ /\\b(?:un)?import\\Z/) { $keyword_defn } }
( run in 1.071 second using v1.01-cache-2.11-cpan-49f99fa48dc )