apply Getopt trait if available
[gitmo/MooseX-ConfigFromFile.git] / lib / MooseX / ConfigFromFile.pm
index 2de2688..5bdc8c3 100644 (file)
@@ -15,6 +15,7 @@ has configfile => (
     isa => File,
     coerce => 1,
     predicate => 'has_configfile',
+    do { try { require MooseX::Getopt; (traits => ['Getopt']) } },
 );
 
 sub new_with_config {
@@ -138,6 +139,10 @@ Note that you can alternately just provide a C<configfile> method which returns
 the config file when called - this will be used in preference to the default of
 the attribute.
 
+If you have L<MooseX::Getopt> installed, this attribute will also have the
+C<Getopt> trait supplied, so you can also set the configfile from the
+command line.
+
 =head1 Class Methods
 
 =head2 new_with_config