3 This is a L<Moose> attribute trait that you use when you want the default value
4 for an attribute to be populated from the %ENV hash. So, for example if you
5 have set the environment variable MYAPP_MYCLASS_USERNAME = 'John' you can do:
7 package MyApp::MyClass;
10 use MooseX::Attribute::ENV;
12 has 'username' => (is=>'ro', traits=>['ENV']);
16 my $myclass = MyApp::MyClass->new();
18 print $myclass->username; # STDOUT => 'John';
20 This is basically similar functionality to something like:
25 $ENV{uc __PACKAGE_.'attr'};
29 but this module has a few other features that offer merit, as well as being a
30 simple enough attribute trait that I hope it can serve as a learning tool.
34 To install this module, run the following commands:
41 SUPPORT AND DOCUMENTATION
43 After installing, you can find documentation for this module with the
46 perldoc MooseX-Attribute-ENV
48 You can also look for information at:
50 RT, CPAN's request tracker
51 http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooseX-Attribute-ENV
53 AnnoCPAN, Annotated CPAN documentation
54 http://annocpan.org/dist/MooseX-Attribute-ENV
57 http://cpanratings.perl.org/d/MooseX-Attribute-ENV
60 http://search.cpan.org/dist/MooseX-Attribute-ENV
65 Copyright (C) 2008 John Napiorkowski
67 This program is free software; you can redistribute it and/or modify it
68 under the same terms as Perl itself.