Skip to content

Instantly share code, notes, and snippets.

@viliampucik
Created February 28, 2012 21:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viliampucik/1935159 to your computer and use it in GitHub Desktop.
Save viliampucik/1935159 to your computer and use it in GitHub Desktop.
Pure Perl Configuration File
{
database => 'donut',
user => 'homer',
password => 'simpson',
quote => {
give => 'me',
the => 'number',
for => 911,
},
}
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
use Safe;
my $config = Safe->new->rdo( 'app.conf' );
die "Couldn't parse config file: $@" if $@;
die 'Invalid config file' if not defined $config or ref $config ne 'HASH';
print Dumper $config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment