Release commit for 0.28
[p5sagit/Config-Any.git] / lib / Config / Any / Perl.pm
CommitLineData
f0e3c221 1package Config::Any::Perl;
2
3use strict;
4use warnings;
5
dcfb1d1d 6use base 'Config::Any::Base';
1febe9e7 7use File::Spec;
dcfb1d1d 8
f0e3c221 9=head1 NAME
10
11Config::Any::Perl - Load Perl config files
12
13=head1 DESCRIPTION
14
15Loads Perl files. Example:
16
17 {
18 name => 'TestApp',
19 'Controller::Foo' => {
20 foo => 'bar'
21 },
22 'Model::Baz' => {
23 qux => 'xyzzy'
24 }
25 }
26
27=head1 METHODS
28
29=head2 extensions( )
30
31return an array of valid extensions (C<pl>, C<perl>).
32
33=cut
34
35sub extensions {
36 return qw( pl perl );
37}
38
39=head2 load( $file )
40
41Attempts to load C<$file> as a Perl file.
42
43=cut
44
45sub load {
46 my $class = shift;
47 my $file = shift;
f07b7a17 48
49 my( $exception, $content );
77bb967e 50 {
51 local $@;
1febe9e7 52 $content = do File::Spec->rel2abs($file);
77bb967e 53 $exception = $@;
83020fbd 54 }
77bb967e 55 die $exception if $exception;
83020fbd 56
77bb967e 57 return $content;
f0e3c221 58}
59
60=head1 AUTHOR
61
a918b0b8 62Brian Cassidy E<lt>bricas@cpan.orgE<gt>
f0e3c221 63
64=head1 COPYRIGHT AND LICENSE
65
3d43e104 66Copyright 2006-2016 by Brian Cassidy
f0e3c221 67
68This library is free software; you can redistribute it and/or modify
69it under the same terms as Perl itself.
70
71=head1 SEE ALSO
72
73=over 4
74
75=item * L<Catalyst>
76
77=item * L<Config::Any>
78
79=back
80
81=cut
82
831;