Group
Extension

Matches 2

Flexconf ( O/OK/OKLAS/Flexconf-0.01.tar.gz, OKLAS, 2017; MetaCPAN )
Flexconf/lib/Flexconf/Json.pm ( view source; MetaCPAN )
package Flexconf::Json;

use JSON::MaybeXS;

sub parse {
  return decode_json shift;
}

sub stringify {
  return encode_json shift;
}

sub load {
   my ( $filepath ) = @_;
   local $/;
   open FH, "<"
  $conf = decode_json $conf;
   close FH;
   $conf;
}

sub save {
   my ( $filepath, $conf ) = @_;
   open FH, ">", $filepath or die("Could not open file. $!");
   print FH encode_json $conf;
   close
Flexconf ( O/OK/OKLAS/Flexconf-0.01.tar.gz, OKLAS, 2017; MetaCPAN )
Flexconf/lib/Flexconf.pm ( view source; MetaCPAN )
or stringify, format: 'json'||'yaml'
    $conf->parse(format => '{"k":"v"}')
    $string = $conf->stringify('format')

    # save or load, format (may be ommitted): 'auto'||'json'||'yaml'
    $conf->l
e('k.v')

=head1 DESCRIPTION

Flexconf is base for configuration management

=cut


use Flexconf::Json;
use Flexconf::Yaml;

sub new {
  my ($package, $data) = @_;
  my $self = bless {data => $data}, 
f::Json' if 'json' eq $type;
  return 'Flexconf::Yaml' if 'yaml' eq $type;
  die 'wrong conf format'
}


sub type_by_filename {
  my ($self, $filename) = @_;
  return 'json' if $filename =~ /\.json$/;

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.