daily pastebin goal
24%
SHARE
TWEET

Untitled

a guest Dec 7th, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         my $loader = sub {
  2.             my $slurp = '';
  3.  
  4.             {
  5.                 local $/ = undef;
  6.                 open my $config, '<', $self->configfile;
  7.                 $slurp = <$config>;
  8.                 close $config;
  9.             }
  10.  
  11.             return $slurp;
  12.         };
  13.  
  14.         # try json
  15.         try {
  16.             my $json = JSON->new;
  17.             $self->config( $json->decode( $loader->() ));
  18.         }
  19.         # try yaml
  20.         catch {
  21.             $self->config( Load $loader->() );
  22.         }
RAW Paste Data
Top