MooseX::Method::Constant - Constant generator for MooseX::Method


MooseX-Method documentation Contained in the MooseX-Method distribution.

Index


Code Index:

NAME

Top

MooseX::Method::Constant - Constant generator for MooseX::Method

WARNING

Top

This API is unstable, it may change at any time. This should not affect ordinary MooseX::Method usage.

SYNOPSIS

Top

  use MooseX::Method::Constant;

  my $constant = MooseX::Method::Constant->make;

  print eval "$constant";

DESCRIPTION

Top

Primarily used within the inlining compiler suite of MooseX::Method, and there are no guarantees this won't be gone tomorrow.

METHODS

Top

make

Makes a constant.

BUGS

Top

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

Top

Anders Nor Berle <debolaz@gmail.com>

COPYRIGHT AND LICENSE

Top


MooseX-Method documentation Contained in the MooseX-Method distribution.

package MooseX::Method::Constant;

use Moose;

our $VERSION = '0.01';

our $AUTHORITY = 'cpan:BERLE';

our $count;

sub make {
  my ($class,$value) = @_;

  $count++;

  no strict qw/refs/;

  *{"$class\::constant_$count"} = sub () { $value };

  return "$class\::constant_$count()";
}

1;

__END__