NAME
Constant::Runtime - Generates constants at runtime
SYNOPSIS
use Constant::Runtime;
Constant::Runtime->make ("Foo",42);
print Foo();
Constant::Runtime->make ("Foo::Bar",42);
print Foo::Bar();
my $constant = Constant::Runtime->make_anon (42);
print eval "$constant";
DESCRIPTION
This module was born as a tool to generate constants for optimizing runtime code evaluation for MooseX::Method. Feel free to use it for whatever you can imagine though.
METHODS
- make ($constant_name,$value)
-
Constant::Runtime->make ("Foo",42);
This will make a constant in the calling class by the name "Foo".
Constant::Runtime->make ("Someclass::Constant",42)
This will make a constant in the specified class by the name "Foo".
- make_anon ($value)
-
my $anonymous_constant = Constant::Runtime->make_anon (42);
Used for generating an anonymous constant. Technically, the constant will have a name, you just won't care about what it is, only that you can use it.
BUGS
Most software has bugs. This module probably isn't an exception. If you find a bug please either email me, or add the bug to cpan-RT.
AUTHOR
Anders Nor Berle <debolaz@gmail.com>
COPYRIGHT AND LICENSE
Copyright 2007 by Anders Nor Berle.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.