| 1 | package Class::Component::Component::Plaggerize::ConfigLoader; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | |||
| 5 | use YAML (); | ||
| 6 | |||
| 7 | sub setup_config { | ||
| 8 | my $class = shift; | ||
| 9 | my($config_file) = @_; | ||
| 10 | |||
| 11 | my $config = $class->NEXT( setup_config => @_ ); | ||
| 12 | $config_file = $config || $config_file || {}; | ||
| 13 | return $config_file if ref($config_file); | ||
| 14 | |||
| 15 | open my $fh, '<:utf8', $config_file or die $!; | ||
| 16 | $config = YAML::LoadFile($fh); | ||
| 17 | close $fh; | ||
| 18 | |||
| 19 | $config; | ||
| 20 | } | ||
| 21 | |||
| 22 | 1; |