Constant::Runtime - Generates constants at runtime
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";
This module was born as a tool to generate constants for optimizing runtime code evaluation for the MooseX::Method manpage. Feel free to use it for whatever you can imagine though.
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".
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.
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.
Anders Nor Berle <debolaz@gmail.com>
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.