Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- my $loader = sub {
- my $slurp = '';
- {
- local $/ = undef;
- open my $config, '<', $self->configfile;
- $slurp = <$config>;
- close $config;
- }
- return $slurp;
- };
- # try json
- try {
- my $json = JSON->new;
- $self->config( $json->decode( $loader->() ));
- }
- # try yaml
- catch {
- $self->config( Load $loader->() );
- }
Add Comment
Please, Sign In to add comment