File Coverage

blib/lib/MooseX/Method/Constant.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             package MooseX::Method::Constant;
2              
3 1     1   2266 use Moose;
  0            
  0            
4              
5             our $VERSION = '0.01';
6              
7             our $AUTHORITY = 'cpan:BERLE';
8              
9             our $count;
10              
11             sub make {
12             my ($class,$value) = @_;
13              
14             $count++;
15              
16             no strict qw/refs/;
17              
18             *{"$class\::constant_$count"} = sub () { $value };
19              
20             return "$class\::constant_$count()";
21             }
22              
23             1;
24              
25             __END__
26              
27             =head1 NAME
28              
29             MooseX::Method::Constant - Constant generator for MooseX::Method
30              
31             =head1 WARNING
32              
33             This API is unstable, it may change at any time. This should not
34             affect ordinary L<MooseX::Method> usage.
35              
36             =head1 SYNOPSIS
37              
38             use MooseX::Method::Constant;
39              
40             my $constant = MooseX::Method::Constant->make;
41              
42             print eval "$constant";
43              
44             =head1 DESCRIPTION
45              
46             Primarily used within the inlining compiler suite of MooseX::Method,
47             and there are no guarantees this won't be gone tomorrow.
48              
49             =head1 METHODS
50              
51             =over 4
52              
53             =item make
54              
55             Makes a constant.
56              
57             =back
58              
59             =head1 BUGS
60              
61             Most software has bugs. This module probably isn't an exception.
62             If you find a bug please either email me, or add the bug to cpan-RT.
63              
64             =head1 AUTHOR
65              
66             Anders Nor Berle E<lt>debolaz@gmail.comE<gt>
67              
68             =head1 COPYRIGHT AND LICENSE
69              
70             Copyright 2007 by Anders Nor Berle.
71              
72             This library is free software; you can redistribute it and/or modify
73             it under the same terms as Perl itself.
74              
75             =cut
76