1 package Config::Any::Base;
8 Config::Any::Base - Base class for loaders
12 This is a base class for all loaders. It currently handles the specification
13 of dependencies in order to ensure the subclass can load the config file
18 =head2 is_supported( )
20 Allows us to determine if the file format can be loaded. The can be done via
21 one of two subclass methods:
25 =item * C<requires_all_of()> - returns an array of items that must all be present in order to work
27 =item * C<requires_any_of()> - returns an array of items in which at least one must be present
31 You can specify a module version by passing an array reference in the return.
33 sub requires_all_of { [ 'My::Module', '1.1' ], 'My::OtherModule' }
35 Lack of specifying these subs will assume you require no extra modules to function.
40 my ( $class ) = shift;
42 if ( $class->can( 'requires_all_of' ) ) {
44 _require($_) for $class->requires_all_of;
48 if ( $class->can( 'requires_any_of' ) ) {
49 eval { _require( $_ ); 1 } and return 1
50 for $class->requires_any_of;
59 my ( $input ) = shift;
60 my ( $module, $version ) = ( ref $input ? @$input : $input );
61 (my $file = "$module.pm") =~ s{::}{/}g;
63 $module->VERSION if $version;
68 Brian Cassidy <bricas@cpan.org>
70 =head1 COPYRIGHT AND LICENSE
72 Copyright 2008-2009 by Brian Cassidy
74 This library is free software; you can redistribute it and/or modify
75 it under the same terms as Perl itself.
81 =item * L<Config::Any>