1
0
Fork 0
mirror of https://github.com/perlbot/perlbuut-pastebin synced 2025-06-08 14:46:47 -04:00
perlbuut-pastebin/lib/App/Config.pm

24 lines
389 B
Perl

package App::Config;
use strict;
use warnings;
use Exporter qw/import/;
use Data::Dumper;
use FindBin qw($Bin);
use TOML;
our @EXPORT=qw/$cfg/;
our $cfg = do {
my $toml = do {open(my $fh, "<", "$Bin/app.cfg"); local $/; <$fh>};
# With error checking
my ($data, $err) = from_toml($toml);
unless ($data) {
die "Error parsing toml: $err";
}
$data;
};
1;