skarsnik / perl6-config-simple Goto Github PK
View Code? Open in Web Editor NEWA simple perl6 module for your config need
License: Artistic License 2.0
A simple perl6 module for your config need
License: Artistic License 2.0
Hi!
I see warnings raised when execute my code which use Config::Simple.
WARNING: unhandled Failure detected in DESTROY. If you meant to ignore it, you can mark it as handled by calling .Bool, .so, .not, or .defined methods. The Failure was:
No such symbol 'Config::Simple::ini'
in method read at /home/melezhik/.rakudobrew/moar-2017.06/install/share/perl6/site/sources/40865DBAA12A9141883E938CAF1031769F31FF08 (Config::Simple) line 11
in sub MAIN at /home/melezhik/.rakudobrew/moar-2017.06/install/share/perl6/site/resources/451B49334CBDAF3F56532B8B4A31492E4B77D4A8 line 62
in block <unit> at /home/melezhik/.rakudobrew/moar-2017.06/install/share/perl6/site/resources/451B49334CBDAF3F56532B8B4A31492E4B77D4A8 line 366
Stack trace:
# /home/melezhik/.rakudobrew/moar-2017.06/install/share/perl6/site/sources/40865DBAA12A9141883E938CAF1031769F31FF08
1 use Config::Simple::Role;
2 use Data::Dump;
3 use MONKEY-SEE-NO-EVAL;
4
5 class Config::Simple does Config::Simple::Role {
6
7 method read($filename, Str :$f) {
8 my $this;
9 if ($f) {
10 my $module = "Config::Simple::$f";
11 require ::($module);
12 $this = ::($module).new();
13 $this.read($filename);
14 } else {
15 my $text = slurp($filename);
16 $this = self.bless(:filename($filename), :hash(EVAL($text)));
17 }
18 return $this;
19 }
20
21 method new(Str :$f) {
22 if ($f) {
23 my $module = "Config::Simple::$f";
24 require ::($module);
25 return ::($module).new();
26 }
27 return self.bless();
28 }
29
30 method write($filename = Any) {
31 $.filename = $filename if $filename.defined;
32 my $fh = open $.filename, :w;
33 $fh.print(Dump(%(%!hash), :color(False)));
34 $fh.print("\n");
35 $fh.close;
36 }
37
38 }
# /home/melezhik/.rakudobrew/moar-2017.06/install/share/perl6/site/resources/451B49334CBDAF3F56532B8B4A31492E4B77D4A8
1 use Terminal::ANSIColor;
2 use JSON::Tiny;
3 use Sparrowdo;
4 use Sparrowdo::Core::DSL::User;
5 use Sparrowdo::Core::DSL::Group;
6 use Sparrowdo::Core::DSL::File;
7 use Sparrowdo::Core::DSL::Directory;
8 use Sparrowdo::Core::DSL::Template;
9 use Sparrowdo::Core::DSL::Systemd;
10 use Sparrowdo::Core::DSL::Package;
11 use Sparrowdo::Core::DSL::CPAN::Package;
12 use Sparrowdo::Core::DSL::Zef;
13 use Sparrowdo::Core::DSL::Git;
14 use Sparrowdo::Core::DSL::Service;
15 use Sparrowdo::Core::DSL::Bash;
16 use Sparrowdo::Core::DSL::Ssh;
17 use Sparrowdo::Core::DSL::Assert;
18 use Config::Simple;
19
20
21 sub MAIN (
22
23 Str :$host = '127.0.0.1',
24 Str :$sparrowfile,
25 Str :$http_proxy,
26 Str :$https_proxy,
27 Str :$ssh_user,
28 Str :$ssh_private_key,
29 Int :$ssh_port = 22,
30 Bool :$verbose = False,
31 Bool :$bootstrap = False,
32 Bool :$check_syntax = False,
33 Str :$module_run,
34 :$task_run,
35 Bool :$no_sudo = False,
36 Bool :$no_color = False,
37 Bool :$no_index_update = False,
38 Str :$sparrow_root = '/opt/sparrow',
39 Str :$repo,
40 Bool :$local_mode = False,
41 Str :$password,
42 Str :$docker,
43 Str :$cwd,
44 Str :$format,
45 )
46
47 {
48
49 # read config if exists
50
51 my $sparrowdo-cache = %*ENV<USER> ?? '/home/' ~ %*ENV<USER> ~ '/.sparrowdo/' ~ $sparrow_root !! '/.sparrowdo';
52
53 shell "rm -rf $sparrowdo-cache/";
54
55 mkdir "$sparrowdo-cache/plugins";
56
57 my $conf-ini-file = %*ENV<USER> ?? '/home/' ~ %*ENV<USER> ~ '/sparrowdo.ini' !! ( $sparrow_root ~ '/sparrowdo.ini' );
58
59 my $conf-ini = Hash.new;
60
61 if $conf-ini-file.IO ~~ :e {
62 Config::Simple.read($conf-ini-file,:f("ini"))
63 }
# /home/melezhik/.rakudobrew/moar-2017.06/install/share/perl6/site/resources/451B49334CBDAF3F56532B8B4A31492E4B77D4A8
366 sub bootstrap ( $sparrow_root, $sparrowdo-cache ) {
367
368 my $host = input_params('Host');
369 say input_params('NoColor') ??
370 'running sparrow bootstrap for host: ' ~ $host ~ ' ... ' !!
371 colored( 'running sparrow bootstrap for host: ' ~ $host ~ ' ... ', 'bold black on_yellow');
...
My environment:
perl6 -v
This is Rakudo version 2017.06 built on MoarVM version 2017.06
implementing Perl 6.c.
zef locate Config::Simple
===> From Distribution: Config::Simple:ver<*>:auth<Sylvain Colinet>:api<>
Config::Simple => /home/melezhik/.rakudobrew/moar-2017.06/install/share/perl6/site/sources/40865DBAA12A9141883E938CAF1031769F31FF08
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.