Last active
August 29, 2015 14:07
-
-
Save dbiesecke/90ae2f1e5a28463f2527 to your computer and use it in GitHub Desktop.
Perl MooseX Skeleton
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use Data::Dumper; | |
use FindBin qw(); | |
use lib ( $FindBin::Bin.'/' , $FindBin::Bin.'/lib' , $FindBin::Bin.'/My' ); | |
use My::Cli; | |
for (@My::Cli::EXPORT) { | |
print "$_\n"; | |
} | |
My::Cli->new_with_command->run; | |
exit; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
require Exporter; | |
require Plugin::Tiny; | |
require Moose; | |
require Carp; | |
require Data::Dumper; | |
package My::Cli; | |
# base class of this(Arithmetic) module | |
use MooseX::App qw(Config Color ); | |
parameter 'username' => ( | |
is => 'rw', | |
isa => 'Str', | |
required => 1, | |
documentation => q[Username for login], | |
#cmd_tags => [qw(Important!)], # Extra tags. Displayed in square brackets | |
cmd_aliases => [qw(u)], # Alternative option name | |
); # Positional parameter | |
parameter 'password' => ( | |
is => 'rw', | |
isa => 'Str', | |
required => 1, | |
documentation => q[Password for login], | |
#cmd_tags => [qw(Important!)], # Extra tags. Displayed in square brackets | |
cmd_aliases => [qw(p)], # Alternative option name | |
); # Positional parameter | |
option 'debug' => ( | |
is => 'rw', | |
isa => 'Bool', | |
documentation => q[set Debug mode for verbose ], | |
); # Global option | |
option 'template' => ( | |
is => 'rw', | |
isa => 'Str', | |
documentation => q[set Template file for Spammer ], | |
); # Global option | |
has 'private' => ( | |
is => 'rw', | |
); # not exposed | |
# | |
# | |
#sub new() | |
#{ | |
# my ($class) = @_; | |
# my $self = {}; | |
# | |
# $self{config} = (); | |
# | |
# print Data::Dumper::Dumper($self{config})."\n"; | |
# | |
# return bless $self,$class; | |
# | |
#} | |
# | |
#sub config() | |
#{ | |
# #confess "usage: read->readfile(keyvalue)" unless @_ => 2; | |
# my ($self,$key,$val) = @_; | |
# print Data::Dumper::Dumper($self{config})."\n"; | |
# $self{config} = { $key => $val}; | |
# print Data::Dumper::Dumper($self{config})."\n"; | |
# | |
# return $self; | |
# | |
#} | |
# | |
# | |
# | |
#sub dd(){ | |
# my ($self) = @_; | |
# | |
# print Data::Dumper::Dumper($self{config})."\n"; | |
# | |
# my $ps = Plugin::Tiny->new ( prefix=>'Spammer::Plugin::' ); | |
# | |
# for (@My::Hotpatch::EXPORT) { | |
# print "$_\n"; | |
# } | |
# | |
#} | |
# | |
1; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
require Plugin::Tiny; | |
require Carp; | |
require Exporter; | |
require Moose; | |
package My::Cli::example; | |
use MooseX::App::Command; # important | |
extends qw(My::Cli); # purely optional, only if you want to use global options from base class | |
option 'max-msg' => ( | |
is => 'rw', | |
isa => 'Int', | |
documentation => q[Maximal Messages], | |
); # Option | |
command_short_description q[ example]; | |
command_long_description q[ example desc ]; | |
sub run { | |
my ($self,@arr) = @_; | |
print Data::Dumper::Dumper($self)."\n"; | |
# use WWW::WebKit; | |
# | |
# my $webkit = WWW::WebKit->new(xvfb => 1); | |
# $webkit->init; | |
# | |
#$webkit->open("http://www.drive2day.de/login"); | |
#$webkit->type("login", $self{username}); | |
# $webkit->type("password", $self{password}); | |
#$webkit->click("commit"); | |
#$webkit->wait_for_page_to_load(5000); | |
#print $webkit->get_title; | |
} | |
# sub do_some { print "Hello World @_\n" } | |
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global: | |
debug : 1 | |
drive2day: | |
max-msg: 100 | |
default-user: [email protected] | |
default-pass: 41498978Mm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment