Commit | Line | Data |
c80a0905 |
1 | package Config::Any::XML;\r |
2 | \r |
3 | use strict;\r |
4 | use warnings;\r |
5 | \r |
6 | =head1 NAME\r |
7 | \r |
8 | Config::Any::XML - Load XML config files\r |
9 | \r |
10 | =head1 DESCRIPTION\r |
11 | \r |
12 | Loads XML files. Example:\r |
13 | \r |
14 | <config>\r |
15 | <name>TestApp</name>\r |
16 | <component name="Controller::Foo">\r |
17 | <foo>bar</foo>\r |
18 | </component>\r |
19 | <model name="Baz">\r |
20 | <qux>xyzzy</qux>\r |
21 | </model>\r |
22 | </config>\r |
23 | \r |
24 | =head1 METHODS\r |
25 | \r |
26 | =head2 extensions( )\r |
27 | \r |
28 | return an array of valid extensions (C<xml>).\r |
29 | \r |
30 | =cut\r |
31 | \r |
32 | sub extensions {\r |
33 | return qw( xml );\r |
34 | }\r |
35 | \r |
36 | =head2 load( $file )\r |
37 | \r |
38 | Attempts to load C<$file> as an XML file.\r |
39 | \r |
40 | =cut\r |
41 | \r |
42 | sub load {\r |
43 | my $class = shift;\r |
44 | my $file = shift;\r |
45 | \r |
46 | require XML::Simple;\r |
47 | XML::Simple->import;\r |
48 | my $config = XMLin( $file, ForceArray => [ qw( component model view controller ) ] );\r |
49 | \r |
50 | return $config;\r |
51 | }\r |
52 | \r |
53 | =head1 AUTHOR\r |
54 | \r |
55 | =over 4 \r |
56 | \r |
57 | =item * Brian Cassidy E<lt>bricas@cpan.orgE<gt>\r |
58 | \r |
59 | =back\r |
60 | \r |
61 | =head1 COPYRIGHT AND LICENSE\r |
62 | \r |
63 | Copyright 2006 by Brian Cassidy\r |
64 | \r |
65 | This library is free software; you can redistribute it and/or modify\r |
66 | it under the same terms as Perl itself. \r |
67 | \r |
68 | =head1 SEE ALSO\r |
69 | \r |
70 | =over 4 \r |
71 | \r |
72 | =item * L<Catalyst>\r |
73 | \r |
74 | =item * L<Config::Any>\r |
75 | \r |
76 | =item * L<XML::Simple>\r |
77 | \r |
78 | =back\r |
79 | \r |
80 | =cut\r |
81 | \r |
82 | 1; |