X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Fconsole;h=ca20b2bfe36864bc31d0bf9e8aab64a4255bbd9e;hb=fe8d6c893279abaa76ea3e20424bbf5d66de071e;hp=6a9d000db785d63d8a258d1ffb174771a54ae103;hpb=b7fa831d13e666c28a8381474bf9458adc8ead3f;p=kivitendo-erp.git diff --git a/scripts/console b/scripts/console index 6a9d000db..ca20b2bfe 100755 --- a/scripts/console +++ b/scripts/console @@ -12,9 +12,7 @@ BEGIN { use Config::Std; use Data::Dumper; use Devel::REPL 1.002001; -eval { -require Term::ReadLine::Perl::Bind; # use sane key binding for rxvt users -}; +use Term::ReadLine::Perl::Bind; # use sane key binding for rxvt users read_config 'config/console.conf' => my %config;# if -f 'config/console.conf'; @@ -31,11 +29,21 @@ $repl->load_history($history_file); $repl->eval('help'); $repl->print("trying to auto login as '$login'..."); $repl->print($repl->eval("lxinit '$login'")); -$repl->print($repl->eval($autorun)) if $autorun; +if ($autorun) { + my $result = $repl->eval($autorun); + $repl->print($result->message) if ref($result) eq 'Devel::REPL::Error'; +} $repl->run; package Devel::REPL; +use utf8; +use CGI qw( -no_xhtml); +use SL::Auth; +use SL::Form; +use SL::Locale; +use SL::LXDebug; +use Data::Dumper; # this is a cleaned up version of am.pl # it lacks redirection, some html setup and most of the authentication process. @@ -51,25 +59,17 @@ sub lxinit { { no warnings 'once'; $::userspath = "users"; $::templates = "templates"; - $::memberfile = "users/members"; $::sendmail = "| /usr/sbin/sendmail -t"; } - use SL::LXDebug; - $::lxdebug = LXDebug->new; - - use CGI qw( -no_xhtml); - use SL::Auth; - use SL::Form; - use SL::Locale; - use Data::Dumper; - eval { require "config/lx-erp.conf"; }; eval { require "config/lx-erp-local.conf"; } if -f "config/lx-erp-local.conf"; - $::cgi = CGI->new qw(); - $::form = Form->new; - $::auth = SL::Auth->new; + $::lxdebug = LXDebug->new; + $::locale = Locale->new($::language); + $::cgi = CGI->new qw(); + $::form = Form->new; + $::auth = SL::Auth->new; die 'cannot reach auth db' unless $::auth->session_tables_present; @@ -112,18 +112,19 @@ sub help { Spezielle Kommandos: help - zeigt diese Hilfe an. - lxinit 'login' - lädt das Lx-Office Environment für den User 'login'. - reload - lädt modifizierte Module neu. + lxinit 'login' - lädt das Lx-Office Environment für den User 'login'. + reload - lädt modifizierte Module neu. pp DATA - zeigt die Datenstruktur mit Data::Dumper an. quit - beendet die Konsole EOL -# load 'module' - läd das angegebene Modul, d.h. bin/mozilla/module.pl und SL/Module.pm. +# load 'module' - läd das angegebene Modul, d.h. bin/mozilla/module.pl und SL/Module.pm. } sub pp { - $Data::Dumper::Indent = 2; - $Data::Dumper::Maxdepth = 2; + local $Data::Dumper::Indent = 2; + local $Data::Dumper::Maxdepth = 2; + local $Data::Dumper::Sortkeys = 1; Data::Dumper::Dumper(@_); } @@ -193,6 +194,6 @@ See there for interesting options. =head1 AUTHOR - Sven Schöling + Sven Schöling =cut