fixed for cpan
[gitmo/MooseX-Attribute-ENV.git] / README
CommitLineData
650d6350 1MooseX-Attribute-ENV
2
3This is a L<Moose> attribute trait that you use when you want the default value
4for an attribute to be populated from the %ENV hash. So, for example if you
5have set the environment variable MYAPP_MYCLASS_USERNAME = 'John' you can do:
6
7 package MyApp::MyClass;
8
9 use Moose;
10 use MooseX::Attribute::ENV;
11
12 has 'username' => (is=>'ro', traits=>['ENV']);
13
14 package main;
15
16 my $myclass = MyApp::MyClass->new();
17
18 print $myclass->username; # STDOUT => 'John';
19
20This is basically similar functionality to something like:
21
22 has 'attr' => (
23 is=>'ro',
24 default=> sub {
25 $ENV{uc __PACKAGE_.'attr'};
26 },
27 );
28
29but this module has a few other features that offer merit, as well as being a
30simple enough attribute trait that I hope it can serve as a learning tool.
31
32INSTALLATION
33
34To install this module, run the following commands:
35
36 perl Makefile.PL
37 make
38 make test
39 make install
40
41SUPPORT AND DOCUMENTATION
42
43After installing, you can find documentation for this module with the
44perldoc command.
45
46 perldoc MooseX-Attribute-ENV
47
48You can also look for information at:
49
50 RT, CPAN's request tracker
51 http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooseX-Attribute-ENV
52
53 AnnoCPAN, Annotated CPAN documentation
54 http://annocpan.org/dist/MooseX-Attribute-ENV
55
56 CPAN Ratings
57 http://cpanratings.perl.org/d/MooseX-Attribute-ENV
58
59 Search CPAN
60 http://search.cpan.org/dist/MooseX-Attribute-ENV
61
62
63COPYRIGHT AND LICENCE
64
65Copyright (C) 2008 John Napiorkowski
66
67This program is free software; you can redistribute it and/or modify it
68under the same terms as Perl itself.
69