pod cleanups
[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;
273db69d 8use Cwd ();
dcfb1d1d 9
f0e3c221 10=head1 NAME
11
12Config::Any::Perl - Load Perl config files
13
14=head1 DESCRIPTION
15
16Loads Perl files. Example:
17
18 {
19 name => 'TestApp',
20 'Controller::Foo' => {
21 foo => 'bar'
22 },
23 'Model::Baz' => {
24 qux => 'xyzzy'
25 }
26 }
27
28=head1 METHODS
29
30=head2 extensions( )
31
32return an array of valid extensions (C<pl>, C<perl>).
33
34=cut
35
36sub extensions {
37 return qw( pl perl );
38}
39
40=head2 load( $file )
41
42Attempts to load C<$file> as a Perl file.
43
44=cut
45
46sub load {
47 my $class = shift;
48 my $file = shift;
f07b7a17 49
50 my( $exception, $content );
77bb967e 51 {
52 local $@;
273db69d 53 # previously this would load based on . being in @INC, and wouldn't
54 # trigger taint errors even if '.' probably should have been considered
55 # tainted. untaint for backwards compatibility.
56 my ($cwd) = Cwd::cwd() =~ /\A(.*)\z/s;
57 $content = do File::Spec->rel2abs($file, $cwd);
c6341999 58 $exception = $@ || $!
59 if !defined $content;
83020fbd 60 }
77bb967e 61 die $exception if $exception;
83020fbd 62
77bb967e 63 return $content;
f0e3c221 64}
65
66=head1 AUTHOR
67
20190ef7 68Brian Cassidy <bricas@cpan.org>
f0e3c221 69
70=head1 COPYRIGHT AND LICENSE
71
3d43e104 72Copyright 2006-2016 by Brian Cassidy
f0e3c221 73
74This library is free software; you can redistribute it and/or modify
19f6cb63 75it under the same terms as Perl itself.
f0e3c221 76
77=head1 SEE ALSO
78
19f6cb63 79=over 4
f0e3c221 80
81=item * L<Catalyst>
82
83=item * L<Config::Any>
84
85=back
86
87=cut
88
891;