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